下面列出了怎么用sun.awt.CharsetString的API类实例代码及写法,或者点击链接到github查看源代码。
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
.getFontPeer(font);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
.getFontPeer(font);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
int[] psFont = null;
if (mFontProps != null) {
psFont = new int[charSet.length];
}
for (int i = 0; i < charSet.length && psFont != null; i++){
/* Get the encoding of the run of text.
*/
CharsetString cs = charSet[i];
CharsetEncoder fontCS = cs.fontDescriptor.encoder;
String charsetName = cs.fontDescriptor.getFontCharsetName();
/*
* sun.awt.Symbol perhaps should return "symbol" for encoding.
* Similarly X11Dingbats should return "dingbats"
* Forced to check for win32 & x/unix names for these converters.
*/
if ("Symbol".equals(charsetName)) {
charsetName = "symbol";
} else if ("WingDings".equals(charsetName) ||
"X11Dingbats".equals(charsetName)) {
charsetName = "dingbats";
} else {
charsetName = makeCharsetName(charsetName, cs.charsetChars);
}
int styleMask = font.getStyle() |
FontUtilities.getFont2D(font).getStyle();
String style = FontConfiguration.getStyleString(styleMask);
/* First we map the font name through the properties file.
* This mapping provides alias names for fonts, for example,
* "timesroman" is mapped to "serif".
*/
String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
fontName = fontName.replace(' ', '_');
String name = mFontProps.getProperty(fontName, "");
/* Now map the alias name, character set name, and style
* to a PostScript name.
*/
String psName =
mFontProps.getProperty(name + "." + charsetName + "." + style,
null);
if (psName != null) {
/* Get the PostScript font index for the PostScript font.
*/
try {
psFont[i] =
Integer.parseInt(mFontProps.getProperty(psName));
/* If there is no PostScript font for this font name,
* then we want to termintate the loop and the method
* indicating our failure. Setting the array to null
* is used to indicate these failures.
*/
} catch(NumberFormatException e){
psFont = null;
}
/* There was no PostScript name for the font, character set,
* and style so give up.
*/
} else {
psFont = null;
}
}
return psFont;
}