aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Ushakov <alexey.ushakov@jetbrains.com>2017-03-21 00:13:37 +0300
committerAlexey Ushakov <Alexey.Ushakov@jetbrains.com>2017-03-31 16:54:51 +0300
commitdb5cf5a2b9cb454630fb86783c2d58cd5446cba6 (patch)
treefcd159f8a089e222917066f3334cf888874798ba
parent176e5bc962710055e216b4bdde3cc289d455dd7a (diff)
downloadjdk8u_jdk-db5cf5a2b9cb454630fb86783c2d58cd5446cba6.tar.gz
JRE-205 Font is wrong and without anti aliasing in 2017.1 EAP
Added property to disable bundled font config: java2d.font.loadFontConf=false
-rw-r--r--src/share/classes/sun/font/FreetypeFontScaler.java9
-rw-r--r--src/share/native/sun/font/freetypeScaler.c14
2 files changed, 19 insertions, 4 deletions
diff --git a/src/share/classes/sun/font/FreetypeFontScaler.java b/src/share/classes/sun/font/FreetypeFontScaler.java
index e07cc8875c..2b95577f3c 100644
--- a/src/share/classes/sun/font/FreetypeFontScaler.java
+++ b/src/share/classes/sun/font/FreetypeFontScaler.java
@@ -50,7 +50,14 @@ class FreetypeFontScaler extends FontScaler {
/* At the moment fontmanager library depends on freetype library
and therefore no need to load it explicitly here */
FontManagerNativeLibrary.load();
- String jreFontConfName = java.security.AccessController.doPrivileged(
+
+ String loadFontConf = java.security.AccessController.doPrivileged(
+ (PrivilegedAction<String>) () ->
+ System.getProperty("java2d.font.loadFontConf",
+ ""));
+
+ String jreFontConfName = "false".equals(loadFontConf) ? null :
+ java.security.AccessController.doPrivileged(
(PrivilegedAction<String>) () -> (
System.getProperty("java.home", "") +
File.separator + "lib") + File.separator + "fonts" +
diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
index 0d3637fca0..d32298c111 100644
--- a/src/share/native/sun/font/freetypeScaler.c
+++ b/src/share/native/sun/font/freetypeScaler.c
@@ -207,7 +207,8 @@ Java_sun_font_FreetypeFontScaler_initIDs(
jclass PFClass, jstring jreFontConfName)
{
const char *fssLogEnabled = getenv("OPENJDK_LOG_FFS");
- const char *fontConf = (*env)->GetStringUTFChars(env, jreFontConfName, NULL);
+ const char *fontConf = (*env)->IsSameObject(env, jreFontConfName, NULL) ?
+ NULL : (*env)->GetStringUTFChars(env, jreFontConfName, NULL);
if (fssLogEnabled != NULL && !strcmp(fssLogEnabled, "yes")) {
logFFS = JNI_TRUE;
@@ -246,14 +247,21 @@ Java_sun_font_FreetypeFontScaler_initIDs(
if (logFC) fprintf(stderr, "FC_LOG: fontconfig version %d \n", (*FcGetVersionPtr)());
fcConfig = (*FcInitLoadConfigAndFontsPtr)();
- if (fcConfig != NULL) {
+ if (fcConfig != NULL && fontConf != NULL) {
result = (*FcConfigParseAndLoadPtr)(fcConfig, (const FcChar8 *) fontConf, FcFalse);
if (logFC) fprintf(stderr, "FC_LOG: FcConfigParseAndLoad %d \n", result);
result = (*FcConfigSetCurrentPtr)(fcConfig);
if (logFC) fprintf(stderr, "FC_LOG: FcConfigSetCurrent %d \n", result);
}
else {
- if (logFC) fprintf(stderr, "FC_LOG: FcInitLoadConfigAndFonts failed\n");
+ if (logFC) {
+ if (fontConf) {
+ fprintf(stderr, "FC_LOG: FcInitLoadConfigAndFonts failed\n");
+ }
+ else {
+ fprintf(stderr, "FC_LOG: FcInitLoadConfigAndFonts disabled\n");
+ }
+ }
}
}
#endif