Inno Setup-如何在安装开始之前安装许多字体?

用户名

我想在安装开始之前安装一些字体,可以吗?

TLama

如何在不安装向导的情况下使用外部字体?

要将字体注册为某个过程(在您的情况下为设置)供私人使用,可以使用AddFontResourceEx带有参数中FR_PRIVATE指定标志的Windows API函数fl它将允许您仅将字体用于过程。在下面的示例脚本中,如何将字体提取到临时文件夹中,如何注册字体以供设置过程专用,以及如何将其加载到向导表单控件中:

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

[Files]
Source: "MyFont.ttf"; Flags: dontcopy

[Code]
#ifdef UNICODE
  #define AW "W"
#else
  #define AW "A"
#endif
const
  FR_PRIVATE = $10;
  FR_NOT_ENUM = $20;

function AddFontResourceEx(lpszFilename: string;
  fl: DWORD; pdv: Cardinal): Integer;
  external 'AddFontResourceEx{#AW}@gdi32.dll stdcall';
function RemoveFontResourceEx(lpFileName: string;
  fl: DWORD; pdv: Cardinal): BOOL;
  external 'RemoveFontResourceEx{#AW}@gdi32.dll stdcall';

var
  FontFlags: DWORD;

[Code]
procedure InitializeWizard;
var
  FontName: string;
begin
  // extract the font file to the temporary folder
  ExtractTemporaryFile('MyFont.ttf');
  // this combination specifies the reservation of this font for use
  // in the setup process and that this font cannot be enumerated
  FontFlags := FR_PRIVATE or FR_NOT_ENUM;
  // add the font resource
  if AddFontResourceEx(ExpandConstant('{tmp}\MyFont.ttf'),
    FontFlags, 0) <> 0 then
  begin
    // note, that this is the name of the font, which doesn't have
    // to match to the font file name
    FontName := 'My Font Name';
    // the global setting of the WizardForm.Font property causes many
    // of its child controls to inherit this font; except those listed
    // below; their default font has changed and they lost the ability
    // to inherit the font from their parent so we must do it manually
    WizardForm.Font.Name := FontName;
    WizardForm.WelcomeLabel1.Font.Name := FontName;
    WizardForm.PageNameLabel.Font.Name := FontName;
    WizardForm.FinishedHeadingLabel.Font.Name := FontName;
  end;
end;

procedure DeinitializeSetup;
begin
  // remove the font resource
  RemoveFontResourceEx(ExpandConstant('{tmp}\MyFont.ttf'),
    FontFlags, 0);
end;

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何从Inno Setup安装JRE?

来自分类Dev

如何在inno setup中进行mysql的静默安装?

来自分类Dev

Inno Setup:仅在非常安静时安装

来自分类Dev

Inno Setup –更新之前压缩本地文件

来自分类Dev

如何使用Inno Setup作为必备组件安装.NET Framework?

来自分类Dev

如何覆盖Inno Setup中的功能?

来自分类Dev

如何从Inno Setup安装程序设置全局环境变量?

来自分类Dev

Inno Setup“安装完成”向导页面

来自分类Dev

Inno Setup到底如何强制重启

来自分类Dev

在Inno Setup中取消安装

来自分类Dev

Inno Setup禁用安装向导页面

来自分类Dev

Inno Setup更改CreateOutputMsgMemoPage字体

来自分类Dev

Inno Setup:/ verysilent安装后如何自动运行程序?

来自分类Dev

如何在Inno Setup中最小化安装程序?

来自分类Dev

Inno Setup-如何安装Windows Update脱机安装程序

来自分类Dev

如何使用Inno Setup检查Internet连接

来自分类Dev

如果安装程序中的字体版本高于安装的字体版本,请使用Inno Setup安装字体

来自分类Dev

如何在Inno Setup中的安装后强制重启

来自分类Dev

在Inno Setup中安装部分后,如何移动任务部分?

来自分类Dev

如何使Inno Setup RunList清单框透明?

来自分类Dev

如果安装程序中的字体版本高于安装的字体版本,请使用Inno Setup安装字体

来自分类Dev

Inno Setup:仅在不静音时安装

来自分类Dev

如何在inno setup中进行mysql的静默安装?

来自分类Dev

Inno Setup Compiler:如何修改文件内容

来自分类Dev

安装字体后,Inno Setup是否需要重新启动?

来自分类Dev

Inno Setup“安装完成”向导页面

来自分类Dev

Inno Setup禁用安装向导页面

来自分类Dev

如何解压缩Inno Setup安装程序

来自分类Dev

使用Inno Setup创建透明的安装程序?

Related 相关文章

  1. 1

    如何从Inno Setup安装JRE?

  2. 2

    如何在inno setup中进行mysql的静默安装?

  3. 3

    Inno Setup:仅在非常安静时安装

  4. 4

    Inno Setup –更新之前压缩本地文件

  5. 5

    如何使用Inno Setup作为必备组件安装.NET Framework?

  6. 6

    如何覆盖Inno Setup中的功能?

  7. 7

    如何从Inno Setup安装程序设置全局环境变量?

  8. 8

    Inno Setup“安装完成”向导页面

  9. 9

    Inno Setup到底如何强制重启

  10. 10

    在Inno Setup中取消安装

  11. 11

    Inno Setup禁用安装向导页面

  12. 12

    Inno Setup更改CreateOutputMsgMemoPage字体

  13. 13

    Inno Setup:/ verysilent安装后如何自动运行程序?

  14. 14

    如何在Inno Setup中最小化安装程序?

  15. 15

    Inno Setup-如何安装Windows Update脱机安装程序

  16. 16

    如何使用Inno Setup检查Internet连接

  17. 17

    如果安装程序中的字体版本高于安装的字体版本,请使用Inno Setup安装字体

  18. 18

    如何在Inno Setup中的安装后强制重启

  19. 19

    在Inno Setup中安装部分后,如何移动任务部分?

  20. 20

    如何使Inno Setup RunList清单框透明?

  21. 21

    如果安装程序中的字体版本高于安装的字体版本,请使用Inno Setup安装字体

  22. 22

    Inno Setup:仅在不静音时安装

  23. 23

    如何在inno setup中进行mysql的静默安装?

  24. 24

    Inno Setup Compiler:如何修改文件内容

  25. 25

    安装字体后,Inno Setup是否需要重新启动?

  26. 26

    Inno Setup“安装完成”向导页面

  27. 27

    Inno Setup禁用安装向导页面

  28. 28

    如何解压缩Inno Setup安装程序

  29. 29

    使用Inno Setup创建透明的安装程序?

热门标签

归档