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

draw(ctx, x, y, size) broken #257

Open
achmurzy opened this issue Feb 12, 2017 · 5 comments
Open

draw(ctx, x, y, size) broken #257

achmurzy opened this issue Feb 12, 2017 · 5 comments

Comments

@achmurzy
Copy link

It would appear that the 'stroke' field on a path is not transferred when a container Glyph tries to draw it using Glyph.draw() of Glyph.getPath.draw(). Manually accessing the property with Glyph.path.draw() works fine because the 'stroke' field is preserved.

@Jolg42
Copy link
Member

Jolg42 commented Mar 29, 2017

Hi @achmurzy
Could you provide a font / code to replicate that issue?

@fpirsch
Copy link
Collaborator

fpirsch commented Feb 26, 2018

All fonts.
Glyph.prototype.draw() calls Glyph.prototype.getPath() everytime, and a new Path object gets built every time.
The consequence is not only loss of fill & stroke style, but also poor performance when rendering text with multiple occurrences of the same glyph.

@axkibe
Copy link
Contributor

axkibe commented Feb 26, 2018

However, one could argue that caching glyphs is task of the next layer. I don't think opentype (the binary version) caches glyphs either, but that is left to pango. I'm for example caching rendered glyphs up to a certain size in canvases...

@fpirsch
Copy link
Collaborator

fpirsch commented Feb 26, 2018

You're right, so maybe the problem here is to store stroke and fill style in the path object.
Also note that the next layer Font.prototype.draw(ctx, text, ...) doesn't cache paths either.

@Connum
Copy link
Contributor

Connum commented Oct 30, 2023

Related to #509

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

5 participants