feat(内存占用): 复用SVG字体资源,减少多页阅读的传输量和内存开销
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-13 16:13:51 +08:00
1 parent 481b21c7ce
commit 78b34713cc
5 files changed
+165 -2

No files matched your search

+2
View File
@@ -35,6 +35,7 @@ type Renderer struct {
FontGIDMap map[string]map[uint16]rune
FontCIDMap map[string]map[uint16]rune
fontCache map[fontCacheKey]*canvas.FontFamily
svgFontCache map[*canvas.Font]SVGFont
fontSourceCache map[string][]fontSource
fontSourceUsed map[string]fontSource
fontDirCandidates map[string][]fontFileCandidate
@@ -64,6 +65,7 @@ func (r *Renderer) resetFontCache() {
r.FontGIDMap = make(map[string]map[uint16]rune)
r.FontCIDMap = make(map[string]map[uint16]rune)
r.fontCache = make(map[fontCacheKey]*canvas.FontFamily)
r.svgFontCache = make(map[*canvas.Font]SVGFont)
r.fontSourceCache = make(map[string][]fontSource)
r.fontSourceUsed = make(map[string]fontSource)
r.fontDirCandidates = make(map[string][]fontFileCandidate)