mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-21 08:49:39 +01:00
JBR-5502: optimize stringWidth & charsWidth methods of FontDesignMetrics
This commit is contained in:
@@ -36,9 +36,14 @@ import java.util.stream.Collectors;
|
||||
public class FontExtensions {
|
||||
private interface FontExtension {
|
||||
FontExtension INSTANCE = (FontExtension) JBRApi.internalServiceBuilder(MethodHandles.lookup())
|
||||
.withStatic("getFeatures", "getFeatures", "java.awt.Font").build();
|
||||
.withStatic("getFeatures", "getFeatures", "java.awt.Font")
|
||||
.withStatic("isComplexRendering", "isComplexRendering", "java.awt.Font")
|
||||
.withStatic("isKerning", "isKerning", "java.awt.Font")
|
||||
.build();
|
||||
|
||||
TreeMap<String, Integer> getFeatures(Font font);
|
||||
boolean isComplexRendering(Font font);
|
||||
boolean isKerning(Font font);
|
||||
}
|
||||
|
||||
public static String[] featuresToStringArray(Map<String, Integer> features) {
|
||||
@@ -49,4 +54,12 @@ public class FontExtensions {
|
||||
public static TreeMap<String, Integer> getFeatures(Font font) {
|
||||
return FontExtension.INSTANCE.getFeatures(font);
|
||||
}
|
||||
|
||||
public static boolean isComplexRendering(Font font) {
|
||||
return FontExtension.INSTANCE.isComplexRendering(font);
|
||||
}
|
||||
|
||||
public static boolean isKerning(Font font) {
|
||||
return FontExtension.INSTANCE.isKerning(font);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user