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

Correct orientation? #63

Closed
emrosenf opened this issue Dec 28, 2016 · 3 comments
Closed

Correct orientation? #63

emrosenf opened this issue Dec 28, 2016 · 3 comments

Comments

@emrosenf
Copy link

Sorry for the elementary question. I'm following the example from fonttest to turn a text string into an SVG path. When you load the resulting SVG file in the browser, the glyphs are flipped.

I understand that by convention, the y-axis for SVG points downward whereas for fonts it points upward. My question is: what is the best way to work with the path data so that the glyphs appear with proper orientation? Can I generate the path data so that it appears right-side-up to begin with Should I wrap everything in a <g transform="scale(1,-1)">?

@emrosenf emrosenf closed this as completed Jan 2, 2017
@pixarbasim
Copy link

I am facing the same problem. @emrosenf What solution did you arrive at for this?

@Pomax
Copy link
Contributor

Pomax commented Jun 14, 2018

this is how fonts work: the coordinate system in OpenType is flipped with respect to SVG's coordinate system. Just use a <g> transform to flip things as needed.

@AgainPsychoX
Copy link

AgainPsychoX commented Jun 22, 2021

How about flipping while printing to canvas?

I know it can be done, but its troublesome... My current code looks like this, and its not nice:

		canvasContext.translate(0, 64);
		canvasContext.scale(1, -1);
		glyph.render(canvasContext, 64);
		canvasContext.scale(1, -1);
		canvasContext.translate(0, -64);

IMO, it should be done by default while rendering onto canvas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants