lowMemory
option causes glyphs to be skipped when writing font (with toArrayBuffer
)
#742
Labels
lowMemory
option causes glyphs to be skipped when writing font (with toArrayBuffer
)
#742
Overview
The
lowMemory
option appears to save memory by only loading the most commonly-used glyphs initially, and then loading other glyphs on an as-needed basis. However, when writing fonts usingtoArrayBuffer
, it appears that any unloaded glyphs are excluded from the font file, rather than being loaded as needed. This can be confirmed by attempting to download the font in the demo site (which useslowMemory
mode) by running the following from the console.The resulting font is missing the vast majority of the glyphs. Forcing an unloaded glyph to be loaded (e.g.
~
can be loaded into memory by runningfont.charToGlyph('~')
) results in it being included in the download. While the resulting font will open, in addition to being missing glyphs, FontForge often throws errors because tables may reference glyphs that no longer exist.Possible Solutions
While it would be nice to have font writing work as expected in
lowMemory
mode, I don't think that is necessary. The primary reason this behavior is problematic is that it is not error-evident. RunningtoArrayBuffer
after enablinglowMemory
will run without any error, and produces a font that is just correct enough to work within a basic development example or automated test. Therefore, alerting the developer with a warning message whentoArrayBuffer
is called andlowMemory
is enabled would resolve the primary issue.Your Environment
The text was updated successfully, but these errors were encountered: