static Pair<Shape, Rect> textLayoutToOutlineAndSize_multiLine_centered(S text, Font font, Component c, O... _) { int lineSpacing = optPar lineSpacing(_, font.getSize()/4); LS lines = lines(text); Area area = null; int y = 0, w = 0; new LPair<Shape, Rect> l; for (S line : lines) { Pair<Shape, Rect> p = textLayoutToOutlineAndSize(line, font, c); l.add(p); w = max(w, p.b.w); } for (Pair<Shape, Rect> p : l) { Area a = new(p.a); new AffineTransform tx; tx.translate((w-p.b.w)/2, y); area = areaUnion(area, a.createTransformedArea(tx)); y += p.b.h+lineSpacing; } ret pair(area, rect(0, 0, w, y-lineSpacing)); }
Began life as a copy of #1023069
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: | #1023074 |
| Snippet name: | textLayoutToOutlineAndSize_multiLine_centered |
| Eternal ID of this version: | #1023074/4 |
| Text MD5: | da42a9e3b93ce9e27244fe9a21a4e74b |
| 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:54:59 |
| Source code size: | 687 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 619 / 647 |
| Version history: | 3 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |