feat(转换能力): 修复符号字体转换异常
build.yaml / build (push) Successful in 56s

This commit is contained in:
xiaoqidun committed 2026-10-09 14:54:24 +08:00
1 parent ad099a099b
commit f73b67c729
6 files changed
+148 -14

No files matched your search

+23 -7
View File
@@ -326,13 +326,29 @@ func (p *pdfImporter) text(mark pdfgo.TextMark) error {
if err != nil {
return err
}
} else if imported = p.embeddedTextFont(font, mark.Glyphs); imported != nil {
reused, embedded = true, true
mark.Glyphs = slices.Clone(mark.Glyphs)
for index := range mark.Glyphs {
char, _ := utf8.DecodeRuneInString(mark.Glyphs[index].Text)
mark.Glyphs[index].ID = imported.metrics.GlyphIndex(char)
mark.Glyphs[index].HasID = true
} else {
imported = p.embeddedTextFont(font, mark.Glyphs)
symbol := false
if imported == nil {
imported, err = p.symbolFont(font)
if err != nil {
return err
}
symbol = imported != nil
}
if imported != nil {
reused, embedded = true, true
mark.Glyphs = slices.Clone(mark.Glyphs)
for index := range mark.Glyphs {
glyph := &mark.Glyphs[index]
if symbol {
glyph.ID = imported.type1Glyphs[glyph.Name]
} else {
char, _ := utf8.DecodeRuneInString(glyph.Text)
glyph.ID = imported.metrics.GlyphIndex(char)
}
glyph.HasID = true
}
}
}
id := p.fontIDs[font]