Skip to content

GlyphInfo and GlyphPosition should support value equality #11

Description

@hasanzakeri

Both types are frozen #[pyclass] value objects with #[pyo3(get)] fields, but two instances with identical fields compare by Python identity, not by value:

a, b = font.shape(buf1).glyph_infos[0], font.shape(buf2).glyph_infos[0]
# Same glyph_id/cluster/flags, but a == b is False

This is awkward in tests that want to assert infos == [GlyphInfo(...), ...].

Fix: add eq to the #[pyclass] attrs in src/glyph.rs:12,53 and derive PartialEq, Eq (Eq fine since all fields are Copy + Eq for GlyphInfo; GlyphPosition is i32 fields, also Eq).

Hashability is a separate question — defer until someone asks; equality is a clear win.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions