MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getFont

Method getFont

ij/src/main/java/ij/util/FontUtil.java:12–21  ·  view source on GitHub ↗

Returns a font with the given family name or, if not available, a similar font, e.g. Helvetica replaced by Arial

(String fontFamilyName, int style, float size)

Source from the content-addressed store, hash-verified

10
11 /** Returns a font with the given family name or, if not available, a similar font, e.g. Helvetica replaced by Arial */
12 public static Font getFont(String fontFamilyName, int style, float size) {
13 Font font = new Font(fontFamilyName, style, (int)size);
14 if (!font.getFamily().startsWith(fontFamilyName)) {
15 String[] similarFonts = getSimilarFontsList(fontFamilyName);
16 font = getFont(similarFonts, style, (int)size);
17 }
18 if (size != (int)size)
19 font = font.deriveFont(size);
20 return font;
21 }
22
23 /** Returns the font for first element of the 'fontNames' array, where a Font Family Name starts with this name.
24 * E.g. if fontNames = {"Times New Roman", "Serif" and the system has no "Times New Roman", but finds "Serif",

Callers 3

PlotClass · 0.95
getFontMethod · 0.95
setSpinnerMethod · 0.95

Calls 2

getSimilarFontsListMethod · 0.95
startsWithMethod · 0.80

Tested by

no test coverage detected