Skip to content

Conversation

@benoitkugler
Copy link
Contributor

@benoitkugler benoitkugler commented Jun 23, 2025

This is a first step towards support for the COLR/CPAL tables.

We expose a new GlyphColor type returned by Face.GlyphData. With this API, a renderer may now load the layers defining a colored glyph and combine them. This could be implemented for instance in go-text/render.

This PR is probably not enough to support variable fonts, but starting with non variable ones should already be pretty nice.

Copy link
Member

@whereswaldon whereswaldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together @benoitkugler! I think it looks reasonable, though I lack your deep expertise in the internals of opentype. My only real question is whether we need so many implementations of binary search? Not a huge deal though. Great work!

@benoitkugler
Copy link
Contributor Author

Thanks for putting this together @benoitkugler! I think it looks reasonable, though I lack your deep expertise in the internals of opentype. My only real question is whether we need so many implementations of binary search? Not a huge deal though. Great work!

I'm not a big fan of the sort.Search API, but I guess it is OK as a temporary solution until we can use go 1.21 and slices.BinarySearchFunc

Copy link
Contributor

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took so long. I agree the search could be cleaner - but also that having it this way until base version increases to 1.21 makes sense.

I'm hoping to bump Fyne version to there soon (months though, not days)...

}

func TestLoadColor(t *testing.T) {
ld := readFontFile(t, "color/NotoColorEmoji-Regular.ttf")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see those files in this PR or the repo before the PR - apologies if I am missing something obvious.
But given that I cannot understand how the tests are passing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are loading the test files from the typesetting-utils module, so that typesetting remains lightweight.

@benoitkugler benoitkugler merged commit b5d89ff into main Aug 5, 2025
14 checks passed
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.

4 participants