yeslogic / allsorts

Font parser, shaping engine, and subsetter implemented in Rust
https://yeslogic.com/blog/allsorts-rust-font-shaping-engine/
Apache License 2.0
706 stars 23 forks source link

Add a function to list tags to the `FontTableProvider` trait. #99

Closed gendx closed 6 months ago

gendx commented 6 months ago

Until now, the FontTableProvider only allowed to find the table for a specific tag. This adds a function to list all the tags present in the font.

The proposed API is fn table_tags(&self) -> Vec<u32>.

It could also be useful to have a function directly returning a collection of (tag, table) (or an impl Iterator), so that one wouldn't need to find the table for each tag after listing the tags. Currently Woff2TableProvider provides the into_tables(self) -> HashMap<u32, Box<[u8]>> function, but it's not clear to me whether a HashMap is the best type for all font providers.

wezm commented 6 months ago

Thanks for this. However, I have made the same change in some unreleased work to add some preliminary variable fonts support. That should be done early in the new year. I'll close this PR for now.