8191512: T2K font rasterizer code removal
Reviewed-by: serb, erikj
This commit is contained in:
parent
4800622742
commit
fe746c5d2a
@ -179,7 +179,6 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ];
|
|||||||
./lib/libsplashscreen.so
|
./lib/libsplashscreen.so
|
||||||
./lib/libsunec.so
|
./lib/libsunec.so
|
||||||
./lib/libsunwjdga.so
|
./lib/libsunwjdga.so
|
||||||
./lib/libt2k.so
|
|
||||||
./lib/libunpack.so
|
./lib/libunpack.so
|
||||||
./lib/libverify.so
|
./lib/libverify.so
|
||||||
./lib/libzip.so
|
./lib/libzip.so
|
||||||
@ -290,7 +289,6 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]
|
|||||||
./lib/libsplashscreen.so
|
./lib/libsplashscreen.so
|
||||||
./lib/libsunec.so
|
./lib/libsunec.so
|
||||||
./lib/libsunwjdga.so
|
./lib/libsunwjdga.so
|
||||||
./lib/libt2k.so
|
|
||||||
./lib/libunpack.so
|
./lib/libunpack.so
|
||||||
./lib/libverify.so
|
./lib/libverify.so
|
||||||
./lib/libzip.so
|
./lib/libzip.so
|
||||||
|
@ -28,7 +28,7 @@ package sun.font;
|
|||||||
/* remember that the API requires a Font use a
|
/* remember that the API requires a Font use a
|
||||||
* consistent glyph id. for a code point, and this is a
|
* consistent glyph id. for a code point, and this is a
|
||||||
* problem if a particular strike uses native scaler sometimes
|
* problem if a particular strike uses native scaler sometimes
|
||||||
* and T2K others. That needs to be dealt with somewhere, but
|
* and the JDK scaler others. That needs to be dealt with somewhere, but
|
||||||
* here we can just always get the same glyph code without
|
* here we can just always get the same glyph code without
|
||||||
* needing a strike.
|
* needing a strike.
|
||||||
*
|
*
|
||||||
|
@ -50,9 +50,6 @@ public class FontManagerNativeLibrary {
|
|||||||
To avoid link error we have to load freetype explicitly
|
To avoid link error we have to load freetype explicitly
|
||||||
before we load fontmanager.
|
before we load fontmanager.
|
||||||
|
|
||||||
Note that we do not need to do this for T2K because
|
|
||||||
fontmanager.dll does not depend on t2k.dll.
|
|
||||||
|
|
||||||
NB: consider moving freetype wrapper part to separate
|
NB: consider moving freetype wrapper part to separate
|
||||||
shared library in order to avoid dependency. */
|
shared library in order to avoid dependency. */
|
||||||
System.loadLibrary("freetype");
|
System.loadLibrary("freetype");
|
||||||
|
@ -29,7 +29,6 @@ import java.awt.geom.GeneralPath;
|
|||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
|
|
||||||
import sun.java2d.Disposer;
|
import sun.java2d.Disposer;
|
||||||
import sun.java2d.DisposerRecord;
|
import sun.java2d.DisposerRecord;
|
||||||
@ -82,51 +81,16 @@ import sun.java2d.DisposerRecord;
|
|||||||
public abstract class FontScaler implements DisposerRecord {
|
public abstract class FontScaler implements DisposerRecord {
|
||||||
|
|
||||||
private static FontScaler nullScaler = null;
|
private static FontScaler nullScaler = null;
|
||||||
private static Constructor<? extends FontScaler> scalerConstructor = null;
|
|
||||||
|
|
||||||
//Find preferred font scaler
|
//Find preferred font scaler
|
||||||
//
|
//
|
||||||
//NB: we can allow property based preferences
|
//NB: we can allow property based preferences
|
||||||
// (theoretically logic can be font type specific)
|
// (theoretically logic can be font type specific)
|
||||||
static {
|
|
||||||
Class<? extends FontScaler> scalerClass = null;
|
|
||||||
Class<?>[] arglst = new Class<?>[] {Font2D.class, int.class,
|
|
||||||
boolean.class, int.class};
|
|
||||||
|
|
||||||
try {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
|
|
||||||
((!FontUtilities.useT2K && !FontUtilities.useLegacy) ?
|
|
||||||
Class.forName("sun.font.FreetypeFontScaler") :
|
|
||||||
Class.forName("sun.font.T2KFontScaler"));
|
|
||||||
scalerClass = tmp;
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
try {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
|
|
||||||
Class.forName("sun.font.FreetypeFontScaler");
|
|
||||||
scalerClass = tmp;
|
|
||||||
} catch (ClassNotFoundException e1) {
|
|
||||||
scalerClass = NullFontScaler.class;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (FontUtilities.debugFonts()) {
|
|
||||||
System.out.println("Scaler class="+scalerClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//NB: rewrite using factory? constructor is ugly way
|
|
||||||
try {
|
|
||||||
scalerConstructor = scalerClass.getConstructor(arglst);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
//should not happen
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is the only place to instantiate new FontScaler.
|
/* This is the only place to instantiate new FontScaler.
|
||||||
* Therefore this is very convinient place to register
|
* Therefore this is very convinient place to register
|
||||||
* scaler with Disposer as well as trigger deregistring bad font
|
* scaler with Disposer as well as trigger deregistering a bad font
|
||||||
* in case when scaler reports this.
|
* when the scaler reports this.
|
||||||
*/
|
*/
|
||||||
public static FontScaler getScaler(Font2D font,
|
public static FontScaler getScaler(Font2D font,
|
||||||
int indexInCollection,
|
int indexInCollection,
|
||||||
@ -135,14 +99,13 @@ public abstract class FontScaler implements DisposerRecord {
|
|||||||
FontScaler scaler = null;
|
FontScaler scaler = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object args[] = new Object[] {font, indexInCollection,
|
scaler = new FreetypeFontScaler(font, indexInCollection,
|
||||||
supportsCJK, filesize};
|
supportsCJK, filesize);
|
||||||
scaler = scalerConstructor.newInstance(args);
|
|
||||||
Disposer.addObjectRecord(font, scaler);
|
Disposer.addObjectRecord(font, scaler);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
scaler = nullScaler;
|
scaler = getNullScaler();
|
||||||
|
|
||||||
//if we can not instantiate scaler assume bad font
|
//if we can not instantiate scaler assume a bad font
|
||||||
//NB: technically it could be also because of internal scaler
|
//NB: technically it could be also because of internal scaler
|
||||||
// error but here we are assuming scaler is ok.
|
// error but here we are assuming scaler is ok.
|
||||||
FontManager fm = FontManagerFactory.getInstance();
|
FontManager fm = FontManagerFactory.getInstance();
|
||||||
|
@ -52,10 +52,6 @@ public final class FontUtilities {
|
|||||||
|
|
||||||
public static boolean useJDKScaler;
|
public static boolean useJDKScaler;
|
||||||
|
|
||||||
public static boolean useT2K;
|
|
||||||
// useLegacy is a short-term debugging transition aid.
|
|
||||||
public static boolean useLegacy;
|
|
||||||
|
|
||||||
public static boolean isWindows;
|
public static boolean isWindows;
|
||||||
|
|
||||||
private static boolean debugFonts = false;
|
private static boolean debugFonts = false;
|
||||||
@ -76,33 +72,16 @@ public final class FontUtilities {
|
|||||||
|
|
||||||
isMacOSX = osName.contains("OS X"); // TODO: MacOSX
|
isMacOSX = osName.contains("OS X"); // TODO: MacOSX
|
||||||
|
|
||||||
/* Support a value of "t2k" as meaning use the JDK internal
|
/* If set to "jdk", use the JDK's scaler rather than
|
||||||
* scaler over the platform scaler whether or not t2k is
|
* the platform one. This may be a no-op on platforms where
|
||||||
* actually available.
|
* JDK has been configured so that it always relies on the
|
||||||
* This can be considered transitional support for some
|
* platform scaler. The principal case where it has an
|
||||||
* level of compatibility, as in it avoids the native scaler
|
* effect is that on Windows, 2D will never use GDI.
|
||||||
* as before but cannot guarantee rendering equivalence
|
|
||||||
* with T2K.
|
|
||||||
* It will also use t2k instead of freetype if t2k is
|
|
||||||
* available - this is the same as before.
|
|
||||||
* The new value of "jdk" means even if t2k is available,
|
|
||||||
* the decision as to whether to use that or freetype is
|
|
||||||
* not affected by this setting.
|
|
||||||
*/
|
*/
|
||||||
String scalerStr = System.getProperty("sun.java2d.font.scaler");
|
String scalerStr = System.getProperty("sun.java2d.font.scaler");
|
||||||
if (scalerStr != null) {
|
if (scalerStr != null) {
|
||||||
useT2K = "t2k".equals(scalerStr);
|
useJDKScaler = "jdk".equals(scalerStr);
|
||||||
if (useT2K) {
|
|
||||||
System.out.println("WARNING: t2k will be removed in JDK 11.");
|
|
||||||
}
|
|
||||||
useLegacy = "legacy".equals(scalerStr);
|
|
||||||
if (useLegacy) {
|
|
||||||
System.out.println("WARNING: legacy behavior will be removed in JDK 11.");
|
|
||||||
}
|
|
||||||
useJDKScaler = useT2K || "jdk".equals(scalerStr);
|
|
||||||
} else {
|
} else {
|
||||||
useT2K = false;
|
|
||||||
useLegacy = false;
|
|
||||||
useJDKScaler = false;
|
useJDKScaler = false;
|
||||||
}
|
}
|
||||||
isWindows = osName.startsWith("Windows");
|
isWindows = osName.startsWith("Windows");
|
||||||
|
@ -132,10 +132,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
|||||||
public static final int FONTFORMAT_NONE = -1;
|
public static final int FONTFORMAT_NONE = -1;
|
||||||
public static final int FONTFORMAT_TRUETYPE = 0;
|
public static final int FONTFORMAT_TRUETYPE = 0;
|
||||||
public static final int FONTFORMAT_TYPE1 = 1;
|
public static final int FONTFORMAT_TYPE1 = 1;
|
||||||
public static final int FONTFORMAT_T2K = 2;
|
public static final int FONTFORMAT_TTC = 2;
|
||||||
public static final int FONTFORMAT_TTC = 3;
|
public static final int FONTFORMAT_COMPOSITE = 3;
|
||||||
public static final int FONTFORMAT_COMPOSITE = 4;
|
public static final int FONTFORMAT_NATIVE = 4;
|
||||||
public static final int FONTFORMAT_NATIVE = 5;
|
|
||||||
|
|
||||||
/* Pool of 20 font file channels chosen because some UTF-8 locale
|
/* Pool of 20 font file channels chosen because some UTF-8 locale
|
||||||
* composite fonts can use up to 16 platform fonts (including the
|
* composite fonts can use up to 16 platform fonts (including the
|
||||||
@ -353,7 +352,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
|||||||
* handle two fonts of the same name, so the JRE one
|
* handle two fonts of the same name, so the JRE one
|
||||||
* must be the first one registered. Pass "true" to
|
* must be the first one registered. Pass "true" to
|
||||||
* registerFonts method as on-screen these JRE fonts
|
* registerFonts method as on-screen these JRE fonts
|
||||||
* always go through the T2K rasteriser.
|
* always go through the JDK rasteriser.
|
||||||
*/
|
*/
|
||||||
if (FontUtilities.isLinux) {
|
if (FontUtilities.isLinux) {
|
||||||
/* Linux font configuration uses these fonts */
|
/* Linux font configuration uses these fonts */
|
||||||
|
@ -32,13 +32,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define kPosInfinity16 (32767)
|
|
||||||
#define kNegInfinity16 (-32768)
|
|
||||||
|
|
||||||
#define kPosInfinity32 (0x7fffffff)
|
|
||||||
#define kNegInfinity32 (0x80000000)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
typedef unsigned int UInt32;
|
typedef unsigned int UInt32;
|
||||||
typedef int Int32;
|
typedef int Int32;
|
||||||
@ -65,27 +58,6 @@ typedef UInt32 Bool32;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define kPosInfinity32 (0x7fffffff)
|
|
||||||
#define kNegInfinity32 (0x80000000)
|
|
||||||
|
|
||||||
#define F26Dot6ToFixed(n) ((n) << 10)
|
|
||||||
#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64)
|
|
||||||
|
|
||||||
/* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */
|
|
||||||
typedef Int32 t2kFixed;
|
|
||||||
typedef float t2kScalar;
|
|
||||||
|
|
||||||
#define t2kIntToFixed(x) ((t2kFixed)(x) << 16)
|
|
||||||
#define t2kFixedToInt(x) ((x) >> 16)
|
|
||||||
|
|
||||||
#define t2kFixedRound(x) (((x) + 0x8000) >> 16)
|
|
||||||
#define t2kFixed1 t2kIntToFixed(1)
|
|
||||||
|
|
||||||
#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1))
|
|
||||||
#define t2kFixedToFloat(x) ((x) / (float)(65536))
|
|
||||||
|
|
||||||
#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))
|
|
||||||
|
|
||||||
/* managed: 1 means the glyph has a hardware cached
|
/* managed: 1 means the glyph has a hardware cached
|
||||||
* copy, and its freeing is managed by the usual
|
* copy, and its freeing is managed by the usual
|
||||||
* 2D disposer code.
|
* 2D disposer code.
|
||||||
|
Loading…
Reference in New Issue
Block a user