How to obtain the font styles for text?

Q: Is it possible to determine the font styles for text such as
'underlined', 'strikethrough', allcaps, double-strikethrough, bold,
italic, etc?
----

A:
Unfortunately PDF format doesn't include the font styles such as
'underlined', 'strikethrough', etc. These styles are simulated by
drawing lines (i.e. path objects) on top of text. For bold and italics
you could sometimes rely on ItalicAngle and Weight parameters in
FontDictionary, but in some cases this information is not correct.

To check is the font is italic you could use font.IsItalic().

You can also obtain other properties from font descriptor dictionary
(see section 5.7 'Font Descriptors' in PDF Reference Manual).

For example,

// In C#
Obj fd = font.GetFontDescriptor();
if (fd == null) return; // If null, the font is not ebedded

double italic_angle = 0, weight=400;
DictIterator itr = fd.Find("ItalicAngle"); if (itr != fd.DictEnd()) {
   italic_angle = itr.Value().GetNumber(); }

itr = fd.Find("FontWeight");
if (itr != fd.DictEnd()) {
   // A value of 400 indicates a normal weight; 700 indicates bold.
   weight = itr.Value().GetNumber();
}

If the font is embedded you could extract the embedded font and check
the font metric table. You can also extract glyph outlines for every
character using font.GetGlyphPaths(...).