mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:31:12 +08:00
1 parent
ad099a099b
commit
f73b67c729
6 files changed
+148
-14
No files matched your search
+23
-7
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user