Add a function to list tags to the FontTableProvider
trait.
#99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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>
.fn table_tags(&self) -> impl Iterator<Item = u32>
, but that would require return-positionimpl Trait
in trait (RPITIT) syntax that will stabilize in Rust 1.75 next week. Using RPITIT would also prevent theFontTableProvider
trait from being "object safe", which would mean that theDynamicFontTableProvider
would not be able to use adyn FontTableProvider
(it could use an enum over all possible providers though).It could also be useful to have a function directly returning a collection of
(tag, table)
(or animpl Iterator
), so that one wouldn't need to find the table for each tag after listing the tags. CurrentlyWoff2TableProvider
provides theinto_tables(self) -> HashMap<u32, Box<[u8]>>
function, but it's not clear to me whether aHashMap
is the best type for all font providers.