Skip to content

Query about LazyOffsetArray16 iterator #211

Closed

Description

@asibahi

Hello.

This is not an issue. Just a question about the library. I am hoping @RazrFalcon would help.

As far as I understand the type and the library, the iterator for LazyOffsetArray16is not fused, and can be called multiple times even after the the first None. Yet the usages I have come across in rustybuzz don't do that.

My question is why the data is structured that way. Why is the inner array a LazyArray of optional offsets if the iterator is supposed at the first null found and that's it.

in other words why is the offsets array a LazyArray16(Option<Offset16>) and not LazyArray16(Offset16) ?

Activity

  1. RazrFalcon commented on Jan 13, 2026

    @RazrFalcon
    Collaborator

    Hi! I wrote this code like 5-6 years ago, so I would not be able to provide much more info that already mentioned in the comments.

    Reading the code I do see that it breaks the Rust Iterator convention. Not sure how bad it is. As long as the caller expects this - it's fine, but it should probably return Option<Option<Self::Item>>.
    You can try fixing it. Not sure how much changed to rustybuzz it would require.

    As for the TrueType itself, it does explicitly states that some offsets can be NULL/0:

    Array of offsets to SequenceRuleSet tables, from beginning of SequenceContextFormat1 table (offsets may be NULL).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions