GNU bug report logs -
#75712
HAVE_RSVG: svg_css_length_to_pixels doesn't handle RSVG_UNIT_CH
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Stefan Kangas <stefankangas <at> gmail.com> writes:
> In Bug#75451, Pip Cet <pipcet <at> protonmail.com> writes:
>
>> svg_css_length_to_pixels doesn't handle the RSVG_UNIT_CH case. I don't
>> know at which version rsvg started to offer this unit; it's not
>> indicated in the header file.
>
> It seems to have been added in 2.58:
>
> https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/enum.Unit.html
I came up with the following patch, but it's not ideal.
With CSS 3, "the ch unit falls back to 0.5em in the general case, and to
1em when it would be typeset upright".
https://www.w3.org/TR/css-values-3/#ch
Unfortunately, this patch doesn't take into account the "direction" or
"writing-mode" CSS attributes, which is what seems to specify the above.
I couldn't find a way to easily get these CSS attributes using librsvg.
Instead, I just naively assume that they are set to their default
non-vertical value, and thus use 0.5em. That's not always going to
work, obviously.
While the "ch" attribute seems to be rarely used, it would be nice to
get this detail right. I'm just not sure how to do it. Maybe look
through the CSS by hand, searching for these strings and then parsing it
out? But that's likely to be brittle, ugly, and hard to maintain.
Anyone have any good ideas here? It's my first time fiddling with
librsvg, so it's quite possible that I'm overlooking something.
That said, I guess this could be installed as a stopgap, to have a
better result than we have now for the common case.
[0001-Support-SVG-ch-length-values.patch (text/x-patch, attachment)]
This bug report was last modified 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.