mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)
(cherry picked from commit e838103a24)
This commit is contained in:
@@ -211,6 +211,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
boolean loadedAllFontFiles = false;
|
||||
HashMap<String,String> jreFontMap;
|
||||
HashSet<String> jreBundledFontFiles;
|
||||
HashSet<String> ideaFontSet;
|
||||
String[] jreOtherFontFiles;
|
||||
boolean noOtherJREFontFiles = false; // initial assumption.
|
||||
|
||||
@@ -244,6 +245,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private static final FilenameFilter ttFilter = new TTFilter();
|
||||
private static final FilenameFilter t1Filter = new T1Filter();
|
||||
|
||||
private FilenameFilter ttFilterIdea;
|
||||
private FilenameFilter ttFilterJre;
|
||||
private Font[] allFonts;
|
||||
private String[] allFamilies; // cache for default locale only
|
||||
private Locale lastDefaultLocale;
|
||||
@@ -342,21 +345,26 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("Roboto light", "Roboto-Light.ttf");
|
||||
jreFontMap.put("Roboto thin", "Roboto-Thin.ttf");
|
||||
|
||||
jreFontMap.put("JetBrains Mono 520 Bold", "JetBrainsMono520-Bold.ttf");
|
||||
jreFontMap.put("JetBrains Mono 520 Regular", "JetBrainsMono520-Regular.ttf");
|
||||
jreFontMap.put("JetBrains Mono 520 Thin", "JetBrainsMono520-Thin.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded Bold", "JetBrainsMonoExpanded-Bold.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded Regular", "JetBrainsMonoExpanded-Regular.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded Thin", "JetBrainsMonoExpanded-Thin.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded 520 Bold", "JetBrainsMonoExpanded520-Bold.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded 520 Regular", "JetBrainsMonoExpanded520-Regular.ttf");
|
||||
jreFontMap.put("JetBrains Mono Expanded 520 Thin", "JetBrainsMonoExpanded520-Thin.ttf");
|
||||
jreFontMap.put("JetBrains Mono Bold", "JetBrainsMono-Bold.ttf");
|
||||
jreFontMap.put("JetBrains Mono Regular", "JetBrainsMono-Regular.ttf");
|
||||
jreFontMap.put("JetBrains Mono Italic", "JetBrainsMono-Italic.ttf");
|
||||
jreFontMap.put("JetBrains Mono Bold Italic", "JetBrainsMono-BoldItalic.ttf");
|
||||
ideaFontSet = new HashSet<>();
|
||||
ideaFontSet.add("FiraCode-Bold.ttf");
|
||||
ideaFontSet.add("FiraCode-Light.ttf");
|
||||
ideaFontSet.add("FiraCode-Medium.ttf");
|
||||
ideaFontSet.add("FiraCode-Retina.ttf");
|
||||
ideaFontSet.add("FiraCode-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-BoldIt.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Bold.ttf");
|
||||
ideaFontSet.add("SourceCodePro-It.ttf");
|
||||
ideaFontSet.add("Inconsolata.ttf");
|
||||
ideaFontSet.add("Roboto-Light.ttf");
|
||||
ideaFontSet.add("Roboto-Thin.ttf");
|
||||
|
||||
jreBundledFontFiles.addAll(jreFontMap.values());
|
||||
ttFilterIdea = new TTFilterIdea(true, ideaFontSet);
|
||||
ttFilterJre = new TTFilterIdea(false, ideaFontSet);
|
||||
|
||||
for (String ffile : jreFontMap.values()) {
|
||||
jreBundledFontFiles.add(ffile);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -432,22 +440,21 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
}
|
||||
|
||||
/* Here we get the fonts in jre/lib/fonts and register
|
||||
* them so they are always available and preferred over
|
||||
* other fonts. This needs to be registered before the
|
||||
* composite fonts as otherwise some native font that
|
||||
* corresponds may be found as we don't have a way to
|
||||
* handle two fonts of the same name, so the JRE one
|
||||
* must be the first one registered. Pass "true" to
|
||||
* registerFonts method as on-screen these JRE fonts
|
||||
* always go through the JDK rasteriser.
|
||||
*/
|
||||
if (FontUtilities.isLinux) {
|
||||
/* Linux font configuration uses these fonts */
|
||||
registerFontDir(jreFontDirName);
|
||||
}
|
||||
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
|
||||
true, false);
|
||||
/* Here we get the fonts in jre/lib/fonts and register
|
||||
* them so they are always available and preferred over
|
||||
* other fonts. This needs to be registered before the
|
||||
* composite fonts as otherwise some native font that
|
||||
* corresponds may be found as we don't have a way to
|
||||
* handle two fonts of the same name, so the JRE one
|
||||
* must be the first one registered. Pass "true" to
|
||||
* registerFonts method as on-screen these JRE fonts
|
||||
* always go through the JDK rasteriser.
|
||||
*/
|
||||
if (FontUtilities.isLinux) {
|
||||
/* Linux font configuration uses these fonts */
|
||||
registerFontDir(jreFontDirName);
|
||||
}
|
||||
registerJREFonts();
|
||||
|
||||
/* Create the font configuration and get any font path
|
||||
* that might be specified.
|
||||
@@ -3104,7 +3111,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
|
||||
/* Called to register fall back fonts */
|
||||
public void registerFontsInDir(String dirName) {
|
||||
registerFontsInDir(dirName, true, Font2D.JRE_RANK, true, false);
|
||||
registerJREFonts();
|
||||
}
|
||||
|
||||
// MACOSX begin -- need to access this in subclass
|
||||
@@ -3125,6 +3132,18 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
defer, resolveSymLinks);
|
||||
}
|
||||
|
||||
protected void registerJREFonts() {
|
||||
File pathFile = new File(jreFontDirName);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterIdea,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.IDEA_RANK,
|
||||
true, false);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterJre,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.JRE_RANK,
|
||||
true, false);
|
||||
}
|
||||
|
||||
protected void registerFontDir(String path) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user