Skip to content

glifo: Simplify COLR glyph handling#1605

Open
LaurenzV wants to merge 1 commit intomainfrom
laurenz/colr_simplify
Open

glifo: Simplify COLR glyph handling#1605
LaurenzV wants to merge 1 commit intomainfrom
laurenz/colr_simplify

Conversation

@LaurenzV
Copy link
Copy Markdown
Collaborator

Initially, in Vello CPU, any COLR glyph would first be rendered into an intermediate pixmap and that pixmap would then be rendered into the surface. Because of this, in case there was a skewing factor in the glyph, instead of just rasterizing the glyph at its normal font size, we would apply an additional scaling factor such that it would be rasterized at a higher solution, avoiding aliasing artifacts that arise from the skewing.

However, since the most recent changes, things are different: By default, glyphs are always directly rendered into a surface. Glyphs are only cached if they don't have any skewing factor (if in the future we decide that we also want glyph caching for rotated glyphs, we can easily just fold this into the font size again). Therefore, this additional scaling procedure becomes unnecessary. By doing so, the code becomes a easier to understand (in my opinion).

As a nice side effect, this PR also fixes a discrepancy between cached and non-cached rendering that existed previously:

rec.mp4

As you can see, previously (on the left) cached and non-cached glyphs would have slightly different positions. Now, they seem to have the same position. I must confess I don't fully understand why this was the case, but the tests don't lie! 😄

@nicoburns
Copy link
Copy Markdown
Contributor

Does this apply to regular skewed glyphs? I imagine skewed COLR glyphs are pretty uncommon. But skewed regular glyphs for "fake italic" would be significantly more common.

@LaurenzV
Copy link
Copy Markdown
Collaborator Author

Nope, it only applies for cached glyphs. And caching i never applied if a glyph is skewed.

@LaurenzV LaurenzV requested a review from grebmeg April 29, 2026 12:30
@laurenz-canva laurenz-canva deleted the laurenz/colr_simplify branch April 30, 2026 09:07
@LaurenzV LaurenzV restored the laurenz/colr_simplify branch April 30, 2026 09:13
@LaurenzV
Copy link
Copy Markdown
Collaborator Author

Sorry, that was an accident 😅

@LaurenzV LaurenzV reopened this Apr 30, 2026
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

Successfully merging this pull request may close these issues.

3 participants