Changeset 982 for trunk/src/org/expeditee
- Timestamp:
- 12/14/15 13:42:02 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r935 r982 183 183 184 184 try { 185 //Font customFont = Font.createFont(Font.TRUETYPE_FONT, fontFile).deriveFont(32f); 185 186 Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile); 186 187 187 ge.registerFont(font); 188 boolean registered_status_ok= ge.registerFont(font); 189 190 if (registered_status_ok) { 191 192 //System.out.println("*** Just added custom TTF font file: " + fontFile); 193 //System.out.println("Added Font Family: '" + font.getFamily() + "'"); 194 195 String font_family = font.getFamily(); 196 if (!FONT_WHEEL_ADDITIONAL_LOOKUP.containsKey(font_family)) { 197 198 if (FONT_WHEEL_ADDITIONAL_LOOKUP.size()>0) { 199 System.out.print(", "); 200 } 201 System.out.print("'" + font.getFamily() + "'"); 202 203 FONT_WHEEL_ADDITIONAL_LOOKUP.put(font_family,font); 204 205 int cdut = font.canDisplayUpTo("09AZaz"); 206 if (cdut>=0) { 207 // Some problem has occured (should return -1 to show all chars possible) 208 209 System.out.println(" [Non-ASCII font]"); 210 } 211 System.out.flush(); 212 } 213 214 } 215 else { 216 System.err.println("Error: Failed to add custom True-Type Font file: " + fontFile); 217 } 218 219 220 //String []fontFamilies = ge.getAvailableFontFamilyNames(); 221 //for (String n: fontFamilies) { 222 // System.out.println("font family name: " + n); 223 //} 224 //System.out.println("===="); 225 188 226 } 189 227 catch (Exception e) { … … 212 250 for (File fontFamilyDir : fontFamilyDirs) { 213 251 if (fontFamilyDir.isDirectory()) { 214 215 if (first_item) {216 System.out.print(" " + fontFamilyDir.getName());217 first_item = false;218 }219 else {220 System.out.print(", " + fontFamilyDir.getName());221 }222 System.out.flush();223 224 252 InitFontFamily(ge,fontFamilyDir); 225 253 } … … 1138 1166 public static final String MONOSPACED_FONT = "monospaced"; 1139 1167 1140 public static final String[] FONT_WHEEL = { "sansserif", "monospaced", 1141 "serif", "dialog", "dialoginput" }; 1142 1143 public static final char[] FONT_CHARS = { 's', 'm', 't', 'd', 'i' }; 1144 1168 public static final String[] FONT_WHEEL = { "sansserif", "monospaced", "serif", "dialog", "dialoginput" }; 1169 public static final char[] FONT_CHARS = { 's', 'm', 't', 'd', 'i' }; 1170 1171 // A hashtable to store the font family names that are loaded in through the TTF files 1172 // provided in the 'assets' folder 1173 public static HashMap<String, Font> FONT_WHEEL_ADDITIONAL_LOOKUP = new HashMap<>(); 1174 1145 1175 private static final int NEARBY_GRAVITY = 2; 1146 1176
Note:
See TracChangeset
for help on using the changeset viewer.