Stop "Noto Color Emoji" with SVG glyphs from using 40 GBytes of memory.

"Noto Color Emoji" as downloaded from Google's font website contains both CBLC/CBDT and SVG OpenType tables (distributions tend to strip the SVG part out). Inkscape will try to use the SVG to render glyphs. The glyphs are stored in one large 14Mbyte SVG (which is allowed per spec). Most other SVG-in-OpenType fonts store each glyph as a separate SVG. Inkscape currently makes a copy of the SVG for each glyph. This has two problems:

  1. When multiplied by the number of glyphs in the SVG, 40 GBytes of memory is required to store all the SVG copies.
  2. As Inkscape currently has no mechanism for picking out the required glyph from the file, all the glyphs are shown (almost 3000 on top of each other).

This merge request stores each SVG in a font file just once. It also hides all the glyphs as the SVG is stored (setting the presentation attibute 'visibility' for each glyph to "hidden"). When it is time to generate a PixBuf for a glyph, it unhides that glyph.

This merge request also increases the size of the pixbuf generated from the SVG as the "Noto Color Emoji" glyphs are wider than an embox. This is a temporary fix. It would be better to use a box generated from the width of the glyph but that requires fixing our code which assumes that all glyphs have paths.

Note that while, with this merge request, one can use the SVG version of "Noto Color Emoji", performance may be poor due to the large size of the SVG.

Fixes #5368 (closed)

Merge request reports

Loading