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

Font "Escapement" (angle) #4

Open
SheetJSDev opened this issue Mar 1, 2020 · 0 comments
Open

Font "Escapement" (angle) #4

SheetJSDev opened this issue Mar 1, 2020 · 0 comments

Comments

@SheetJSDev
Copy link

This affects rotated text (for example, a vertical axis title in a chart)

The META_CREATEFONTINDIRECT record stores the angle in the Escapement field (https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/dabb1ed6-e5e8-4243-80ed-e63443e5484f). To be more precise, it stores the angle in tenths of a degree.

To support text angle, the following mantra works:

ctx.save();
ctx.translate(x_offset, y_offset);
ctx.rotate(-(escapement / 10) * Math.PI / 180);
ctx.fillText(text, 0, 0);
ctx.translate(-x_offset, -y_offset);
ctx.restore();
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

1 participant