Map/*<FontTriplet>*/ triplets = (Map/*<FontTriplet>*/)fontInfo.getFontTriplets();
if (triplets != null) {
Set/*<FontTriplet>*/ tripletSet = triplets.keySet();
for (Iterator/*<FontTriplet>*/ tripletIt = tripletSet.iterator();
tripletIt.hasNext();) {
FontTriplet triplet = (FontTriplet)tripletIt.next();
String fontName = triplet.getName();
// matched font family name
if (fontFamilyString.toLowerCase().equals(fontName.toLowerCase())) {
// try and match font weight
boolean weightMatched = false;
int fontWeight = triplet.getWeight();
for (Iterator weightIt = weightValue.iterator(); weightIt.hasNext();) {
Object weightObj = weightIt.next();
if (weightObj instanceof FontWeightRange) {
FontWeightRange intRange = (FontWeightRange)weightObj;
if (intRange.isWithinRange(fontWeight)) {
weightMatched = true;
}
} else if (weightObj instanceof String) {
String fontWeightString = (String)weightObj;
int fontWeightValue = FontUtil.parseCSS2FontWeight(
fontWeightString);
if (fontWeightValue == fontWeight) {
weightMatched = true;
}
} else if (weightObj instanceof Integer) {
Integer fontWeightInteger = (Integer)weightObj;
int fontWeightValue = fontWeightInteger.intValue();
if (fontWeightValue == fontWeight) {
weightMatched = true;
}
}
}
// try and match font style
boolean styleMatched = false;
String fontStyleString = triplet.getStyle();
for (Iterator styleIt = styleValue.iterator(); styleIt.hasNext();) {
String style = (String)styleIt.next();
if (fontStyleString.equals(style)) {
styleMatched = true;
}