Delphi 字体资源

发布于 2024-12-23 09:32:03 字数 572 浏览 2 评论 0原文

我有一个应用程序,其中包含一个 TTF 资源作为“字体”。我希望在 FormCreate 事件中使用此字体作为 Fomr 字体。我不愿意将此字体提取到目录并从那里加载。我无法做到这一点,请帮助我。我是学习者,请不要询问我的代码。

我使用了“字体资源 ID 13”和“字体名称 AmarBangla.ttf”。我已尝试以下代码,但出现错误。这是这些代码:

第一个:

procedure TForm01.FormCreate(Sender: TObject);
 begin
    Form01.font[13] := AddFontResource (LPCTSTR lpszFontName));
    Form01.font := 13;
end;

第二个:

 procedure TForm01.FormCreate(Sender: TObject);
 begin
    Form01.font[13] := AddFontResource (Hinstance, MakeIntResource(13));
    Form01.font := 13;
 end;

I have an application having with one TTF resource as "Font" included. I wish to use this font as Fomr Font on FormCreate event. I am not willing to extract this font to a directory and load from there. I am unable to this please help me. I am learner please do not ask for my codes.

I have used "Font Resource ID 13" and "Font Name AmarBangla.ttf". I have tried the following codes but gerting error. Here is those codes:

First One :

procedure TForm01.FormCreate(Sender: TObject);
 begin
    Form01.font[13] := AddFontResource (LPCTSTR lpszFontName));
    Form01.font := 13;
end;

Second One :

 procedure TForm01.FormCreate(Sender: TObject);
 begin
    Form01.font[13] := AddFontResource (Hinstance, MakeIntResource(13));
    Form01.font := 13;
 end;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抠脚大汉 2024-12-30 09:32:03

AddFontMemResourceEx函数可以帮助你,但它看起来像 如果违反字体许可,微软将禁止将其字体嵌入到应用程序中

应用程序不能与包含嵌入字体的文档一起分发,应用程序本身也不能包含嵌入字体

字体嵌入可能会侵犯版权。您首先需要一种允许重新分发的字体,然后需要将其与应用程序一起安装在目标系统上。此外,字体的属性会告诉您它们是否允许嵌入。

The AddFontMemResourceEx function could help you, but it looks like Microsoft forbids embedding their fonts into applications if it violates the license of the font:

An application cannot be distributed along with documents that contain embedded fonts, nor can an application itself contain an embedded font.

Font embedding may violate copyrights. You first need a font that allows for redistribution, and then you will need to install it on the target system along with your application. Moreover, the font's properties will tell you if they allow for embedding.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文