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

8
LINES

< > BotCompany Repo | #1023068 // textLayoutToOutlineAndSize

JavaX fragment (include)

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

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: 251 / 290
Version history: 1 change(s)
Referenced in: [show references]