MCPcopy Index your code
hub / github.com/processing/processing / getSansFont

Method getSansFont

app/src/processing/app/ui/Toolkit.java:1060–1096  ·  view source on GitHub ↗
(int size, int style)

Source from the content-addressed store, hash-verified

1058
1059
1060 static public Font getSansFont(int size, int style) {
1061 if (sansFont == null) {
1062 try {
1063 sansFont = createFont("ProcessingSansPro-Regular.ttf", size);
1064 sansBoldFont = createFont("ProcessingSansPro-Semibold.ttf", size);
1065
1066 // https://github.com/processing/processing/issues/2886
1067 // https://github.com/processing/processing/issues/4944
1068 String lang = Language.getLanguage();
1069 if ("el".equals(lang) ||
1070 "ar".equals(lang) ||
1071 Locale.CHINESE.getLanguage().equals(lang) ||
1072 Locale.JAPANESE.getLanguage().equals(lang) ||
1073 Locale.KOREAN.getLanguage().equals(lang)) {
1074 sansFont = new Font("SansSerif", Font.PLAIN, size);
1075 sansBoldFont = new Font("SansSerif", Font.BOLD, size);
1076 }
1077 } catch (Exception e) {
1078 Messages.loge("Could not load sans font", e);
1079 sansFont = new Font("SansSerif", Font.PLAIN, size);
1080 sansBoldFont = new Font("SansSerif", Font.BOLD, size);
1081 }
1082 }
1083 if (style == Font.BOLD) {
1084 if (size == sansBoldFont.getSize()) {
1085 return sansBoldFont;
1086 } else {
1087 return sansBoldFont.deriveFont((float) size);
1088 }
1089 } else {
1090 if (size == sansFont.getSize()) {
1091 return sansFont;
1092 } else {
1093 return sansFont.deriveFont((float) size);
1094 }
1095 }
1096 }
1097
1098
1099 /**

Callers 9

getFontMethod · 0.95
getFontMethod · 0.95
ManagerFrameMethod · 0.95
WelcomeMethod · 0.95
getSansFontNameMethod · 0.95
statusToolTipMethod · 0.95
Welcome2Method · 0.95
paintMethod · 0.95
CompletionPanelMethod · 0.95

Calls 5

createFontMethod · 0.95
getLanguageMethod · 0.95
logeMethod · 0.95
getSizeMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected