-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to render a subscript ends up with bold font #609
Comments
Yes, the current font fallback algorithm doesn't account for font styles. It simply picks up the first font that has the required glyph. There is an endless amount of work left in the SVG text layout. And while this is definitely a bug/missing feature, your SVG is partly to blame, because it literally states "use whatever font you want". Which it does. The solution here would be to use something like: <text font-family="sans-serif" font-size="60px" fill="#000">
foo<tspan baseline-shift="sub" font-size="70%">2</tspan>
</text> This is less magical and way more portable. |
Using a file like
and
./resvg --sans-serif-family "Liberation Sans" simple_subscript_bold.svg simple_subscript_bold.png
gives a warning "Warning (in usvg_text_layout:1398): Fallback from Liberation Sans to Noto Sans Mono." and result likeHowever specifying
./resvg --sans-serif-family "Noto Sans Mono" simple_subscript_bold.svg simple_subscript_bold.png
doesn't give any warnings and also doesn't render the text in bold:I suppose the problem is that Liberation Sans doesn't have the codepoint 2083 (subscript 2) available:
fc-query --format='%{charset}\n' /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf
⇒… 207f 20a3-20a4 …
and Noto does (2074-208e
). But I would expect then that a regular weight fallback would be used, and preferably a warning why the fallback was used when the requested font does exist.The text was updated successfully, but these errors were encountered: