0

There are some answers like this which explain how to use PrivateFontCollection to get the name of font file, but that name is not complete. Each TTF file usually presents one style for that font, and complete name of the ttf file, contains the style name. Windows Font Viewer shows this complete name on its title bar. I want to get this complete name.

For example;

"Lts-B.ttf"  // Name of font file
"Lotus"      // Name of FontFamily (Which is provided by PrivateFontCollection method)
"Lotus Bold" // Complete name

I want last one.

Community
  • 1
  • 1
h.nodehi
  • 1,036
  • 1
  • 17
  • 32
  • 1
    I assume the font is not installed on the system yet. If so, take a look at this article which describes how to fetch those information right from the "names" table within the TTF file. https://www.codeproject.com/articles/2293/retrieving-font-name-from-ttf-file You may also take a look at GetOutlineTextMetrics Win32 API https://msdn.microsoft.com/en-us/library/windows/desktop/dd144906(v=vs.85).aspx which returns an OUTLINETEXTMETRIC structure that contains those information. – Joe Bank Nov 26 '16 at 07:54
  • @JoeBank, thanks. That article really helped, exactly what I was looking for. Except some issues in that code; like considering font name encoding, language id and name id, which I fixed them in my code. – h.nodehi Nov 26 '16 at 21:58

0 Answers0