static Pt centerTextInRect(FontMetrics fm, S s, Rect r) { int tw = fm.stringWidth(s), th = fm.getHeight(); ret pt(r.x + (r.w-tw)/2, r.y + (r.h-th)/2 + fm.getAscent()); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015361 |
Snippet name: | centerTextInRect |
Eternal ID of this version: | #1015361/2 |
Text MD5: | 742b4db4975ae889838bcf012cca8d80 |
Author: | stefan |
Category: | javax / drawing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-13 13:17:10 |
Source code size: | 176 bytes / 4 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 536 / 554 |
Version history: | 1 change(s) |
Referenced in: | [show references] |