(int size, int style)
| 1010 | |
| 1011 | |
| 1012 | static public Font getMonoFont(int size, int style) { |
| 1013 | if (monoFont == null) { |
| 1014 | try { |
| 1015 | monoFont = createFont("SourceCodePro-Regular.ttf", size); |
| 1016 | monoBoldFont = createFont("SourceCodePro-Bold.ttf", size); |
| 1017 | |
| 1018 | // https://github.com/processing/processing/issues/2886 |
| 1019 | // https://github.com/processing/processing/issues/4944 |
| 1020 | String lang = Language.getLanguage(); |
| 1021 | if ("el".equals(lang) || |
| 1022 | "ar".equals(lang) || |
| 1023 | Locale.CHINESE.getLanguage().equals(lang) || |
| 1024 | Locale.JAPANESE.getLanguage().equals(lang) || |
| 1025 | Locale.KOREAN.getLanguage().equals(lang)) { |
| 1026 | sansFont = new Font("Monospaced", Font.PLAIN, size); |
| 1027 | sansBoldFont = new Font("Monospaced", Font.BOLD, size); |
| 1028 | } |
| 1029 | } catch (Exception e) { |
| 1030 | Messages.loge("Could not load mono font", e); |
| 1031 | monoFont = new Font("Monospaced", Font.PLAIN, size); |
| 1032 | monoBoldFont = new Font("Monospaced", Font.BOLD, size); |
| 1033 | } |
| 1034 | } |
| 1035 | if (style == Font.BOLD) { |
| 1036 | if (size == monoBoldFont.getSize()) { |
| 1037 | return monoBoldFont; |
| 1038 | } else { |
| 1039 | return monoBoldFont.deriveFont((float) size); |
| 1040 | } |
| 1041 | } else { |
| 1042 | if (size == monoFont.getSize()) { |
| 1043 | return monoFont; |
| 1044 | } else { |
| 1045 | return monoFont.deriveFont((float) size); |
| 1046 | } |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | |
| 1051 | static public String getSansFontName() { |
no test coverage detected