How do I find if the font is bold or italic (also font weight and italic angle)?

Q:

How do I find if the font is bold or italic (also font weight and
italic angle)?

Also, why does the font.IsItalic member function of Font return false
for the Arial Italic font?
-----

A:

Font flags are usually wrong and most PDF software ignores these
flags. The problem is often in the input font file itself. In any case
we will take a look at why is CreateCIDTrueTypeFont not setting italic
flag to true.

A better approach to find whether the font is italic is by looking up
the ItalicAngle property in the FontDescriptor.

// Returns the angle, expressed in degrees counterclockwise from
// the vertical, of the dominant vertical strokes of the font.
// (For example, the 9-o'clock position is 90 degrees, and the
// 3-o'clock position is -90 degrees.) The value is negative for
// fonts that slope to the right, as almost all italic fonts do.
double GetFontItalic(pdftron.PDF.Font font)
{
double italic_angle = 0;
Obj font_desc = font.GetDescriptor();
if (font_desc != null) {
  Obj angle = font_desc.FindObj("ItalicAngle");
  if (angle != null) {
    italic_angle = angle.GetNumber();
  }
}
return italic_angle;
}

Similarly you can obtain font 'weight' (in the range 300-900) where
each number indicates a weight that is at least as dark as its
predecessor. A value of 400 indicates a normal weight; 700 indicates
bold.

double GetFontWeight(pdftron.PDF.Font font)
{
double italic_angle = 0;
Obj font_desc = font.GetDescriptor();
if (font_desc != null) {
  Obj angle = font_desc.FindObj("FontWeight");
  if (angle != null) {
    italic_angle = angle.GetNumber();
  }
}
return italic_angle;
}