0

Driving me nuts, nothing works.

  • SharpFont can't do it.
  • PrivateFontCollection can't do it (only retrieves family name, plus has a bug that requires p/invoke to correct).
  • System.Windows.Media.Fonts can't do it (only retrieves family name).
  • GlyphTypeface can kinda do it (retrieves FamilyName and FaceName separately), but often throws a null reference exception from the constructor and seems to exhibit the same file-lock-left-open bug that PrivateFontCollection does, so it's an extra special kind of useless.

With two longstanding .net framework bugs in a single issue, this basic property of a font file seems far too difficult to retrieve.

Community
  • 1
  • 1
Triynko
  • 18,766
  • 21
  • 107
  • 173
  • What is a "font title"? There are a [whole bunch of strings associated with fonts defined in the spec](https://www.microsoft.com/typography/otspec/name.htm) (see the "Name IDs" section), but none of them are "font title", so I'm not sure I understand what string identifier(s) you're trying to access. – Mike 'Pomax' Kamermans Dec 20 '15 at 18:35
  • I'm the author of SharpFont, which is a pretty thin wrapper around FreeType. I'm also a bit confused with what a "font title" is but besides family name, there are a handful of special "name" functions in SharpFont.Face. like `GetPostscriptName()` Have you looked at those? https://github.com/Robmaister/SharpFont/blob/master/Source/SharpFont/Face.cs#L1215 – Robert Rouhani Jan 04 '16 at 10:00
  • If you do run into any issues, feel free to open an issue on Github. Creating a Face is pretty easy, though it's a little obscured in the Example project right now. Essentially: `var lib = new Library(); var face = new Face(lib, "path/to/font.ttf"); string title = face.GetPostscriptName();` – Robert Rouhani Jan 04 '16 at 10:02

0 Answers0