(String what, Font font)
| 516 | } |
| 517 | |
| 518 | public static Map<String, Object> getStyledFont(String what, Font font) { |
| 519 | String split[] = get("editor." + what + ".style").split(","); |
| 520 | |
| 521 | Color color = PreferencesHelper.parseColor(split[0]); |
| 522 | |
| 523 | String style = split[1]; |
| 524 | boolean bold = style.contains("bold"); |
| 525 | boolean italic = style.contains("italic"); |
| 526 | boolean underlined = style.contains("underlined"); |
| 527 | |
| 528 | Font styledFont = new Font(font.getFamily(), |
| 529 | (bold ? Font.BOLD : 0) | (italic ? Font.ITALIC : 0), font.getSize()); |
| 530 | if (underlined) { |
| 531 | Map<TextAttribute, Object> attr = new Hashtable<>(); |
| 532 | attr.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); |
| 533 | styledFont = styledFont.deriveFont(attr); |
| 534 | } |
| 535 | |
| 536 | Map<String, Object> result = new HashMap<>(); |
| 537 | result.put("color", color); |
| 538 | result.put("font", styledFont); |
| 539 | |
| 540 | return result; |
| 541 | } |
| 542 | |
| 543 | /** |
| 544 | * Return an Image object from inside the Processing lib folder. |
no test coverage detected