Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

替换字体功能,替换字体列表内找不到部分已安装字体 #101

Closed
hanli2016 opened this issue May 5, 2022 · 7 comments
Closed
Assignees
Labels
缺陷 Something isn't working

Comments

@hanli2016
Copy link

hanli2016 commented May 5, 2022

请简要描述你遇到的问题
pdf使用的思源黑体乱码,希望使用字体替换解决,但是替换字体列表里面找不到已安装的思源黑体字体。

word里可以看到思源黑体字体(SourceHanSans)已安装
word
替换列表里找不到(SourceHanSans也找不到)
补丁丁

@wmjordan
Copy link
Owner

wmjordan commented May 5, 2022

是这样的。由于技术限制,目前 OpenType 字体无法嵌入到 PDF 文档。

@hanli2016
Copy link
Author

是这样的。由于技术限制,目前 OpenType 字体无法嵌入到 PDF 文档。

猜到可能是这个问题,所以也装了ttf版的,也读取不到。
用的这个字体包https://github.com/be5invis/source-han-sans-ttf/releases/tag/v2.002.1

@wmjordan
Copy link
Owner

wmjordan commented May 5, 2022

PDF组件读取不了那字体。真没办法。

1 similar comment
@wmjordan
Copy link
Owner

wmjordan commented May 5, 2022

PDF组件读取不了那字体。真没办法。

@hanli2016
Copy link
Author

PDF组件读取不了那字体。真没办法。

好的,只能换其他字体了,感谢。

@wmjordan
Copy link
Owner

wmjordan commented May 5, 2022

是啊,我自己也想将某些字体替换成思源黑体、思源宋体,但实在没办法 :(

@hanli2016
Copy link
Author

hanli2016 commented May 5, 2022

我这边看了下源代码,找到了替换字体列表缺失字体的原因。缺失这部分字体位于注册表的[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]项目下,程序读取字体(FontHelper.cs内)只读取了LocalMachine下的字体,增加后就可以读取到所有字体。
但是部分文档测试会出现丢字或字体匹配错误问题,不确定什么原因。举例,使用思源黑体Normal的PDF替换为方正彩云简体没有问题,但是替换回思源黑体Normal时用adobe acrobat DC时,字体识别为Source Han Sans Smallcaps(正确为Source Han Sans Normal),显示有错误,但是用浏览器看这个PDF又是正常的。

字体替换
Quicker_20220505_222345

字体匹配错误
2323

@wmjordan wmjordan self-assigned this May 6, 2022
@wmjordan wmjordan added the 缺陷 Something isn't working label May 6, 2022
@wmjordan wmjordan reopened this May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
缺陷 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants