Thread: Fonts Manifest
View Single Post
  #2  
Old 10-06-2016, 23:50
vint56 vint56 is offline
Registered User
 
Join Date: May 2011
Location: almaty
Posts: 52
Thanks: 118
Thanked 55 Times in 31 Posts
vint56 is on a distinguished road
Code:
#define Font "Zombie.ttf"
#define FontName "DS Zombie Cyr"

[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Files]
Source: {#Font}; Flags: dontcopy

[code ]
#ifdef UNICODE
    #define A "W"
#else
    #define A "A"
#endif

const
    FR_PRIVATE = $10;

function AddFontResource(lpszFilename: String; fl, pdv: DWORD): Integer; external 'AddFontResourceEx{#A}@gdi32.dll stdcall';
function RemoveFontResource(lpFileName: String; fl, pdv: DWORD): BOOL; external 'RemoveFontResourceEx{#A}@gdi32.dll stdcall';

procedure InitializeWizard();
begin
    if not FontExists('{#FontName}') then
    begin
        ExtractTemporaryFile('{#Font}');
        AddFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
    end;
    WizardForm.Font.Name := '{#FontName}';
end;

procedure DeinitializeSetup();
begin
    RemoveFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
    WizardForm.Free;
end;
Reply With Quote
The Following 2 Users Say Thank You to vint56 For This Useful Post:
Nemko (11-08-2017), Prince4 (11-06-2016)