Prev Previous Post   Next Post Next
Old 5th May 2010, 08:02   #1
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
Get locale font name of a TTF file

I have tried the FontName plugin, but the name it got is not what I want. It got the English name of the font. If I copy a ttf file to the Fonts folder, first I will see the Chinese name of the font in Fonts of Control Pannel, and also in the registry key "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" I can find that the Chinese name, such as "微软雅黑 (TrueType)", of the font. But when using the FontName plugin I will only got the name "Microsoft Yahei".

If I inst the ttf file to fonts directory, I just need to copy the ttf file to there and using:
PHP Code:
SetOutPath $FONTS
File MSYH
.TTF
System
::Call "GDI32::AddFontResource(t) i ('MSYH.TTF') .s" 
It is a easy way and the value in registry is correct. But if I want to inst it to my directory, I must use:
PHP Code:
SetOutPath $INSTDIR\TrueType
File MSYH
.TTF
WriteRegStr HKLM 
"Software\Microsoft\Windows NT\CurrentVersion\Fonts" "微软雅黑 (TrueType)" "$INSTDIR\TrueType\MSYH.TTF"
System::Call "GDI32::AddFontResource(t) i ('$INSTDIR\TrueType\MSYH.TTF') .s" 
When there are a large number of fonts to install to custom directory, I must write each font name to registry but not using the FontName plugin, as the reason above. After searching by google, I founder that a function GetTextFaceA. But I don't know how to use it to get the name of a font. Please help me.

Last edited by jiake; 5th May 2010 at 09:43.
jiake is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump