Returns the default font for text areas. @return The default font.
()
| 487 | * @return The default font. |
| 488 | */ |
| 489 | public static final Font getDefaultFont() { |
| 490 | |
| 491 | // Use StyleContext to get a composite font for better Asian language |
| 492 | // support; see Sun bug S282887. |
| 493 | StyleContext sc = StyleContext.getDefaultStyleContext(); |
| 494 | Font font = null; |
| 495 | |
| 496 | if (OSUtils.isMacOS()) { |
| 497 | // Snow Leopard (1.6) uses Menlo as default monospaced font, |
| 498 | // pre-Snow Leopard used Monaco. |
| 499 | font = sc.getFont("Menlo", Font.PLAIN, 12); |
| 500 | if (!"Menlo".equals(font.getFamily())) { |
| 501 | font = sc.getFont("Monaco", Font.PLAIN, 12); |
| 502 | if (!"Monaco".equals(font.getFamily())) { // Shouldn't happen |
| 503 | font = sc.getFont("Monospaced", Font.PLAIN, 13); |
| 504 | } |
| 505 | } |
| 506 | } else { |
| 507 | // Consolas added in Vista, used by VS2010+. |
| 508 | font = sc.getFont("Consolas", Font.PLAIN, 13); |
| 509 | if (!"Consolas".equals(font.getFamily())) { |
| 510 | font = sc.getFont("Monospaced", Font.PLAIN, 13); |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | // System.out.println(font.getFamily() + ", " + font.getName()); |
| 515 | return font; |
| 516 | } |
| 517 | |
| 518 | public static Map<String, Object> getStyledFont(String what, Font font) { |
| 519 | String split[] = get("editor." + what + ".style").split(","); |