Use cairo-script-interpreter to parse the scripts that generate cairo
nodes.
This requires libcairoscriptinterpreter.so to work properly, but if
it isn't found we disable this (unimportant for normal functioning)
code and just emits a parser warning.
The testsuite requires it however or it will fail.
A new test is included that tests all of this.
CSS does not do exponents, so printing numbers close to 0 as 1.234e-15
does not work.
Also up the accuracy to 17 digits because that's what everyone else
uses.
Instead of only allowing for glyph indexes, allow ASCII characters as
replacements. So this glyph sequence
glyphs: 65 8, 66 8, 67 8
Can be replaced by
glyphs: "ABC"
provided that the glyph for "A", "B" and "C" are 65, 66 and 67
respectively and their advance is exactly 8.
x offset and y offset must always be 0 and every glyph must start a
cluster.
Update to the docs outlined in #1887.
In particular, the changes do:
1. Require no property, have a working default for everything
2. Be clear about what gets printed and how.
Tests ahve been adapted to still pass.
When printing, behave the same way as when parsing:
Magically skip a container node if there is one - just like the
parser magically creates a container node to hold all the nodes
it parses.
We don't want to return a GFile because GFile can't handle can't deal
with data: urls.
That makes the code a bit more complicated that doesn't deal with those
URLs, but it makes the other code actually work.
GtkCssImageUrl also now decodes data urls immediately instead of only at
the first load. So don't use data urls if you care about performance.
Instead of encoding the raw data, encode the full image to a PNG.
And instead of stuffing that encoding into a string, use a full
data: url.
And then remove the width and height properties, because they're now
implicitly included in the data.
And then change the parser to match.
And because the parser now parses regular urls on top of data: urls, we
can now load any random file.
Instead of the previous approach using GVariant, this new approach uses
human-readable text files as the serialization format for render nodes.
The format is a custom one, but it is inspired by QML and conforms to
the CSS syntax. Because of that, we can use the CSS machinery from GTK
to parse it, and in particular share code to parse properties that GTK's
CSS machinery also supports, such as colors.
This commit breaks all existing usages of node files - such as the
testsuite and various test tools - they will be fixed in further
commits.