-
Notifications
You must be signed in to change notification settings - Fork 12
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
how to measure the text #6
Comments
Vg is a low-level rendering API with multiple rendering backends and a glyph API. Measuring text means transforming text to sequences of positioned glyphs and is not in the scope of Vg. This should be delegated to another module (e.g. an OpenType layout engine, think pango or harfbuzz). If you are not dealing with complex scripts and want to remain backend independent you can however use Otfm to access a font's metrics and do a toy text layout engine with kerning, see for example this example in Vg's distribution. It was part of Vz's plans to provide such a toy text engine as a temporary solution since measuring text is indeed needed for label placement. One additional problem is that the canvas only provides a text api and no glyph api (see the canvas backend docs). This means that in the canvas we have access to the powerful browser text layout engine but this is something we don't have for example in the PDF backend where you have to layout the glyphs by yourself. So there could be the problem of discrepancy between the way you measure text and the way the browser measures text and the discrepancy between the layout you do for PDF and the layout the canvas does for you. Now if you are dealing only with the Canvas backend. You can use the I'm closing since it's not in scope of Vg but feel free to continue the discussion or ask any further question. |
Just to remember @talex5 remark on the mirage list
The text was updated successfully, but these errors were encountered: