8191522: Remove Bigelow&Holmes Lucida fonts from JDK sources
Reviewed-by: serb, erikj
This commit is contained in:
parent
5ff01c4163
commit
9a9dad8b63
@ -34,9 +34,7 @@ allfonts.chinese-gb18030=SimSun-18030
|
||||
allfonts.chinese-hkscs=MingLiU_HKSCS
|
||||
allfonts.devanagari=Mangal
|
||||
allfonts.dingbats=Wingdings
|
||||
allfonts.lucida=Lucida Sans Regular
|
||||
allfonts.symbol=Symbol
|
||||
allfonts.thai=Lucida Sans Regular
|
||||
|
||||
serif.plain.alphabetic=Times New Roman
|
||||
serif.plain.chinese-ms950=MingLiU
|
||||
@ -202,10 +200,9 @@ sequence.monospaced.x-windows-949=korean,alphabetic,dingbats,symbol
|
||||
sequence.dialog.x-windows-949=alphabetic,korean,dingbats,symbol
|
||||
sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol
|
||||
|
||||
sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
|
||||
sequence.allfonts.x-windows-874=alphabetic,dingbats,symbol
|
||||
|
||||
sequence.fallback=lucida,\
|
||||
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
|
||||
sequence.fallback=chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
|
||||
japanese,korean
|
||||
|
||||
# Exclusion Ranges
|
||||
@ -256,7 +253,6 @@ filename.Gulim=gulim.TTC
|
||||
filename.Batang=batang.TTC
|
||||
filename.GulimChe=gulim.TTC
|
||||
|
||||
filename.Lucida_Sans_Regular=LucidaSansRegular.ttf
|
||||
filename.Mangal=MANGAL.TTF
|
||||
filename.Symbol=SYMBOL.TTF
|
||||
filename.Wingdings=WINGDING.TTF
|
||||
|
@ -43,7 +43,6 @@ allfonts.dingbats=-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fonts
|
||||
allfonts.japanese-x0212=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
|
||||
allfonts.korean=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
|
||||
allfonts.korean-johab=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
|
||||
allfonts.lucida=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
|
||||
allfonts.symbol=-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol
|
||||
allfonts.bengali=-misc-lohit bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
allfonts.gujarati=-misc-lohit gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
@ -426,7 +425,7 @@ sequence.allfonts.UTF-8.zh.TW=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030
|
||||
# - japanese-x0212: same files as japanese-x0201
|
||||
# - korean: same file as korean-johab
|
||||
sequence.fallback=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
|
||||
arabic,hebrew,thai,lucida,\
|
||||
arabic,hebrew,thai,\
|
||||
chinese-gb18030-0,\
|
||||
japanese-x0201,korean-johab,\
|
||||
hindi,bengali,telugu,marathi,tamil,gujarati,kannada,malayalam,\
|
||||
@ -466,7 +465,6 @@ filename.-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fon
|
||||
filename.-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/arphic/uming.ttf
|
||||
filename.-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol=/usr/share/fonts/TrueType/core/symbol.ttf
|
||||
filename.-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific=/usr/share/fonts/TrueType/core/wingdings.ttf
|
||||
filename.-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
|
||||
filename.-misc-lohit_bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Bengali.ttf
|
||||
filename.-misc-lohit_gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Gujarati.ttf
|
||||
filename.-misc-lohit_hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Hindi.ttf
|
||||
|
@ -39,10 +39,9 @@ allfonts.chinese-ms950-extb=MingLiU-ExtB
|
||||
allfonts.devanagari=Mangal
|
||||
allfonts.kannada=Tunga
|
||||
allfonts.dingbats=Wingdings
|
||||
allfonts.lucida=Lucida Sans Regular
|
||||
allfonts.symbol=Symbol
|
||||
allfonts.symbols=Segoe UI Symbol
|
||||
allfonts.thai=Lucida Sans Regular
|
||||
allfonts.thai=DokChampa
|
||||
allfonts.georgian=Sylfaen
|
||||
|
||||
serif.plain.alphabetic=Times New Roman
|
||||
@ -238,7 +237,7 @@ sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol
|
||||
|
||||
sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
|
||||
|
||||
sequence.fallback=lucida,symbols,\
|
||||
sequence.fallback=symbols,\
|
||||
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
|
||||
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian,kannada
|
||||
|
||||
@ -294,7 +293,7 @@ filename.Gulim=gulim.TTC
|
||||
filename.Batang=batang.TTC
|
||||
filename.GulimChe=gulim.TTC
|
||||
|
||||
filename.Lucida_Sans_Regular=LucidaSansRegular.ttf
|
||||
filename.DokChampa=dokchamp.ttf
|
||||
filename.Mangal=MANGAL.TTF
|
||||
filename.Tunga=TUNGA.TTF
|
||||
filename.Symbol=SYMBOL.TTF
|
||||
|
@ -23,8 +23,6 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
$(eval $(call IncludeCustomExtension, gendata/GendataFontConfig.gmk))
|
||||
|
||||
GENDATA_FONT_CONFIG_DST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
|
||||
|
||||
GENDATA_FONT_CONFIG_DATA_DIR ?= $(TOPDIR)/make/data/fontconfig
|
||||
|
@ -151,7 +151,7 @@ pixel.dbtests.getelem=disabled
|
||||
pixel.dbtests.setelem=disabled
|
||||
text.opts.data.tlength=32
|
||||
text.opts.data.tscript=english
|
||||
text.opts.font.fname=lucida
|
||||
text.opts.font.fname=dialog
|
||||
text.opts.font.fstyle=0
|
||||
text.opts.font.fsize=13.0
|
||||
text.opts.font.ftx=Identity
|
||||
|
@ -1,25 +0,0 @@
|
||||
24
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-1
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-1
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-1
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-1
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-2
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-2
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-2
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-2
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-4
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-4
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-4
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-4
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-5
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-5
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-5
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-5
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-7
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-7
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-7
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-7
|
||||
LucidaSansOblique.ttf -b&h-lucidasans-medium-i-normal-sans-0-0-0-0-p-0-iso8859-9
|
||||
LucidaSansDemiOblique.ttf -b&h-lucidasans-bold-i-normal-sans-0-0-0-0-p-0-iso8859-9
|
||||
LucidaTypewriterOblique.ttf -b&h-lucidatypewriter-medium-i-normal-sans-0-0-0-0-m-0-iso8859-9
|
||||
LucidaTypewriterBoldOblique.ttf -b&h-lucidatypewriter-bold-i-normal-sans-0-0-0-0-m-0-iso8859-9
|
@ -211,10 +211,8 @@ public final class CFont extends PhysicalFont implements FontSubstitution {
|
||||
ArrayList<String> listOfString = new ArrayList<String>();
|
||||
getCascadeList(nativeFontPtr, listOfString);
|
||||
|
||||
// add JRE "Lucida Sans Regular" to the cascade list to enable fallback
|
||||
// to happen to this JRE font in case the intended glyph is missing in
|
||||
// fonts provided in the CoreText provided cascaded list
|
||||
listOfString.add("Lucida Sans Regular");
|
||||
// In some italic cases the standard Mac cascade list is missing Arabic.
|
||||
listOfString.add("GeezaPro");
|
||||
FontManager fm = FontManagerFactory.getInstance();
|
||||
int numFonts = 1 + listOfString.size();
|
||||
PhysicalFont[] fonts = new PhysicalFont[numFonts];
|
||||
|
@ -220,12 +220,12 @@ public final class CFontManager extends SunFontManager {
|
||||
);
|
||||
|
||||
String defaultFont = "Lucida Grande";
|
||||
String defaultFallback = "Lucida Sans";
|
||||
String defaultFallback = "Lucida Grande";
|
||||
|
||||
setupLogicalFonts("Dialog", defaultFont, defaultFallback);
|
||||
setupLogicalFonts("Serif", "Times", "Lucida Bright");
|
||||
setupLogicalFonts("Serif", "Times", "Times");
|
||||
setupLogicalFonts("SansSerif", defaultFont, defaultFallback);
|
||||
setupLogicalFonts("Monospaced", "Menlo", "Lucida Sans Typewriter");
|
||||
setupLogicalFonts("Monospaced", "Menlo", "Courier");
|
||||
setupLogicalFonts("DialogInput", defaultFont, defaultFallback);
|
||||
}
|
||||
}
|
||||
|
@ -1016,8 +1016,6 @@ public abstract class FontConfiguration {
|
||||
/**
|
||||
* Returns an array of composite font descriptors for all logical font
|
||||
* faces.
|
||||
* If the font configuration file doesn't specify Lucida Sans Regular
|
||||
* or the given fallback font as component fonts, they are added here.
|
||||
*/
|
||||
public CompositeFontDescriptor[] get2DCompositeFontInfo() {
|
||||
CompositeFontDescriptor[] result =
|
||||
@ -1053,7 +1051,6 @@ public abstract class FontConfiguration {
|
||||
// other info is per style
|
||||
for (int styleIndex = 0; styleIndex < NUM_STYLES; styleIndex++) {
|
||||
int maxComponentFontCount = compFontNameIDs[fontIndex][styleIndex].length;
|
||||
boolean sawDefaultFontFile = false;
|
||||
// fall back fonts listed in the lib/fonts/fallback directory
|
||||
if (installedFallbackFontFiles != null) {
|
||||
maxComponentFontCount += installedFallbackFontFiles.length;
|
||||
@ -1074,35 +1071,12 @@ public abstract class FontConfiguration {
|
||||
needToSearchForFile(componentFileNames[index])) {
|
||||
componentFileNames[index] = getFileNameFromComponentFontName(getComponentFontName(fontNameID));
|
||||
}
|
||||
if (!sawDefaultFontFile &&
|
||||
defaultFontFile.equals(componentFileNames[index])) {
|
||||
sawDefaultFontFile = true;
|
||||
}
|
||||
/*
|
||||
System.out.println(publicFontNames[fontIndex] + "." + styleNames[styleIndex] + "."
|
||||
+ getString(table_scriptIDs[coreScripts[index]]) + "=" + componentFileNames[index]);
|
||||
*/
|
||||
}
|
||||
|
||||
//"Lucida Sans Regular" is not in the list, we add it here
|
||||
if (!sawDefaultFontFile) {
|
||||
int len = 0;
|
||||
if (installedFallbackFontFiles != null) {
|
||||
len = installedFallbackFontFiles.length;
|
||||
}
|
||||
if (index + len == maxComponentFontCount) {
|
||||
String[] newComponentFaceNames = new String[maxComponentFontCount + 1];
|
||||
System.arraycopy(componentFaceNames, 0, newComponentFaceNames, 0, index);
|
||||
componentFaceNames = newComponentFaceNames;
|
||||
String[] newComponentFileNames = new String[maxComponentFontCount + 1];
|
||||
System.arraycopy(componentFileNames, 0, newComponentFileNames, 0, index);
|
||||
componentFileNames = newComponentFileNames;
|
||||
}
|
||||
componentFaceNames[index] = defaultFontFaceName;
|
||||
componentFileNames[index] = defaultFontFile;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (installedFallbackFontFiles != null) {
|
||||
for (int ifb=0; ifb<installedFallbackFontFiles.length; ifb++) {
|
||||
componentFaceNames[index] = null;
|
||||
@ -1458,8 +1432,7 @@ public abstract class FontConfiguration {
|
||||
for (int ii = 0; ii < table_awtfontpaths.length; ii++) {
|
||||
if (table_awtfontpaths[ii] == 0) {
|
||||
String script = getString(table_scriptIDs[ii]);
|
||||
if (script.contains("lucida") ||
|
||||
script.contains("dingbats") ||
|
||||
if (script.contains("dingbats") ||
|
||||
script.contains("symbol")) {
|
||||
continue;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ abstract class CMap {
|
||||
* The primary purpose of these mappings was to facilitate
|
||||
* display of symbol chars etc in composite fonts, however
|
||||
* this is not needed as all these code points are covered
|
||||
* by Lucida Sans Regular.
|
||||
* by some other platform symbol font.
|
||||
* Commenting this out reduces the role of these two files
|
||||
* (assuming that they continue to be used in font.properties)
|
||||
* to just one of contributing to the overall composite
|
||||
|
@ -34,8 +34,7 @@ public class FontManagerNativeLibrary {
|
||||
public Object run() {
|
||||
/* REMIND do we really have to load awt here? */
|
||||
System.loadLibrary("awt");
|
||||
if (FontUtilities.isOpenJDK &&
|
||||
System.getProperty("os.name").startsWith("Windows")) {
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
/* Ideally fontmanager library should not depend on
|
||||
particular implementation of the font scaler.
|
||||
However, freetype scaler is basically small wrapper on
|
||||
|
@ -58,10 +58,6 @@ public final class FontUtilities {
|
||||
|
||||
public static boolean isWindows;
|
||||
|
||||
public static boolean isOpenJDK;
|
||||
|
||||
static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
|
||||
|
||||
private static boolean debugFonts = false;
|
||||
private static PlatformLogger logger = null;
|
||||
private static boolean logging;
|
||||
@ -110,14 +106,6 @@ public final class FontUtilities {
|
||||
useJDKScaler = false;
|
||||
}
|
||||
isWindows = osName.startsWith("Windows");
|
||||
String jreLibDirName = System.getProperty("java.home", "")
|
||||
+ File.separator + "lib";
|
||||
String jreFontDirName =
|
||||
jreLibDirName + File.separator + "fonts";
|
||||
File lucidaFile = new File(jreFontDirName + File.separator
|
||||
+ LUCIDA_FILE_NAME);
|
||||
isOpenJDK = !lucidaFile.exists();
|
||||
|
||||
String debugLevel =
|
||||
System.getProperty("sun.java2d.debugfonts");
|
||||
|
||||
|
@ -188,12 +188,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private boolean loaded1dot0Fonts = false;
|
||||
boolean loadedAllFonts = false;
|
||||
boolean loadedAllFontFiles = false;
|
||||
HashMap<String,String> jreFontMap;
|
||||
HashSet<String> jreLucidaFontFiles;
|
||||
String[] jreOtherFontFiles;
|
||||
boolean noOtherJREFontFiles = false; // initial assumption.
|
||||
|
||||
public static final String lucidaFontName = "Lucida Sans Regular";
|
||||
public static String jreLibDirName;
|
||||
public static String jreFontDirName;
|
||||
private static HashSet<String> missingFontFiles = null;
|
||||
@ -265,72 +262,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
return _usingPerAppContextComposites;
|
||||
}
|
||||
|
||||
private void initJREFontMap() {
|
||||
|
||||
/* Key is familyname+style value as an int.
|
||||
* Value is filename containing the font.
|
||||
* If no mapping exists, it means there is no font file for the style
|
||||
* If the mapping exists but the file doesn't exist in the deferred
|
||||
* list then it means its not installed.
|
||||
* This looks like a lot of code and strings but if it saves even
|
||||
* a single file being opened at JRE start-up there's a big payoff.
|
||||
* Lucida Sans is probably the only important case as the others
|
||||
* are rarely used. Consider removing the other mappings if there's
|
||||
* no evidence they are useful in practice.
|
||||
*/
|
||||
jreFontMap = new HashMap<String,String>();
|
||||
jreLucidaFontFiles = new HashSet<String>();
|
||||
if (isOpenJDK()) {
|
||||
return;
|
||||
}
|
||||
/* Lucida Sans Family */
|
||||
jreFontMap.put("lucida sans0", "LucidaSansRegular.ttf");
|
||||
jreFontMap.put("lucida sans1", "LucidaSansDemiBold.ttf");
|
||||
/* Lucida Sans full names (map Bold and DemiBold to same file) */
|
||||
jreFontMap.put("lucida sans regular0", "LucidaSansRegular.ttf");
|
||||
jreFontMap.put("lucida sans regular1", "LucidaSansDemiBold.ttf");
|
||||
jreFontMap.put("lucida sans bold1", "LucidaSansDemiBold.ttf");
|
||||
jreFontMap.put("lucida sans demibold1", "LucidaSansDemiBold.ttf");
|
||||
|
||||
/* Lucida Sans Typewriter Family */
|
||||
jreFontMap.put("lucida sans typewriter0",
|
||||
"LucidaTypewriterRegular.ttf");
|
||||
jreFontMap.put("lucida sans typewriter1", "LucidaTypewriterBold.ttf");
|
||||
/* Typewriter full names (map Bold and DemiBold to same file) */
|
||||
jreFontMap.put("lucida sans typewriter regular0",
|
||||
"LucidaTypewriter.ttf");
|
||||
jreFontMap.put("lucida sans typewriter regular1",
|
||||
"LucidaTypewriterBold.ttf");
|
||||
jreFontMap.put("lucida sans typewriter bold1",
|
||||
"LucidaTypewriterBold.ttf");
|
||||
jreFontMap.put("lucida sans typewriter demibold1",
|
||||
"LucidaTypewriterBold.ttf");
|
||||
|
||||
/* Lucida Bright Family */
|
||||
jreFontMap.put("lucida bright0", "LucidaBrightRegular.ttf");
|
||||
jreFontMap.put("lucida bright1", "LucidaBrightDemiBold.ttf");
|
||||
jreFontMap.put("lucida bright2", "LucidaBrightItalic.ttf");
|
||||
jreFontMap.put("lucida bright3", "LucidaBrightDemiItalic.ttf");
|
||||
/* Lucida Bright full names (map Bold and DemiBold to same file) */
|
||||
jreFontMap.put("lucida bright regular0", "LucidaBrightRegular.ttf");
|
||||
jreFontMap.put("lucida bright regular1", "LucidaBrightDemiBold.ttf");
|
||||
jreFontMap.put("lucida bright regular2", "LucidaBrightItalic.ttf");
|
||||
jreFontMap.put("lucida bright regular3", "LucidaBrightDemiItalic.ttf");
|
||||
jreFontMap.put("lucida bright bold1", "LucidaBrightDemiBold.ttf");
|
||||
jreFontMap.put("lucida bright bold3", "LucidaBrightDemiItalic.ttf");
|
||||
jreFontMap.put("lucida bright demibold1", "LucidaBrightDemiBold.ttf");
|
||||
jreFontMap.put("lucida bright demibold3","LucidaBrightDemiItalic.ttf");
|
||||
jreFontMap.put("lucida bright italic2", "LucidaBrightItalic.ttf");
|
||||
jreFontMap.put("lucida bright italic3", "LucidaBrightDemiItalic.ttf");
|
||||
jreFontMap.put("lucida bright bold italic3",
|
||||
"LucidaBrightDemiItalic.ttf");
|
||||
jreFontMap.put("lucida bright demibold italic3",
|
||||
"LucidaBrightDemiItalic.ttf");
|
||||
for (String ffile : jreFontMap.values()) {
|
||||
jreLucidaFontFiles.add(ffile);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
@ -354,8 +285,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreLibDirName =
|
||||
System.getProperty("java.home","") + File.separator + "lib";
|
||||
jreFontDirName = jreLibDirName + File.separator + "fonts";
|
||||
File lucidaFile =
|
||||
new File(jreFontDirName + File.separator + FontUtilities.LUCIDA_FILE_NAME);
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -381,7 +310,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
@SuppressWarnings("unchecked")
|
||||
protected SunFontManager() {
|
||||
|
||||
initJREFontMap();
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
@ -438,11 +366,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* that might be specified.
|
||||
*/
|
||||
fontConfig = createFontConfiguration();
|
||||
if (isOpenJDK()) {
|
||||
String[] fontInfo = getDefaultPlatformFont();
|
||||
defaultFontName = fontInfo[0];
|
||||
defaultFontFileName = fontInfo[1];
|
||||
}
|
||||
|
||||
String[] fontInfo = getDefaultPlatformFont();
|
||||
defaultFontName = fontInfo[0];
|
||||
defaultFontFileName = fontInfo[1];
|
||||
|
||||
String extraFontPath = fontConfig.getExtraFontPath();
|
||||
|
||||
@ -919,47 +846,20 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
return deferredFontFiles.containsKey(fileName);
|
||||
}
|
||||
|
||||
/* We keep a map of the files which contain the Lucida fonts so we
|
||||
* don't need to search for them.
|
||||
* But since we know what fonts these files contain, we can also avoid
|
||||
* opening them to look for a font name we don't recognise - see
|
||||
* findDeferredFont().
|
||||
* For typical cases where the font isn't a JRE one the overhead is
|
||||
* this method call, HashMap.get() and null reference test, then
|
||||
* a boolean test of noOtherJREFontFiles.
|
||||
*/
|
||||
public
|
||||
/*private*/ PhysicalFont findJREDeferredFont(String name, int style) {
|
||||
|
||||
PhysicalFont physicalFont;
|
||||
String nameAndStyle = name.toLowerCase(Locale.ENGLISH) + style;
|
||||
String fileName = jreFontMap.get(nameAndStyle);
|
||||
if (fileName != null) {
|
||||
fileName = jreFontDirName + File.separator + fileName;
|
||||
if (deferredFontFiles.get(fileName) != null) {
|
||||
physicalFont = initialiseDeferredFont(fileName);
|
||||
if (physicalFont != null &&
|
||||
(physicalFont.getFontName(null).equalsIgnoreCase(name) ||
|
||||
physicalFont.getFamilyName(null).equalsIgnoreCase(name))
|
||||
&& physicalFont.style == style) {
|
||||
return physicalFont;
|
||||
}
|
||||
}
|
||||
}
|
||||
PhysicalFont findJREDeferredFont(String name, int style) {
|
||||
|
||||
/* Iterate over the deferred font files looking for any in the
|
||||
* jre directory that we didn't recognise, open each of these.
|
||||
* In almost all installations this will quickly fall through
|
||||
* because only the Lucidas will be present and jreOtherFontFiles
|
||||
* will be empty.
|
||||
* because jreOtherFontFiles will be empty.
|
||||
* noOtherJREFontFiles is used so we can skip this block as soon
|
||||
* as its determined that its not needed - almost always after the
|
||||
* as its determined that it's not needed - almost always after the
|
||||
* very first time through.
|
||||
*/
|
||||
if (noOtherJREFontFiles) {
|
||||
return null;
|
||||
}
|
||||
synchronized (jreLucidaFontFiles) {
|
||||
synchronized (jreFontDirName) {
|
||||
if (jreOtherFontFiles == null) {
|
||||
HashSet<String> otherFontFiles = new HashSet<String>();
|
||||
for (String deferredFile : deferredFontFiles.keySet()) {
|
||||
@ -969,9 +869,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
/* skip names which aren't absolute, aren't in the JRE
|
||||
* directory, or are known Lucida fonts.
|
||||
*/
|
||||
if (dir == null ||
|
||||
!dir.equals(jreFontDirName) ||
|
||||
jreLucidaFontFiles.contains(fname)) {
|
||||
if (dir == null || !dir.equals(jreFontDirName)) {
|
||||
continue;
|
||||
}
|
||||
otherFontFiles.add(deferredFile);
|
||||
@ -983,12 +881,12 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
for (int i=0; i<jreOtherFontFiles.length;i++) {
|
||||
fileName = jreOtherFontFiles[i];
|
||||
String fileName = jreOtherFontFiles[i];
|
||||
if (fileName == null) {
|
||||
continue;
|
||||
}
|
||||
jreOtherFontFiles[i] = null;
|
||||
physicalFont = initialiseDeferredFont(fileName);
|
||||
PhysicalFont physicalFont = initialiseDeferredFont(fileName);
|
||||
if (physicalFont != null &&
|
||||
(physicalFont.getFontName(null).equalsIgnoreCase(name) ||
|
||||
physicalFont.getFamilyName(null).equalsIgnoreCase(name))
|
||||
@ -1001,17 +899,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* This skips JRE installed fonts. */
|
||||
private PhysicalFont findOtherDeferredFont(String name, int style) {
|
||||
for (String fileName : deferredFontFiles.keySet()) {
|
||||
File file = new File(fileName);
|
||||
String dir = file.getParent();
|
||||
String fname = file.getName();
|
||||
if (dir != null &&
|
||||
dir.equals(jreFontDirName) &&
|
||||
jreLucidaFontFiles.contains(fname)) {
|
||||
continue;
|
||||
}
|
||||
PhysicalFont physicalFont = initialiseDeferredFont(fileName);
|
||||
if (physicalFont != null &&
|
||||
(physicalFont.getFontName(null).equalsIgnoreCase(name) ||
|
||||
@ -1024,7 +913,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
private PhysicalFont findDeferredFont(String name, int style) {
|
||||
|
||||
PhysicalFont physicalFont = findJREDeferredFont(name, style);
|
||||
if (physicalFont != null) {
|
||||
return physicalFont;
|
||||
@ -1196,11 +1084,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* misconfiguration and this is probably a reasonable substitution.
|
||||
*/
|
||||
defaultPhysicalFont = (PhysicalFont)
|
||||
findFont2D("Lucida Sans Regular", Font.PLAIN, NO_FALLBACK);
|
||||
if (defaultPhysicalFont == null) {
|
||||
defaultPhysicalFont = (PhysicalFont)
|
||||
findFont2D("Arial", Font.PLAIN, NO_FALLBACK);
|
||||
}
|
||||
findFont2D(getDefaultFontFaceName(), Font.PLAIN, NO_FALLBACK);
|
||||
if (defaultPhysicalFont == null) {
|
||||
/* Because of the findFont2D call above, if we reach here, we
|
||||
* know all fonts have already been loaded, just accept any
|
||||
@ -2197,9 +2081,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
fontNameCache.put(mapName, font);
|
||||
return font;
|
||||
}
|
||||
|
||||
/* Don't want Windows to return a Lucida Sans font from
|
||||
* C:\Windows\Fonts
|
||||
/* Don't want Windows to return a font from C:\Windows\Fonts
|
||||
* if someone has installed a font with the same name
|
||||
* in the JRE.
|
||||
*/
|
||||
if (deferredFontFiles.size() > 0) {
|
||||
font = findJREDeferredFont(lowerCaseName, style);
|
||||
@ -3285,10 +3169,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
return fontPath;
|
||||
}
|
||||
|
||||
public static boolean isOpenJDK() {
|
||||
return FontUtilities.isOpenJDK;
|
||||
}
|
||||
|
||||
protected void loadFonts() {
|
||||
if (discoveredAllFonts) {
|
||||
return;
|
||||
@ -3379,24 +3259,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* or relative as needed by registerFontFile.
|
||||
*/
|
||||
public synchronized String getDefaultFontFile() {
|
||||
if (defaultFontFileName == null) {
|
||||
initDefaultFonts();
|
||||
}
|
||||
return defaultFontFileName;
|
||||
}
|
||||
|
||||
private void initDefaultFonts() {
|
||||
if (!isOpenJDK()) {
|
||||
defaultFontName = lucidaFontName;
|
||||
if (useAbsoluteFontFileNames()) {
|
||||
defaultFontFileName =
|
||||
jreFontDirName + File.separator + FontUtilities.LUCIDA_FILE_NAME;
|
||||
} else {
|
||||
defaultFontFileName = FontUtilities.LUCIDA_FILE_NAME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether registerFontFile expects absolute or relative
|
||||
* font file names.
|
||||
@ -3420,9 +3285,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* for this platform.
|
||||
*/
|
||||
public synchronized String getDefaultFontFaceName() {
|
||||
if (defaultFontName == null) {
|
||||
initDefaultFonts();
|
||||
}
|
||||
return defaultFontName;
|
||||
}
|
||||
|
||||
|
@ -73,12 +73,14 @@ public class FcFontManager extends SunFontManager {
|
||||
getFontConfigManager().initFontConfigFonts(false);
|
||||
FontConfigManager.FcCompFont[] fontConfigFonts =
|
||||
getFontConfigManager().getFontConfigFonts();
|
||||
for (int i=0; i<fontConfigFonts.length; i++) {
|
||||
if ("sans".equals(fontConfigFonts[i].fcFamily) &&
|
||||
0 == fontConfigFonts[i].style) {
|
||||
info[0] = fontConfigFonts[i].firstFont.familyName;
|
||||
info[1] = fontConfigFonts[i].firstFont.fontFile;
|
||||
break;
|
||||
if (fontConfigFonts != null) {
|
||||
for (int i=0; i<fontConfigFonts.length; i++) {
|
||||
if ("sans".equals(fontConfigFonts[i].fcFamily) &&
|
||||
0 == fontConfigFonts[i].style) {
|
||||
info[0] = fontConfigFonts[i].firstFont.familyName;
|
||||
info[1] = fontConfigFonts[i].firstFont.fontFile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Absolute last ditch attempt in the face of fontconfig problems.
|
||||
@ -86,7 +88,7 @@ public class FcFontManager extends SunFontManager {
|
||||
* up so we don't NPE.
|
||||
*/
|
||||
if (info[0] == null) {
|
||||
if (fontConfigFonts.length > 0 &&
|
||||
if (fontConfigFonts != null && fontConfigFonts.length > 0 &&
|
||||
fontConfigFonts[0].firstFont.fontFile != null) {
|
||||
info[0] = fontConfigFonts[0].firstFont.familyName;
|
||||
info[1] = fontConfigFonts[0].firstFont.fontFile;
|
||||
|
@ -126,17 +126,6 @@ public final class X11FontManager extends FcFontManager {
|
||||
*/
|
||||
private static HashSet<String> fontConfigDirs = null;
|
||||
|
||||
/* These maps are used on Linux where we reference the Lucida oblique
|
||||
* fonts in fontconfig files even though they aren't in the standard
|
||||
* font directory. This explicitly remaps the XLFDs for these to the
|
||||
* correct base font. This is needed to prevent composite fonts from
|
||||
* defaulting to the Lucida Sans which is a bad substitute for the
|
||||
* monospaced Lucida Sans Typewriter. Also these maps prevent the
|
||||
* JRE from doing wasted work at start up.
|
||||
*/
|
||||
HashMap<String, String> oblmap = null;
|
||||
|
||||
|
||||
/*
|
||||
* Used to eliminate redundant work. When a font directory is
|
||||
* registered it added to this list. Subsequent registrations for the
|
||||
@ -232,16 +221,6 @@ public final class X11FontManager extends FcFontManager {
|
||||
|
||||
if (fontID != null) {
|
||||
fileName = fontNameMap.get(fontID);
|
||||
/* On Linux check for the Lucida Oblique fonts */
|
||||
if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) {
|
||||
if (oblmap == null) {
|
||||
initObliqueLucidaFontMap();
|
||||
}
|
||||
String oblkey = getObliqueLucidaFontID(fontID);
|
||||
if (oblkey != null) {
|
||||
fileName = oblmap.get(oblkey);
|
||||
}
|
||||
}
|
||||
if (fontPath == null &&
|
||||
(fileName == null || !fileName.startsWith("/"))) {
|
||||
if (FontUtilities.debugFonts()) {
|
||||
@ -471,17 +450,6 @@ public final class X11FontManager extends FcFontManager {
|
||||
fontNameMap = new HashMap<>(1);
|
||||
}
|
||||
|
||||
private String getObliqueLucidaFontID(String fontID) {
|
||||
if (fontID.startsWith("-lucidasans-medium-i-normal") ||
|
||||
fontID.startsWith("-lucidasans-bold-i-normal") ||
|
||||
fontID.startsWith("-lucidatypewriter-medium-i-normal") ||
|
||||
fontID.startsWith("-lucidatypewriter-bold-i-normal")) {
|
||||
return fontID.substring(0, fontID.indexOf("-i-"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getX11FontName(String platName) {
|
||||
String xlfd = platName.replaceAll("%d", "*");
|
||||
if (NativeFont.fontExists(xlfd)) {
|
||||
@ -491,18 +459,6 @@ public final class X11FontManager extends FcFontManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void initObliqueLucidaFontMap() {
|
||||
oblmap = new HashMap<String, String>();
|
||||
oblmap.put("-lucidasans-medium",
|
||||
jreLibDirName+"/fonts/LucidaSansRegular.ttf");
|
||||
oblmap.put("-lucidasans-bold",
|
||||
jreLibDirName+"/fonts/LucidaSansDemiBold.ttf");
|
||||
oblmap.put("-lucidatypewriter-medium",
|
||||
jreLibDirName+"/fonts/LucidaTypewriterRegular.ttf");
|
||||
oblmap.put("-lucidatypewriter-bold",
|
||||
jreLibDirName+"/fonts/LucidaTypewriterBold.ttf");
|
||||
}
|
||||
|
||||
private boolean isHeadless() {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
@ -749,9 +705,7 @@ public final class X11FontManager extends FcFontManager {
|
||||
* For Linux we require an exact match of distro and version to
|
||||
* use the preconfigured file.
|
||||
* If synthesising fails, we fall back to any preconfigured file
|
||||
* and do the best we can. For the commercial JDK this will be
|
||||
* fine as it includes the Lucida fonts. OpenJDK should not hit
|
||||
* this as the synthesis should always work on its platforms.
|
||||
* and do the best we can.
|
||||
*/
|
||||
FontConfiguration mFontConfig = new MFontConfiguration(this);
|
||||
if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
|
||||
|
@ -283,9 +283,8 @@ public class FontConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
/* If the font may hide a JRE font (eg fontconfig says it is
|
||||
* Lucida Sans), we want to use the JRE version, so make it
|
||||
* point to the JRE font.
|
||||
/* If the font may hide a JRE font, we want to use the JRE version,
|
||||
* so make it point to the JRE font.
|
||||
*/
|
||||
physFont = fm.findJREDeferredFont(fcInfo.firstFont.familyName,
|
||||
fcInfo.style);
|
||||
|
@ -1,49 +0,0 @@
|
||||
48
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-1
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-1
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-1
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-1
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-1
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-2
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-2
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-2
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-2
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-2
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-4
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-4
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-4
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-4
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-4
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-5
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-5
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-5
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-5
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-5
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-5
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-5
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-7
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-7
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-7
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-7
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-7
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-7
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-7
|
||||
LucidaBrightRegular.ttf -b&h-lucidabright-medium-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
LucidaBrightItalic.ttf -b&h-lucidabright-medium-i-normal--0-0-0-0-p-0-iso8859-9
|
||||
LucidaBrightDemiBold.ttf -b&h-lucidabright-demibold-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
LucidaBrightDemiItalic.ttf -b&h-lucidabright-demibold-i-normal--0-0-0-0-p-0-iso8859-9
|
||||
LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9
|
||||
LucidaSansDemiBold.ttf -b&h-lucidasans-bold-r-normal-sans-0-0-0-0-p-0-iso8859-9
|
||||
LucidaTypewriterRegular.ttf -b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-iso8859-9
|
||||
LucidaTypewriterBold.ttf -b&h-lucidatypewriter-bold-r-normal-sans-0-0-0-0-m-0-iso8859-9
|
@ -46,7 +46,6 @@ public class BoldSpace {
|
||||
// in point.
|
||||
int errorMargin = 4;
|
||||
g.setFont(new Font("monospaced", Font.BOLD, 14));
|
||||
//g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14));
|
||||
FontMetrics fm = g.getFontMetrics();
|
||||
System.out.println("Bold: " + fm.charWidth('\u200b'));
|
||||
int cwid = fm.charWidth('\u200b');
|
||||
|
@ -35,6 +35,7 @@ import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.font.TextHitInfo;
|
||||
@ -51,19 +52,27 @@ public class LigatureCaretTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//testBidiWithNumbers();
|
||||
testBidiWithNumbers();
|
||||
testLamAlef();
|
||||
System.out.println("LigatureCaretTest PASSED");
|
||||
}
|
||||
|
||||
// These values are for TextLayout constructors
|
||||
private static final Hashtable map = new Hashtable();
|
||||
static {
|
||||
map.put(TextAttribute.FONT, new Font("Lucida Sans", Font.PLAIN, 24));
|
||||
}
|
||||
private static final FontRenderContext frc =
|
||||
new FontRenderContext(null, false, false);
|
||||
|
||||
private static Font getFontForText(String s) {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
Font[] fonts = ge.getAllFonts();
|
||||
|
||||
for (Font f : fonts) {
|
||||
if (f.canDisplayUpTo(s) == -1) {
|
||||
return f.deriveFont(Font.PLAIN, 24);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caret through text mixed-direction text and check the results.
|
||||
* If the test fails an Error is thrown.
|
||||
@ -72,6 +81,13 @@ public class LigatureCaretTest {
|
||||
public static void testBidiWithNumbers() {
|
||||
|
||||
String bidiWithNumbers = "abc\u05D0\u05D1\u05D2123abc";
|
||||
Font font = getFontForText(bidiWithNumbers);
|
||||
if (font == null) {
|
||||
return;
|
||||
}
|
||||
Hashtable map = new Hashtable();
|
||||
map.put(TextAttribute.FONT, font);
|
||||
|
||||
// visual order for the text:
|
||||
// abc123<gimel><bet><aleph>abc
|
||||
|
||||
@ -116,6 +132,13 @@ public class LigatureCaretTest {
|
||||
final String lamAlef = "\u0644\u0627";
|
||||
final String ltrText = "abcd";
|
||||
|
||||
Font font = getFontForText(lamAlef+ltrText);
|
||||
if (font == null) {
|
||||
return;
|
||||
}
|
||||
Hashtable map = new Hashtable();
|
||||
map.put(TextAttribute.FONT, font);
|
||||
|
||||
// Create a TextLayout with just a lam-alef sequence. There
|
||||
// should only be two valid caret positions: one at
|
||||
// insertion offset 0 and the other at insertion offset 2.
|
||||
|
@ -33,7 +33,7 @@ public class TestHebrewMark {
|
||||
|
||||
public static void main(String args[]) {
|
||||
FontRenderContext frc = new FontRenderContext(null,false,false);
|
||||
final String fonts[] = { "Arial", "Arial Hebrew", "Arial Unicode", "Lucida Sans", "Lucida Sans Regular" };
|
||||
final String fonts[] = { "Arial", "Arial Hebrew", "Arial Unicode" };
|
||||
final char ALEF = '\u05D0'; // a letter
|
||||
final char QAMATS = '\u05B8'; // a combining mark, should show up UNDER the alef (no advance)
|
||||
final String string1 = "\u05DE\u05B8\u05E9\u05C1\u05B0\u05DB\u05B5\u05E0\u05B4\u05D9\u05D0\u05B7\u05D7\u05B2\u05E8\u05B6\u05D9\u05DA\u05B8\u05E0\u05BC\u05B8\u05E8\u05D5\u05BC\u05E6\u05B8\u05D4\u05D4\u05B1\u05D1\u05B4\u05D9\u05D0\u05B7\u05E0\u05B4\u05D9\u05D4\u05B7\u05DE\u05BC\u05B6\u05DC\u05B6\u05DA\u05B0\u05D7\u05B2\u05D3\u05B8\u05E8\u05B8\u05D9\u05D5\u05E0\u05B8\u05D2\u05B4\u05D9\u05DC\u05B8\u05D4\u05D5\u05B0\u05E0\u05B4\u05E9\u05C2\u05B0\u05DE\u05B0\u05D7\u05B8\u05D4\u0020\u05D1\u05BC\u05B8\u05DA\u05B0\u05E0\u05B7\u05D6\u05B0\u05DB\u05BC\u05B4\u05D9\u05E8\u05B8\u05D4\u05D3\u05B9\u05D3\u05B6\u05D9\u05DA\u05B8\u05DE\u05B4\u05D9\u05BC\u05B7\u05D9\u05B4\u05DF\u05DE\u05B5\u05D9\u05E9\u05C1\u05B8\u05E8\u05B4\u05D9\u05DD\u05D0\u05B2\u05D4\u05B5\u05D1\u05D5\u05BC\u05DA\u05B8";
|
||||
|
@ -50,7 +50,7 @@ public class TestSinhalaChar {
|
||||
final JLabel label = new JLabel("(empty)");
|
||||
label.setSize(400, 100);
|
||||
label.setBorder(new LineBorder(Color.black));
|
||||
label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
|
||||
label.setFont(new Font(Font.DIALOG, Font.PLAIN, 12));
|
||||
if(AUTOMATIC_TEST) { /* run the test automatically (else, manually) */
|
||||
label.setText(Character.toString('\u0DDD'));
|
||||
} else {
|
||||
|
@ -90,7 +90,7 @@ public class UnderlineTest {
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
String fontName = "Lucida Sans";
|
||||
String fontName = Font.DIALOG;
|
||||
if (args.length > 0) {
|
||||
fontName = args[0];
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class PaintText extends Component implements Printable {
|
||||
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
Font f = new Font("Lucida Sans", Font.PLAIN, 40);
|
||||
Font f = new Font(Font.DIALOG, Font.PLAIN, 40);
|
||||
Color c = new Color(0,0,255,96);
|
||||
Paint p = new GradientPaint(0f, 0f, Color.green,
|
||||
10f, 10f, Color.red,
|
||||
|
@ -44,7 +44,7 @@ import java.awt.geom.*;
|
||||
import java.awt.print.*;
|
||||
|
||||
public class PrintRotatedText extends Frame implements ActionListener {
|
||||
static String fontname="Lucida Sans Regular"; // our font
|
||||
static String fontname=Font.SERIF;
|
||||
private TextCanvas c;
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
@ -44,9 +44,6 @@ import javax.print.attribute.standard.*;
|
||||
|
||||
public class PrintTextLayout implements Printable {
|
||||
static String[] fontnames = {
|
||||
"Lucida Sans",
|
||||
"Lucida Bright",
|
||||
"Lucida Sans Typewriter",
|
||||
"SansSerif",
|
||||
"Serif",
|
||||
"Monospaced",
|
||||
|
@ -97,14 +97,14 @@ public class PrintTextTest extends Component implements Printable {
|
||||
book.append(ptt, portrait);
|
||||
book.append(ptt, landscape);
|
||||
|
||||
font = new Font("Lucida Sans", Font.PLAIN, 18);
|
||||
font = getPhysicalFont();
|
||||
name = "Page " + new Integer(page++);
|
||||
ptt = new PrintTextTest(name, font, null, false);
|
||||
p.add(name, ptt);
|
||||
book.append(ptt, portrait);
|
||||
book.append(ptt, landscape);
|
||||
|
||||
font = new Font("Lucida Sans", Font.PLAIN, 18);
|
||||
font = getPhysicalFont();
|
||||
AffineTransform rotTx = AffineTransform.getRotateInstance(0.15);
|
||||
rotTx.translate(60,0);
|
||||
name = "Page " + new Integer(page++);
|
||||
@ -209,6 +209,36 @@ public class PrintTextTest extends Component implements Printable {
|
||||
}
|
||||
}
|
||||
|
||||
// The test needs a physical font that supports Latin.
|
||||
private static Font physicalFont;
|
||||
private static Font getPhysicalFont() {
|
||||
if (physicalFont != null) {
|
||||
return physicalFont;
|
||||
}
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
String[] names = ge.getAvailableFontFamilyNames();
|
||||
|
||||
for (String n : names) {
|
||||
switch (n.toLowerCase()) {
|
||||
case "dialog":
|
||||
case "dialoginput":
|
||||
case "serif":
|
||||
case "sansserif":
|
||||
case "monospaced":
|
||||
break;
|
||||
default:
|
||||
Font f = new Font(n, Font.PLAIN, 18);
|
||||
if (f.canDisplayUpTo("AZaz09") == -1) {
|
||||
physicalFont = f;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
physicalFont = new Font(Font.DIALOG, Font.PLAIN, 18);
|
||||
return physicalFont;
|
||||
}
|
||||
|
||||
public PrintTextTest(String page, Font font, AffineTransform gxTx,
|
||||
boolean fm) {
|
||||
this.page = page;
|
||||
|
Loading…
x
Reference in New Issue
Block a user