locked
Font metrics

    Question

  • From C++ is there a way to get font metrics?  Things like ascent, descent, lineHeight, etc.

    I want to be able to do something like GetFont( <name of font>, <size of font> ) and from that, get the metrics about it.

    Regards, Guy


    • Edited by gnichola Friday, June 29, 2012 6:44 PM
    Thursday, June 28, 2012 11:42 PM

All replies

  • Hello,

    As far as I know, the FontFamily class does not have such function.

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.fontfamily

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Monday, July 09, 2012 4:56 AM
    • Unmarked as answer by Jesse Jiang Tuesday, July 10, 2012 11:12 AM
    Monday, July 02, 2012 10:48 AM
  • Really?  I need the font metrics to do item sizing and layout.  For example, if I have a pair of custom UI items and each contains text and I want to line them up based on their text baseline, I would typically grab font metrics and use information from there for my calculations.  Is there some other recommended way for me to do this? 

    Regards, Guy


    • Edited by gnichola Tuesday, July 10, 2012 3:04 PM
    Monday, July 09, 2012 3:38 PM