JBR-1850: on macOS fonts should be sorted by weight to ensure proper population of the families

(cherry picked from commit 59974ca04c)
This commit is contained in:
Dennis Ushakov
2019-09-24 18:48:51 +03:00
committed by jbrbot
parent 3984a944f7
commit 6650420f4b

View File

@@ -28,12 +28,8 @@ package sun.font;
import java.io.File;
import java.awt.Font;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.HashMap;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Locale;
public class FontFamily {
@@ -263,6 +259,9 @@ public class FontFamily {
if (initialized) {
return;
}
if (FontUtilities.isMacOSX) {
fontSequence.sort(Comparator.comparing(FontAndStyle::getWeight));
}
for (FontAndStyle fontAndStyle : fontSequence) {
doSetFont(fontAndStyle.font, fontAndStyle.style);
}
@@ -493,6 +492,10 @@ public class FontFamily {
font = inFont;
style = inStyle;
}
int getWeight() {
return font.getWeight();
}
}
}