I would like to get the font filename (*.ttf) from the font name.
Example: Times New Roman→times.ttf
(The font name here is the name that can be obtained by the LOGFONT structure lfFaceName.)
in the registry, referring to the following: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts
You are attempting to browse to the .
Generally speaking, English fonts match lfFaceName with the font name in the registry, but for Japanese fonts, lfFaceName is in Japanese (for example, Mario) and the font name used in the registry is in English (for example, Meiryo).
In order to resolve the issue, I would appreciate it if you could tell me how to obtain the English font name from the Japanese font name that lfFaceName can provide.
The original purpose is not to obtain an English font name, but to obtain a font file name (*.ttf), so if you can achieve it in a completely different way, please let me know how to do it.c++ windows font
I don't know how to get a file name, so I'll answer how to get an English name.
GDI+'s FontFamily.GetFamilyName allows you to obtain names in other languages.There is a provisional argument for specifying the language ID, so if it is in English, you can pass
Running this program produces the output
However, there is also one problem with this method.Even if you specify
L "Microsoft YaHei" (Microsoft YaHei Simplified Chinese), it will not become Microsoft YaHei.In that way, it doesn't seem to work outside of the language you are using.I didn't know how to get around here.
© 2022 OneMinuteCode. All rights reserved.