Skip to content

CairoFontEngine: cairo_font_face_t cache should only cache external fonts

Adrian Johnson requested to merge ajohnson/poppler:fix-reload into master

This is a quick and dirty fix for #1247 (closed). I'm planning a major refactor to fix it properly.

CairoFontEngine contains two caches. One for CairoFont objects that is indexed by Ref and cleared when the document is closed (CairoFontEngine destroyed).

The other cache, that was introduced in df47e4c4, was intended to cache cairo_font_face_t objects for external fonts that are shared across documents. It used a hash of the font data to compare fonts. When the hash was removed and replaced with comparing the Ref and filename it broke when the document is reloaded.

I've fixed it by removing the Ref check and only compare filenames for external fonts. I don't think there was any need for this cache to compare the font data when it was introduced in df47e4c4. Comparing the filename should be sufficient as long we know it is an external font. I plan to refactor to simplify a lot of this code.

Edited by Adrian Johnson

Merge request reports