MCPcopy Index your code
hub / github.com/arduino/Arduino / getStyledFont

Method getStyledFont

app/src/processing/app/Theme.java:518–541  ·  view source on GitHub ↗
(String what, Font font)

Source from the content-addressed store, hash-verified

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.

Callers 2

setThemeMethod · 0.80
setSyntaxThemeMethod · 0.80

Calls 5

getMethod · 0.95
parseColorMethod · 0.95
splitMethod · 0.80
putMethod · 0.80
getSizeMethod · 0.45

Tested by

no test coverage detected