Archive: Postscript Font Installer


Postscript Font Installer
I am experiencing difficulty developing an installer for post script fonts (e.g .pfm font) for XP/2000.
I have researched extensively online and the NSIS site, but only found reference to TTF and FON font installaters.

Any tips or guidance would be greatly appreciated.
THANK you in advance!


The documentation for AddFontResource says it supports .pfm files. All of the functions available for TTF should work, except that you probably won't be able to get the font name automatically using the FontName plug-in.


Thank you very much for the instructions. I worked with the website you provided, but was not successful with installing the Type 1 font file.

I tried to use the AddFontResource function based on examples I found, but it does not add the file to the Fonts directory as expected.

Here is my code, in case you have a chance to take a look and advise on errors I made:
--------------------------------
Section "Fonts"
SetOutPath "$INSTDIR"
File "$INSTDIR\MyFont.pfm"
File "$INSTDIR\MyFont.pfb"

CheckWinVer:
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
IfErrors WIN-x WIN-NT

WIN-NT:
StrCpy $R1 "Software\Microsoft\Windows NT\CurrentVersion\Fonts"
goto Reg-Add

WIN-x:
StrCpy $R1 "Software\Microsoft\Windows\CurrentVersion\Fonts"
goto Reg-Add

Reg-Add:
ClearErrors
ReadRegStr $R0 HKLM "$R1" "MyFont"
IfErrors 0 End
System::Call "GDI32::AddFontResourceA(t) i ('MyFont.pfm|MyFont.pfb') .s"
WriteRegStr HKLM "$R1" "My Font" "MyFont.pfm"

End:
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
--------------------------------------------


Have you tried extracting the fonts to the $FONTS directory instead of $INSTDIR? You pass a relative path, but install it to somewhere AddFontResource might not expect to find the fonts.


That worked. Thank you so much!!!


you can read the fontname from the .afm file, that many type1 fonts come with. same goes for type1 fonts in ascii format (.pfa) rather than binaries (.pfb).

according to this website, type1 installation require adobe type manager on windows version priorto windows 2000.

also type1 fonts are registered under a different keyname:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer