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

[read-fonts] initial codegen for parsing sbix table #609

Merged
merged 2 commits into from
Sep 15, 2023
Merged

[read-fonts] initial codegen for parsing sbix table #609

merged 2 commits into from
Sep 15, 2023

Conversation

dfrg
Copy link
Member

@dfrg dfrg commented Sep 12, 2023

Starting work on bitmap support and figured I'd tackle the low hanging fruit first. This includes basic codegen for parsing sbix along with a tiny helper method to load GlyphData for a given glyph id.

Working towards #593

Starting work on bitmap support and figured I'd tackle the low hanging fruit first. This includes basic codegen for parsing sbix along with a tiny helper method to load `GlyphData` for a given glyph id.

Working towards #593
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

looks good, I think matching the glyf/loca API is the right idea (not that there is another clear alternative, so 🤷)

/// Bit 0: Set to 1.
/// Bit 1: Draw outlines.
/// Bits 2 to 15: reserved (set to 0).
flags: u16,
Copy link
Member

Choose a reason for hiding this comment

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

we might want to define a flags type for this?

Copy link
Member Author

@dfrg dfrg Sep 14, 2023

Choose a reason for hiding this comment

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

Good call. The unnamed bit 0 that must always be set to 1 seems problematic for the codegen flags type. Wdyt about wrapping in a record and implementing default and appropriate methods for the “render outlines bit” instead?

Copy link
Member

Choose a reason for hiding this comment

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

I think an easier option would be to use flags, but use the compile_with annotation to provide a fn that ensures that bit one is always set when writing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, will do!

Copy link
Member Author

Choose a reason for hiding this comment

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

Since I'm adding compile_with, went ahead and extended this for write support. Should be good to go.

@dfrg dfrg merged commit 8207c89 into main Sep 15, 2023
9 checks passed
@dfrg dfrg deleted the sbix branch September 15, 2023 10:14
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.

2 participants