From 35d82ab87290619cd0805a4cad7a25b1473e018b Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Thu, 23 Nov 2023 12:06:04 -0500 Subject: [PATCH] [write-fonts] Add VariationStoreBuilder::is_empty I need this in fea-rs --- write-fonts/src/tables/variations/ivs_builder.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/write-fonts/src/tables/variations/ivs_builder.rs b/write-fonts/src/tables/variations/ivs_builder.rs index 6846d8f9c..0e36e136c 100644 --- a/write-fonts/src/tables/variations/ivs_builder.rs +++ b/write-fonts/src/tables/variations/ivs_builder.rs @@ -74,6 +74,14 @@ impl VariationStoreBuilder { Default::default() } + /// Returns `true` if no deltas have been added to this builder + pub fn is_empty(&self) -> bool { + match &self.delta_sets { + DeltaSetStorage::Direct(val) => val.is_empty(), + DeltaSetStorage::Deduplicated(val) => val.is_empty(), + } + } + /// Create a builder that does not share deltas between entries. /// /// This is used in HVAR, where it is possible to use glyph ids as the