Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1023068 // textLayoutToOutlineAndSize

JavaX fragment (include)

1  
static Pair<Shape, Rect> textLayoutToOutlineAndSize(S text, Font font, Component c) {
2  
  TextLayout tl = newTextLayout(text, font, c);
3  
  Rectangle2D r = tl.getBounds();
4  
  new AffineTransform tx;
5  
  tx.translate(0, r.getHeight());
6  
  Shape outline = tl.getOutline(tx);
7  
  ret pair(outline, toRect(r));
8  
}

Author comment

Began life as a copy of #1023067

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023068
Snippet name: textLayoutToOutlineAndSize
Eternal ID of this version: #1023068/2
Text MD5: 6a2896f4d0886a6cc43526cc80bc13e8
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-30 20:31:03
Source code size: 305 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 253 / 292
Version history: 1 change(s)
Referenced in: [show references]