Skip to content
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

Supporting textBaseline #9

Closed
KoKuToru opened this issue Sep 14, 2014 · 4 comments
Closed

Supporting textBaseline #9

KoKuToru opened this issue Sep 14, 2014 · 4 comments

Comments

@KoKuToru
Copy link
Contributor

I have a working textBaselinein 5031052 and 51a1860

But with some problems..
5031052 uses dominant-baseline which isn't supported in IE
51a1860 shifts y-coordiantes based on the font.size which works in IE, but does same strong assumptions fontEmSize = fontEmSize / 1.25; and fontSize = fontEmSize / 1.25;

http://www.w3.org/TR/2014/CR-2dcontext-20140821/#text-styles see graph,
too bad it's not possible to access the font metrics directly..

Any idea how to tackle this nicely ?

@gwwar
Copy link
Contributor

gwwar commented Sep 14, 2014

Since dominant-baseline is in the SVG 1.1 spec, I would say go ahead with mapping the values rather than adding in a hack for IE9.

@KoKuToru
Copy link
Contributor Author

Just checked again and found http://bl.ocks.org/eweitnauer/7325338
dominant-baseline looks broken in chrome, firefox looks useable (not 100% perfect).
It's not only IE9, newest IE can't render it too.

I could use https://github.com/Pomax/Font.js but I think it's overkill.

But yeah I would prefer dominant-baseline.

@gwwar
Copy link
Contributor

gwwar commented Sep 14, 2014

Yup, IE looks about like the image below. To be fair though, chrome, FF and safari are returning differing results on the lesser used values (the SVG spec is huge), but since alphabetical, hanging and middle are somewhat reasonable I think it's ok to go ahead and map the values. I would rather keep a simple mapping with valid SVG, instead of forcing text position encoding into the output. (The other SVG viewers should in theory implement it properly in the future).

ie9

@KoKuToru
Copy link
Contributor Author

Chrome in windows is correct (text-before is incorrect)
Chrome Windows;
unbenannt
I wonder why it looks wrong on my linux-maschine. Must be a bug in Chromium.
Chrome Linux:
unbenannt

OH ! Linux looks correct with 100% zoom..
4k Display here default 125% zoom.
The dashed border show the position I had originally (before scaling down to 100%)

So yeah I will implement the dominant-baseline-version !

This was referenced Sep 16, 2014
@gwwar gwwar closed this as completed Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants