voderl / font-slice

slice chinese fonts into small slices
MIT License
61 stars 3 forks source link

切字体后乱码 #4

Closed liu578101804 closed 1 year ago

liu578101804 commented 1 year ago

image 我按照你的文档说明,我把 22M 的 思源宋体-Heavy.otf 切片后,出现乱码 image

voderl commented 1 year ago

可以在这里上传下会出现问题的思源宋体的字体文件,我看下。同时我试下直接从 ttf 转会不会有同样的问题。

liu578101804 commented 1 year ago

谢谢大佬回复, 这两个我都试过,都会乱码

------------------ 原始邮件 ------------------ 发件人: "voderl/font-slice" @.>; 发送时间: 2023年6月26日(星期一) 下午4:03 @.>; @.**@.>; 主题: Re: [voderl/font-slice] 切字体后乱码 (Issue #4)

可以在这里上传下会出现问题的思源宋体的字体文件,我看下。同时我试下直接从 ttf 转会不会有同样的问题。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

从QQ邮箱发来的超大附件

思源宋体-Heavy.otf (21.85M, 无限期)进入下载页面:https://mail.qq.com/cgi-bin/ftnExs_download?k=7e6466645d3792c91546134613620218411002515353555614540057534f07025b024b010501511a0e010007570308010d005456357030fc85b0d2affbaed51a710107124c4c5f435f645b&t=exs_ftn_download&code=9dfd5b07

SourceHanSerifCN-Bold.otf (1.22M, 无限期)进入下载页面:https://mail.qq.com/cgi-bin/ftnExs_download?k=76313437eab389991413411510305749404505075007035e1500060e031d50000e0919070e55514b5d54565101530304000503043629653557444654537804086b54465e50732b4b7a5e5853185f1100380c&t=exs_ftn_download&code=814760ef

voderl commented 1 year ago

使用这里下载的字体试下呢,https://github.com/Pal3love/Source-Han-TrueType/releases 下载 SourceHanSerifCN.zip 这个就行,我试了下这里的是正常的: image

乱码这个问题应该是底层依赖的 fontmin 也有问题

可以试下上面的方案能否解决问题,如果不能解决我再看下如何处理

liu578101804 commented 1 year ago

还真是呢,可以了。

如果我现在需要用到好几种字体。

我可以把他们打包到一起么,还是需要不同字体各自打包呀?

谢谢!

------------------ 原始邮件 ------------------ 发件人: "voderl/font-slice" @.>; 发送时间: 2023年6月26日(星期一) 下午4:18 @.>; @.**@.>; 主题: Re: [voderl/font-slice] 切字体后乱码 (Issue #4)

使用这里下载的字体试下呢,https://github.com/Pal3love/Source-Han-TrueType/releases 下载 SourceHanSerifCN.zip 这个就行,我试了下这里的是正常的:

乱码这个问题应该是底层依赖的 fontmin 也有问题

ecomfe/fontmin#107

可以试下上面的方案能否解决问题,如果不能解决我再看下如何处理

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

voderl commented 1 year ago

目前是每一个字体打包一个目录。可以设置 options.preview 为 false,一次在脚本中打包多个字体。

打包到一起指的是多个字体使用同一个 css 文件引入吗?目前还不支持,只能手动将多个 css 文件合成一个 css,字体文件都放到一个目录。

liu578101804 commented 1 year ago

好的,谢谢大佬

------------------ 原始邮件 ------------------ 发件人: "voderl/font-slice" @.>; 发送时间: 2023年6月26日(星期一) 下午4:29 @.>; @.**@.>; 主题: Re: [voderl/font-slice] 切字体后乱码 (Issue #4)

目前是每一个字体打包一个目录。可以设置 options.preview 为 false,一次在脚本中打包多个字体。

打包到一起指的是多个字体使用同一个 css 文件引入吗?目前还不支持,只能手动将多个 css 文件合成一个 css,字体文件都放到一个目录。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

voderl commented 1 year ago

对的,目前写多个 createFontSlice 需要给每个字体不同的目录,不然 font.css 会覆盖掉。 如果想要一个 font.css 引入多个字体的话,目前只能手动整合到一起,再把字体文件放到一个目录里。后续可能会考虑支持多个字体打包到一个 css 里。