mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text: avoid creating two Face instances
This way their cache can be shared. Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
+3
-2
@@ -270,8 +270,9 @@ func newShaperImpl(systemFonts bool, collection []FontFace) *shaperImpl {
|
|||||||
// in the order in which they are loaded, with the first face being the default.
|
// in the order in which they are loaded, with the first face being the default.
|
||||||
func (s *shaperImpl) Load(f FontFace) {
|
func (s *shaperImpl) Load(f FontFace) {
|
||||||
desc := opentype.FontToDescription(f.Font)
|
desc := opentype.FontToDescription(f.Font)
|
||||||
s.fontMap.AddFace(f.Face.Face(), fontscan.Location{File: fmt.Sprint(desc)}, desc)
|
face := f.Face.Face()
|
||||||
s.addFace(f.Face.Face(), f.Font)
|
s.fontMap.AddFace(face, fontscan.Location{File: fmt.Sprint(desc)}, desc)
|
||||||
|
s.addFace(face, f.Font)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *shaperImpl) addFace(f *font.Face, md giofont.Font) {
|
func (s *shaperImpl) addFace(f *font.Face, md giofont.Font) {
|
||||||
|
|||||||
Reference in New Issue
Block a user