}
public FontMetrics createMetrics(final FontIdentifier identifier,
final FontContext context)
{
final CompoundFontIdentifier compoundFontIdentifier;
final FontIdentifier record;
if (identifier instanceof CompoundFontIdentifier)
{
compoundFontIdentifier = (CompoundFontIdentifier) identifier;
record = compoundFontIdentifier.getIdentifier();
}
else
{
record = identifier;
compoundFontIdentifier = null;
}
final String fontName;
final boolean bold;
final boolean italic;
if (record instanceof FontRecord)
{
final FontRecord fontRecord = (FontRecord) record;
fontName = fontRecord.getFamily().getFamilyName();
if (compoundFontIdentifier != null)
{
bold = compoundFontIdentifier.isBoldSpecified();
italic = compoundFontIdentifier.isItalicsSpecified();
}
else
{
bold = fontRecord.isBold();
italic = fontRecord.isItalic();
}
}
else if (record instanceof TrueTypeFontIdentifier)
{
final TrueTypeFontIdentifier ttfFontRecord = (TrueTypeFontIdentifier) record;
fontName = ttfFontRecord.getFontName();
if (compoundFontIdentifier != null)
{
bold = compoundFontIdentifier.isBoldSpecified();
italic = compoundFontIdentifier.isItalicsSpecified();
}
else
{
bold = false;
italic = false;