简体   繁体   English

仅针对Inno设置为运行时添加otf字体资源

[英]adding otf font resource for runtime only for inno setup

I am trying to add some additional font type to resource and then use it in my inno setup installer, only for runtime, but it is not working for OTF Font types but works perfectly for TTF font types the code I am using is something like that: 我正在尝试向资源中添加一些其他字体类型,然后在我的inno setup安装程序中使用它,仅用于运行时,但是它不适用于OTF字体类型,但可以完美地用于TTF字体类型,我正在使用的代码类似于:

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

[Files]
Source: Setup\Ubuntu.otf;  DestDir: {tmp}; Flags: dontcopy

[code]
const
  FR_PRIVATE = $10;

function AddFontResourceEx(lpszFilename:string;fl:dword;pdv:integer): LongInt; external 'AddFontResourceExW@gdi32.dll stdcall';
function RemoveFontResourceEx(lpszFilename:string;fl:dword;pdv:integer): Boolean; external 'RemoveFontResourceExW@gdi32.dll stdcall';

function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('Ubuntu.otf');
  if (AddFontResourceEx(ExpandConstant('{tmp}\Ubuntu.otf'),FR_PRIVATE,0) = 0) then
    MsgBox('failed adding font - Ubuntu.otf',mbInformation,MB_OK);
  result := true;
end;

procedure InitializeWizard();
begin
  WizardForm.WelcomeLabel1.Font.Name := 'Ubuntu';
end;

procedure DeinitializeSetup();
begin
  RemoveFontResourceEx(ExpandConstant('{tmp}\Ubuntu.otf'),FR_PRIVATE,0);
end;

AddFontResourceEx function is always successful but there is no effect on font, it is using fail safe default font instead AddFontResourceEx函数始终成功,但是对字体没有影响,它使用故障安全默认字体

我认为您需要添加标志参数' fontisnttruetype '。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM