如何安装字体?
如果我只是使用文件来安装字体,安装会很好,但是字体没有用:当你尝试用它们书写时,不会显示任何字符,如果你在字体文件夹中双击它们,它们的预览将是空白的。
到目前为止,我尝试遵循本指南,使用以下代码片段:
FindFirst $5 $6 "..\3rdparty\fonts\*.ttf"
loop:
StrCmp $6 "" done
!insertmacro InstallTTFFont $6
FindNext $5 $6
Goto loop
done:
FindClose $5
但是,我收到此错误:
!insertmacro:安装TTFFont推送:$0 推送:$R0 推送:$R1 推送:$R2 !定义: “索引”=“Line66.6”!插入宏: GetFileNameCall 推送:6 美元调用 "GetFileName" Pop: $0 !insertmacro: GetFileNameCall 结束!定义: "FontFileName"="$0" 设置输出路径: "$FONT_DIR" 如果文件存在: “$FONT_DIR\$0”?第66.6行:文件: “$6”->没有找到文件。用途:文件 [/nonfatal] [/a] ([/r] [/x 文件规范 [...]] 文件规范 [...] |
/oname=outfile one_file_only) 错误 Macroline 14 上的宏 InstallTTFFont 脚本错误 “C:\ScanModule\Install\ScanModule.nsi” 第 66 行——中止创建 流程
编辑:如果我只是手动写出所有单独的字体,它就可以工作。这样问题就解决了。有点。我并不是在抱怨,但这并不酷。
If I just use File to install fonts, installation goes fine, but the fonts are useless: no characters show up when you try to write with them, and if you doubleclick them in a fonts folder, their preview would be blank.
So far I tried to follow this guide, with this snippet of code:
FindFirst $5 $6 "..\3rdparty\fonts\*.ttf"
loop:
StrCmp $6 "" done
!insertmacro InstallTTFFont $6
FindNext $5 $6
Goto loop
done:
FindClose $5
However, I get this error:
!insertmacro: InstallTTFFont Push: $0
Push: $R0 Push: $R1 Push: $R2 !define:
"Index"="Line66.6" !insertmacro:
GetFileNameCall Push: $6 Call
"GetFileName" Pop: $0 !insertmacro:
end of GetFileNameCall !define:
"FontFileName"="$0" SetOutPath:
"$FONT_DIR" IfFileExists:
"$FONT_DIR\$0" ? Line66.6 : File:
"$6" -> no files found. Usage: File
[/nonfatal] [/a] ([/r] [/x filespec
[...]] filespec [...] |
/oname=outfile one_file_only) Error in
macro InstallTTFFont on macroline 14
Error in script
"C:\ScanModule\Install\ScanModule.nsi"
on line 66 -- aborting creation
process
Edit: If I just manually write out all of the individual fonts, it works. So problem solved. Sorta. Not that I'm complaining, but that's not cool.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此有 4 个想法:
你也尝试过引用吗?
!insertmacro InstallTTFFont "$6"
FindFirst ... 循环是在开发人员的计算机上还是在用户的计算机上执行?我不确定它是如何工作的以及实现是否适合您。
我看到您使用相对路径“..\3rdparty\fonts*.ttf”。您启动命令时的工作目录是什么?
您还可以将类似的内容添加到 C:\ScanModule\Install\ScanModule.nsi 中,以了解为什么只能手动编写字体。
MessageBox MB_OK "Param 0: $0"
I have 4 thoughts about it:
Did you try also quotes?
!insertmacro InstallTTFFont "$6"
Is FindFirst ... loop performed on developer's machine or on user's machine? I am not sure how it works and if implementation fits to you.
I see you use relative path "..\3rdparty\fonts*.ttf". What is working directory in time you launched the command?
You could also add something like this into the C:\ScanModule\Install\ScanModule.nsi to understand why only manually wrote fonts work.
MessageBox MB_OK "Param 0: $0"