Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fonts 导入本地字体Lazarus IDE_Fonts_Freepascal_Lazarus - Fatal编程技术网

Fonts 导入本地字体Lazarus IDE

Fonts 导入本地字体Lazarus IDE,fonts,freepascal,lazarus,Fonts,Freepascal,Lazarus,我有一个小工具,可以根据显示器的屏幕大小以及所有按钮和图像自动调整工具的窗口。现在我想在我的工具中添加一个本地字体(另存为.ttf文件),而不将其安装到Windows。我在网上找到了一个线程,有人想做同样的事情,我一直在尝试实现这段代码,但没有成功。除此之外,您可以看到我的LoadFonts过程,我手动创建该过程以加载本地字体 procedure LoadFonts(); // There I want to import a local font. begin if FileExists(

我有一个小工具,可以根据显示器的屏幕大小以及所有按钮和图像自动调整工具的窗口。现在我想在我的工具中添加一个本地字体(另存为.ttf文件),而不将其安装到Windows。我在网上找到了一个线程,有人想做同样的事情,我一直在尝试实现这段代码,但没有成功。除此之外,您可以看到我的LoadFonts过程,我手动创建该过程以加载本地字体

procedure LoadFonts(); // There I want to import a local font.
begin
  if FileExists(ExtractFilePath(Application.ExeName)+'Auricom_Regular.ttf') then
    if AddFontResourceEx(PAnsiChar(ExtractFilePath(Application.ExeName)+'Auricom_Regular.ttf'), FR_Private, Nil) <> 0 then
    begin
      SendMessage(Form1.Handle, WM_FONTCHANGE, 0, 0);
      ShowMessage('Font Installed!');
    end else RaiseLastOSError;
end; 
procedure LoadFonts();//在那里,我想导入本地字体。
开始
如果文件存在(ExtractFilePath(Application.ExeName)+'Auricom_Regular.ttf'),那么
如果AddFontResourceEx(PAnsiChar(ExtractFilePath(Application.ExeName)+'Auricom_Regular.ttf'),FR_Private,Nil)为0,则
开始
SendMessage(Form1.Handle,WM_FONTCHANGE,0,0);
ShowMessage('Font Installed!');
结束,否则将发生错误;
结束;
这将导致错误
未找到标识符“AddFontResourcesEx”
。 有人能帮我从文件系统导入本地字体(ttf)吗


编辑:我正在使用Lazarus IDE

如果Lazarus库文件中未定义
AddFontResourcesEx
,则需要自行定义。见此: