We use a third-party PDF Generator library which requires that you specify the TrueType or Type1 file name when using a font other than the 14 or so that are part of the default PDF standard.
So if I want to use Bitstream Arrus Bold I have to know to reference arrusb.ttf.
Short of enumerating all of the files in the font folder and creating a disposable PrivateFontCollection to extract the relationships, is there a way to obtain the underlying font name from font information, i.e. given Courier New, Bold, Italic derive CourBI.ttf?
I’ve already looked at the InstalledFontCollection and there’s nothing.
If you don’t mind poking around in the registry, take a look at
It has pairs like
You can do this the necessary queries like this:
A call to
GetFontFile('Arial (TrueType)')returns'arial.ttf'You could of course modify the code to append the
(TrueType)portion to thefontName, or to look through everything returned byfontsKey.GetValueNames()to find the best match.