locked
Can I access system font file (TTF) ?

    Question

  • Can I read the font file in system font directory "\Windows\Fonts" ?

    Or any system built-in True Type Font file can be access in metro?


    C++ DX11

    Tuesday, May 8, 2012 1:13 PM

Answers

  • Your Metro style app won't be able to access the font files themselves. %windows%\fonts is not available to Metro style apps.

    The app can use any font on the system through DirectWrite or Xaml.

    See How to Enumerate Fonts for information on how to enumerate the fonts with DirectWrite.  This isn't a Metro style sample, but the enumeration code itself should be essentially the same.

    --Rob

    Thursday, May 10, 2012 9:13 PM
    Owner

All replies

  •  

    Hello,

     

    Did you want to enumerating the installed fonts in metro app?

     

    If so, you can try the IDWriteFontCollection interface, Please follow the sample codes in this document.

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd368214.aspx

     

    Best regards,

    Jesse


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


    Wednesday, May 9, 2012 7:23 AM
  • I'm trying to use FreeType library to load TTF font, that will need to pack many huge TTF files with it.

    If metro apps can access system installed font files, that will be great.


    C++ DX11

    Wednesday, May 9, 2012 8:44 AM
  •  

    But some font APIs can not be used in Metro, like

    AddFontResource ,EnumFonts and CreateFont function

     

    Best regards,

    Jesse


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

    Thursday, May 10, 2012 11:39 AM
  • OK. It's only my suggestion. If WinRT can provide an interface to enum and read font files, FreeType can parse the TTF files and draw text without any win32 API. It's cross-platform and used by many UI and game engines.



    • Edited by Raptor K Thursday, May 10, 2012 4:22 PM
    Thursday, May 10, 2012 4:16 PM
  • Your Metro style app won't be able to access the font files themselves. %windows%\fonts is not available to Metro style apps.

    The app can use any font on the system through DirectWrite or Xaml.

    See How to Enumerate Fonts for information on how to enumerate the fonts with DirectWrite.  This isn't a Metro style sample, but the enumeration code itself should be essentially the same.

    --Rob

    Thursday, May 10, 2012 9:13 PM
    Owner