The class now supports incremental filling, multiple fonts, texture
arrays, removes all reliance on STL containers and is finally properly
documented.
To avoid complete breakage of every use, as much as possible was kept as
deprecated APIs -- in particular the reserve() with the nasty
std::vectors, the insert() that assumes a 2D cache and a single font
and textureSize() that returns a 2D vector. Those behave the same as
before, but will assert if the cache is an array or contains more than
one font.
On the other hand, begin() / end() access with std::unordered_map iterators
(ew!) was removed as the internals simply aren't a hashmap anymore. The
image() that returned an Image2D is now used to fill the glyph cache
instead of querying its potentially processed contents, and returns a
MutableImageView3D. I considered keeping it and adding sourceImage()
instead, but such naming turned out to be too inconsistent. For querying
processed image data (such as with the distance field cache) there's a
new processedImage() query, guarded by new GlyphCacheFeature bits -- if
both ImageProcessing and ProcessedImageDownload is set, it can be used
to retrieve the processed image (so, similar as ImageDownload was
before), and if neither is set, the cache contents are queryable
directly through image(), without needing any special support from
the GPU API.
Existing code is updated only in the minimal way possible to ensure that
no serious breakage was introduced by reimplementing the deprecated APIs
on top of the new backend. Porting away from deprecated APIs will be
done in next commits. The GlyphCache and DistanceFieldGlyphCache have
their public API kept intact for now, as a similar rework will be needed
for them as well.
Additionally, the MagnumFont and MagnumFontConverter plugins aren't
compiling yet as they require substantial changes to deal with the new
glyph cache features. That is not the case with other plugins in the
magnum-plugins repository tho, for those the backwards compatibility
"just works". On the other hand, since layout of the AbstractGlyphChange
changed, I'm bumping the AbstractFont plugin interface version to
force-trigger a rebuild of dependent projects. Because I ran a stale
magnum-player binary, it worked without crashing or GL errors but just
didn't show ANY text whatsoever due to ABI differences, and I wasted
some precious minutes before realizing that a simple rebuild would fix
it.
Snippets that possibly generate output for Magnum documentation
###############################################################
"Getting started" image
Displayed by the getting-started executable. Run the app and take screenshot
using Spectacle (including decorations, 880x707). Similarly for the gray
version. The resulting files should be resized to half. pngcrush to them for
smaller file sizes:
Created by Inkscape from doc/artwork/triangulate.svg and line-*.svg by
saving as Optimized SVG. On fresh installations you need the scour package
for it:
enabling all possible options in the dialog, saving
cleaning up the <svg> header (removing version, xmlns) in an editor
converting to a style="", keepingviewBox
adding class="m-image"
removing all layers that have display: none
In case of the line-quad-data-expansion*.svg and
line-quad-data-overlap-*.svg, they're all generated from
doc/artwork/line-quad-expansion.svg and doc/artwork/line-quad-overlap.svg,
each time with different layers shown.
The doc/artwork/line-quad-data-other.svg is derived from
doc/artwork/line-quad-data-neighbor.svg by removing the "neighbor" layer and
making the canvas smaller, the doc/artwork/line-quad-data.svg is then derived
from doc/artwork/line-quad-data-other.svg by removing the "other" layer and
making the canvas smaller yet again.