Install PostScript Fonts: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
== Function == | == Function == | ||
<highlight-nsis>!macro InstallPostScript | <highlight-nsis>!macro InstallPostScript FontPath FontName FontBase | ||
Push $0 | Push $0 | ||
Push $R0 | Push $R0 | ||
Line 16: | Line 16: | ||
SetOutPath $FONTS | SetOutPath $FONTS | ||
IfFileExists "$FONTS\${FontBase}.pfm" ${Index} | IfFileExists "$FONTS\${FontBase}.pfm" ${Index} | ||
CopyFiles '${ | CopyFiles '${FontPath }' "$FONTS" #\${FontBase}.pfm" | ||
${Index}: | ${Index}: | ||
Line 52: | Line 52: | ||
[http://www.ctan.org/tex-archive/fonts/utilities/t1tools/ t1tools] is a collection of programs and batch files useful for | [http://www.ctan.org/tex-archive/fonts/utilities/t1tools/ t1tools] is a collection of programs and batch files useful for | ||
handling type 1 fonts on MSDOS and Unix systems. | handling type 1 fonts on MSDOS and Unix systems. | ||
[http://en.wikipedia.org/wiki/PostScript_fonts PostScript fonts] at Wikipedia |
Revision as of 20:21, 24 July 2008
Note
This script is based on the Advanced Font Installation script, which only works TrueType and bitmapped fonts. It's still a very early version, which requires two steps to install a font. Within the next days, I plan to merge those two functions.
Description
These function can be used to determine the name of a PostScript/Type 1 font and install it properly. The name-detection is maybe a bit clumsy, as it depends on the availability of an .inf file coming along the font.
Function
!macro InstallPostScript FontPath FontName FontBase Push $0 Push $R0 Push $R1 Push $R2 !define Index 'Line${__LINE__}' SetOutPath $FONTS IfFileExists "$FONTS\${FontBase}.pfm" ${Index} CopyFiles '${FontPath }' "$FONTS" #\${FontBase}.pfm" ${Index}: ClearErrors ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion" IfErrors "${Index}-Error" "${Index}-GO" "${Index}-Error:" MessageBox MB_OK|MB_ICONEXCLAMATION "PostScript fonts can only be installed in Windows 2000 or later!" goto "${Index}-End" "${Index}-GO:" ClearErrors IfErrors 0 "${Index}-Add" MessageBox MB_OK "Error: ${FontBase}.pfm" Quit "${Index}-Add:" ClearErrors ${registry::Write} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer\Type 1 Fonts" "${FontName}" "T ${FontBase}.pfm ${FontBase}.pfb" "REG_MULTI_SZ" $R0 System::Call "GDI32::AddFontResourceA(t) i ('${FontBase}.pfm|${FontBase}.pfb') .s" goto "${Index}-End" "${Index}-End:" !undef Index pop $R2 pop $R1 Pop $R0 Pop $0 !macroend
Additional Resources
t1tools is a collection of programs and batch files useful for handling type 1 fonts on MSDOS and Unix systems.
PostScript fonts at Wikipedia