private void FillFontDesc(PdfDictionary fontDesc)
{
if (fontDesc == null)
return;
PdfNumber v = fontDesc.GetAsNumber(PdfName.ASCENT);
if (v != null)
Ascender = v.FloatValue;
v = fontDesc.GetAsNumber(PdfName.CAPHEIGHT);
if (v != null)
CapHeight = v.FloatValue;
v = fontDesc.GetAsNumber(PdfName.DESCENT);
if (v != null)
Descender = v.FloatValue;
v = fontDesc.GetAsNumber(PdfName.ITALICANGLE);
if (v != null)
ItalicAngle = v.FloatValue;
v = fontDesc.GetAsNumber(PdfName.FONTWEIGHT);
if (v != null) {
fontWeight = v.FloatValue;
}
PdfArray bbox = fontDesc.GetAsArray(PdfName.FONTBBOX);
if (bbox != null) {
llx = bbox.GetAsNumber(0).FloatValue;
lly = bbox.GetAsNumber(1).FloatValue;
urx = bbox.GetAsNumber(2).FloatValue;
ury = bbox.GetAsNumber(3).FloatValue;
if (llx > urx) {
float t = llx;
llx = urx;
urx = t;
}
if (lly > ury) {
float t = lly;
lly = ury;
ury = t;
}
}
float maxAscent = Math.Max(ury, Ascender);
float minDescent = Math.Min(lly, Descender);
Ascender = maxAscent * 1000 / (maxAscent - minDescent);
Descender = minDescent * 1000 / (maxAscent - minDescent);
}