本文整理汇总了Java中org.apache.harmony.awt.gl.font.FontProperty类的典型用法代码示例。如果您正苦于以下问题:Java FontProperty类的具体用法?Java FontProperty怎么用?Java FontProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FontProperty类属于org.apache.harmony.awt.gl.font包,在下文中一共展示了FontProperty类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CompositeFont
import org.apache.harmony.awt.gl.font.FontProperty; //导入依赖的package包/类
/**
* Creates CompositeFont object that is corresponding to the specified logical
* family name.
*
* @param familyName logical family name CompositeFont is to be created from
* @param faceName logical face name CompositeFont is to be created from
* @param _style style of the CompositeFont to be created
* @param _size size of the CompositeFont to be created
* @param fProperties an array of FontProperties describing physical fonts -
* parts of logical font
* @param physFonts an array of physical font peers related to the CompositeFont
* to be created
*/
public CompositeFont(String familyName, String faceName, int _style, int _size, FontProperty[] fProperties, FontPeerImpl[] physFonts){
this.size = _size;
this.name = faceName;
this.family = familyName;
this.style = _style;
this.face = faceName;
this.psName = faceName;
this.fontProperties = fProperties;// !! Supposed that fProperties parameter != null
fPhysicalFonts = physFonts;
numFonts = fPhysicalFonts.length;
setDefaultLineMetrics("", null); //$NON-NLS-1$
this.uniformLM = false;
}
示例2: initFontProperties
import org.apache.harmony.awt.gl.font.FontProperty; //导入依赖的package包/类
/**
* Initializes fProperties array field for the current system configuration font
* property file.
*
* RuntimeException is thrown if font property contains incorrect format of
* xlfd string.
*
* @return true is success, false if font property doesn't exist or doesn't
* contain roperties.
*/
public boolean initFontProperties(){
File fpFile = getFontPropertyFile();
if (fpFile == null){
return false;
}
Properties props = getProperties(fpFile);
if (props == null){
return false;
}
for (int i=0; i < LOGICAL_FONT_NAMES.length; i++){
String lName = LOGICAL_FONT_NAMES[i];
for (int j=0; j < STYLE_NAMES.length; j++){
String styleName = STYLE_NAMES[j];
Vector propsVector = new Vector();
// Number of entries for a logical font
int numComp = 0;
// Is more entries for this style and logical font name left
boolean moreEntries = true;
String value = null;
while(moreEntries){
// Component Font Mappings property name
String property = FONT_MAPPING_KEYS[0].replaceAll("LogicalFontName", lName).replaceAll("StyleName", styleName).replaceAll("ComponentIndex", String.valueOf(numComp)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
value = props.getProperty(property);
// If the StyleName is omitted, it's assumed to be plain
if ((j == 0) && (value == null)){
property = FONT_MAPPING_KEYS[1].replaceAll("LogicalFontName", lName).replaceAll("ComponentIndex", String.valueOf(numComp)); //$NON-NLS-1$ //$NON-NLS-2$
value = props.getProperty(property);
}
if (value != null){
String[] fields = parseXLFD(value);
if (fields == null){
// awt.08=xfld parse string error: {0}
throw new RuntimeException(Messages.getString("awt.08", value)); //$NON-NLS-1$
}
String fontName = fields[1];
String weight = fields[2];
String italic = fields[3];
int style = getBoldStyle(weight) | getItalicStyle(italic);
// Component Font Character Encodings property value
String encoding = props.getProperty(FONT_CHARACTER_ENCODING.replaceAll("LogicalFontName", lName).replaceAll("ComponentIndex", String.valueOf(numComp))); //$NON-NLS-1$ //$NON-NLS-2$
// Exclusion Ranges property value
String exclString = props.getProperty(EXCLUSION_RANGES.replaceAll("LogicalFontName", lName).replaceAll("ComponentIndex", String.valueOf(numComp))); //$NON-NLS-1$ //$NON-NLS-2$
int[] exclRange = parseIntervals(exclString);
FontProperty fp = new LinuxFontProperty(lName, styleName, null, fontName, value, style, exclRange, encoding);
propsVector.add(fp);
numComp++;
} else {
moreEntries = false;
}
}
fProperties.put(LOGICAL_FONT_NAMES[i] + "." + j, propsVector); //$NON-NLS-1$
}
}
return true;
}
示例3: initFontProperties
import org.apache.harmony.awt.gl.font.FontProperty; //导入依赖的package包/类
/**
* Initializes fProperties array field for the current system configuration font
* property file.
*
* @return true is success, false if font property doesn't exist or doesn't
* contain properties.
*/
public boolean initFontProperties(){
File fpFile = getFontPropertyFile();
if (fpFile == null){
return false;
}
Properties props = getProperties(fpFile);
if (props == null){
return false;
}
for (String element : LOGICAL_FONT_NAMES) {
for (int j=0; j < STYLE_NAMES.length; j++){
Vector<FontProperty> propsVector = new Vector<FontProperty>();
// Number of entries for a logical font
int numComp = 0;
// Is more entries for this style and logical font name left
boolean moreEntries = true;
String value = null;
while(moreEntries){
// Component Font Mappings property name
String property = FONT_MAPPING_KEYS[0].replaceAll("LogicalFontName", element).replaceAll("StyleName", STYLE_NAMES[j]).replaceAll("ComponentIndex", String.valueOf(numComp)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
value = props.getProperty(property);
// If the StyleName is omitted, it's assumed to be plain
if ((j == 0) && (value == null)){
property = FONT_MAPPING_KEYS[1].replaceAll("LogicalFontName", element).replaceAll("ComponentIndex", String.valueOf(numComp)); //$NON-NLS-1$ //$NON-NLS-2$
value = props.getProperty(property);
}
if (value != null){
String fontName = value.substring(0, value.indexOf(",")); //$NON-NLS-1$
int ind = fontName.lastIndexOf("Bold"); //$NON-NLS-1$
if (ind != -1){
fontName = fontName.substring(0, ind-1);
} else {
ind = fontName.lastIndexOf("Italic"); //$NON-NLS-1$
if(ind != -1){
fontName = fontName.substring(0, ind-1);
}
}
String charset = value.substring(value.indexOf(",") + 1, value.length()); //$NON-NLS-1$
// Font File Names property value
String fileName = props.getProperty(FONT_FILE_NAME.replaceAll("PlatformFontName", fontName).replaceAll(" ", "_")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// Exclusion Ranges property value
String exclString = props.getProperty(EXCLUSION_RANGES.replaceAll("LogicalFontName", element).replaceAll("ComponentIndex", String.valueOf(numComp))); //$NON-NLS-1$ //$NON-NLS-2$
int[] exclRange = parseIntervals(exclString);
// Component Font Character Encodings property value
String encoding = props.getProperty(FONT_CHARACTER_ENCODING.replaceAll("LogicalFontName", element).replaceAll("ComponentIndex", String.valueOf(numComp))); //$NON-NLS-1$ //$NON-NLS-2$
FontProperty fp = new WinFontProperty(fileName, fontName, charset, j, exclRange, encoding);
propsVector.add(fp);
numComp++;
} else {
moreEntries = false;
}
}
fProperties.put(element + "." + j, propsVector); //$NON-NLS-1$
}
}
return true;
}