{flags |= FlagsEnum.Symbolic.getCode();}
else
{flags |= FlagsEnum.Nonsymbolic.getCode();}
fontDescriptor.put(
PdfName.Flags,
new PdfInteger(flags)
);
// FontBBox.
fontDescriptor.put(
PdfName.FontBBox,
new Rectangle(
new Point2D.Double(metrics.xMin * metrics.unitNorm, metrics.yMin * metrics.unitNorm),
new Point2D.Double(metrics.xMax * metrics.unitNorm, metrics.yMax * metrics.unitNorm)
).getBaseDataObject()
);
// ItalicAngle.
fontDescriptor.put(
PdfName.ItalicAngle,
new PdfReal(metrics.italicAngle)
);
// Ascent.
fontDescriptor.put(
PdfName.Ascent,
new PdfReal(
metrics.ascender == 0
? metrics.sTypoAscender * metrics.unitNorm
: metrics.ascender * metrics.unitNorm
)
);
// Descent.
fontDescriptor.put(
PdfName.Descent,
new PdfReal(
metrics.descender == 0
? metrics.sTypoDescender * metrics.unitNorm
: metrics.descender * metrics.unitNorm
)
);
// Leading.
fontDescriptor.put(
PdfName.Leading,
new PdfReal(metrics.sTypoLineGap * metrics.unitNorm)
);
// CapHeight.
fontDescriptor.put(
PdfName.CapHeight,
new PdfReal(metrics.sCapHeight * metrics.unitNorm)
);
// StemV.
/*
NOTE: '100' is just a rule-of-thumb value, 'cause I've still to solve the
'cvt' table puzzle (such a harsh headache!) for TrueType fonts...
TODO:IMPL TrueType and CFF stemv real value to extract!!!
*/
fontDescriptor.put(
PdfName.StemV,
new PdfInteger(100)
);
// FontFile.
//TODO:IMPL distinguish between truetype (FontDescriptor.FontFile2) and opentype (FontDescriptor.FontFile3 and FontStream.subtype=OpenType)!!!
PdfReference fontFileReference = getFile().register(
new PdfStream(