Create the font request on the text item side to reduce duplication and
remove the fallback logic from the font_weight accessor, in preparation
for automatic generation of that getter.
* When calculating the height of text for vertical alignment purposes,
don't use the minimum height but stick to ascent + descent - like the old
renderer. This gives Text items a constant height that depends on the
font size and not the content.
* Avoid scaling text metrics twice. It turns out that femtovg uses the
device pixel ratio / dpi argument for `set_size` only for scaling text
metrics. Since we do all the mapping from logical pixels to physical pixels
it's correct to let femto only operate in physical pixel range. As a bonus
this allows removing the refresh_window_scale_factor() dance in the
backend (including making the context current, etc.)
In the previous renderer the text, by default, is drawn at the top of the
bounding box. The default femtovg alignment is more like QPainter, but
that's not quite what we want here.
Ensure the dpi on the canvas is up-to-date before/after rendering, as
measure_text etc. rely on it and it's otherwise initialized to 1 by
default. Unfortunately this requires jumping through some hoops, but
that can be fixed later in the canvas.
This means going back to an immutable renderer reference and interior
mutability for the canvas and the gpu cache. This is because while
traversing the item tree for rendering we may end up destroying
other items due to the lazyness of the models.
... to a more general gpu_cache and store an enum. That way we can
encapsulate the resource releasing - in the future - entirely in the
backend through run-time polymorphism in the backend (gpu cache data
enum) instead of a vtable method in the item to destruct the correct
type of data.
This is the start of a different rendering abstraction, the result of a
separate discussion.
The objective is to provide a better backend encapsulation, that will
make it easier to implement other backends and let the backend decide
what to cache and what not. This is done by passing the struct with the
Property<> fields directly to the backend, so that it can decide what
the cache and what to use every time.
Disable anti-aliasing on the GL context, as that's often implemented
multi-sampling and it appears generally slow with Angle on Windows.Since
we do anti-aliasing ourselves, so it is not needed.