googlefonts / googlefonts/fontations
It's not obvious which FontData to give
- Dominant language
- Rust
- Stars
- 826
- Forks
- 75
- Avg merge
- 22h 33m
- Merged PRs (30d)
- 75
Description
Suppose you want to loop over your base anchors to see their coordinates. It's a bit more indirect than you'd hoped but np. And then you hit this:
```rust
read_fonts::tables::gpos::BaseRecord
pub fn base_anchors(&self, data: FontData<'a>) -> ArrayOfNullableOffsets<'a, AnchorTable<'a>, Offset16>
```
Great, which FontData does it want? Pity it's not apparent from type but that's OK, the comment will help right?
```rust
/// A dynamically resolving wrapper for [`base_anchor_offsets`][Self::base_anchor_offsets].
pub fn base_anchors(
&self,
data: FontData<'a>,
) -> ArrayOfNullableOffsets<'a, AnchorTable<'a>, Offset16> {
let offsets = self.base_anchor_offsets();
ArrayOfNullableOffsets::new(offsets, data, ())
}
```
To be fair you can tell the answer from the spec but it's a bit tiresome. It would be nice to make it easier. At the very least add comments to these methods that say where to get the correct FontData. Bonus points for having types so you can't pass the wrong one without making an effort.
For context see https://github.com/googlefonts/fontc/pull/492 GPOS tests such as compile_basic_gpos_mark_base.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with read_fonts::tables::gpos::BaseRecord::base_anchors and base_anchor_offsets, then inspect the compile_basic_gpos_mark_base GPOS test and the linked PR for usage context. Clarify which FontData each method expects, document that guidance or improve the types, and update the relevant tests to show the intended usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100