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

14
LINES

< > BotCompany Repo | #1006845 // fontMetrics

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6206L/37K).

static FontMetrics fontMetrics(S fontSnippetID, float fontSize) {
  ret fontMetrics(loadFont_cached(fontSnippetID, fontSize));
}

static FontMetrics fontMetrics(Font font) {
  BufferedImage dummyImg = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
  Graphics g = antiAliasGraphics(dummyImg);
  g.setFont(font);
  ret g.getFontMetrics();
}

static FontMetrics fontMetrics(Graphics g) {
  ret g?.getFontMetrics();
}

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: #1006845
Snippet name: fontMetrics
Eternal ID of this version: #1006845/3
Text MD5: ec7078e71ede89b194f890559985eef3
Transpilation MD5: 606bff20d26699c27c007b520c62e2ba
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-10 16:33:15
Source code size: 432 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 562 / 640
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1036555 - stringWidth