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

15
LINES

< > BotCompany Repo | #1023069 // textLayoutToOutlineAndSize_multiLine

JavaX fragment (include)

1  
static Pair<Shape, Rect> textLayoutToOutlineAndSize_multiLine(S text, Font font, Component c) {
2  
  LS lines = lines(text);
3  
  Area area = null;
4  
  int y = 0, w = 0;
5  
  for (S line : lines) {
6  
    Pair<Shape, Rect> p = textLayoutToOutlineAndSize(line, font, c);
7  
    w = max(w, p.b.w);
8  
    Area a = new(p.a);
9  
    new AffineTransform tx;
10  
    tx.translate(0, y);
11  
    area = areaUnion(area, a.createTransformedArea(tx));
12  
    y += p.b.h;
13  
  }
14  
  ret pair(area, rect(0, 0, w, y));
15  
}

Author comment

Began life as a copy of #1023068

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: #1023069
Snippet name: textLayoutToOutlineAndSize_multiLine
Eternal ID of this version: #1023069/3
Text MD5: 4537cb70fa4172e28190572032913ba5
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:46:13
Source code size: 482 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 281 / 318
Version history: 2 change(s)
Referenced in: [show references]