Changeset 14331 in josm for trunk/src/com/kitfox/svg/util
- Timestamp:
- 2018-10-14T17:02:51+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/kitfox/svg/util/FontSystem.java
r14328 r14331 48 48 import java.util.HashMap; 49 49 import java.util.HashSet; 50 import java.util.Locale; 50 51 51 52 /** … … 58 59 FontMetrics fm; 59 60 60 HashMap<String, Glyph> glyphCache = new HashMap< String, Glyph>();61 HashMap<String, Glyph> glyphCache = new HashMap<>(); 61 62 62 static HashSet<String> sysFontNames = new HashSet< String>();63 static HashSet<String> sysFontNames = new HashSet<>(); 63 64 64 65 public static boolean checkIfSystemFontExists(String fontName) … … 66 67 if (sysFontNames.isEmpty()) 67 68 { 68 for (String name: GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames( ))69 for (String name: GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(Locale.ENGLISH)) 69 70 { 70 71 sysFontNames.add(name); … … 80 81 for (String fontName: families) 81 82 { 82 if (checkIfSystemFontExists(fontName)) 83 String javaFontName = mapJavaFontName(fontName); 84 if (checkIfSystemFontExists(javaFontName)) 83 85 { 84 return new FontSystem( fontName, fontStyle, fontWeight, fontSize);86 return new FontSystem(javaFontName, fontStyle, fontWeight, fontSize); 85 87 } 86 88 } 87 89 88 90 return null; 91 } 92 93 private static String mapJavaFontName(String fontName) { 94 if ("serif".equals(fontName)) { 95 return java.awt.Font.SERIF; 96 } else if ("sans-serif".equals(fontName)) { 97 return java.awt.Font.SANS_SERIF; 98 } else if ("monospace".equals(fontName)) { 99 return java.awt.Font.MONOSPACED; 100 } else { 101 return fontName; 102 } 89 103 } 90 104
Note:
See TracChangeset
for help on using the changeset viewer.