tags:

views:

19

answers:

1

What API call is there to get the current front size and style of text? for example, If selected font is DEFAULT_GUI_FONT how would you know its size and style (Bold, Italic etc.)?

+1  A: 

Use GetTextMetrics to get this for selected font

typedef struct tagTEXTMETRIC {
  LONG  tmHeight;
  LONG  tmAscent;
  LONG  tmDescent;
  LONG  tmInternalLeading;
  LONG  tmExternalLeading;
  LONG  tmAveCharWidth;
  LONG  tmMaxCharWidth;
  LONG  tmWeight;
  LONG  tmOverhang;
  LONG  tmDigitizedAspectX;
  LONG  tmDigitizedAspectY;
  TCHAR tmFirstChar;
  TCHAR tmLastChar;
  TCHAR tmDefaultChar;
  TCHAR tmBreakChar;
  BYTE  tmItalic;
  BYTE  tmUnderlined;
  BYTE  tmStruckOut;
  BYTE  tmPitchAndFamily;
  BYTE  tmCharSet;
} TEXTMETRIC, *PTEXTMETRIC;

Italic is a boolean byte value tmItalic. Boldness is tmWeight with values of about 700 or more usually being thought of as "Bold".

John Knoeller