an option to disable native rendering for rotated text (following JRE-19)

port commit ccc1ded6 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 72fb9ff7c4)

cherry picked from commit a5bd092449
This commit is contained in:
Dmitry Batrak
2018-12-24 14:51:14 +03:00
committed by jbrbot
parent 78497c5bd7
commit 7fcba22ac3

View File

@@ -120,6 +120,8 @@ public class FileFontStrike extends PhysicalStrike {
private static native boolean isDirectWriteAvailable();
private static boolean isXPorLater = false;
private static boolean useNativesForRotatedText;
private static boolean useDirectWrite;
// DirectWrite rendering options' values can be found in MSDN documentation
@@ -150,6 +152,8 @@ public class FileFontStrike extends PhysicalStrike {
if (isXPorLater) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
String rotatedProperty = System.getProperty("rotated.text.native.rendering");
useNativesForRotatedText = rotatedProperty == null || Boolean.parseBoolean(rotatedProperty);
useDirectWrite = Boolean.getBoolean("directwrite.font.rendering") && isDirectWriteAvailable();
if (useDirectWrite) {
String options = System.getProperty("directwrite.font.rendering.options");
@@ -287,7 +291,7 @@ public class FileFontStrike extends PhysicalStrike {
pts = Math.abs(matrix[1]);
}
intPtSize = (int) pts;
useNatives = rotation >= 0 && pts >= 3.0 && pts <= 100.0 &&
useNatives = (rotation == 0 || rotation > 0 && useNativesForRotatedText) && pts >= 3.0 && pts <= 100.0 &&
!((TrueTypeFont)fileFont).useEmbeddedBitmapsForSize(intPtSize);
}
if (FontUtilities.isLogging() && FontUtilities.isWindows) {