Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen] derive Clone for format tables #699

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions font-codegen/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ pub(crate) fn generate_format_group(item: &TableFormat) -> syn::Result<TokenStre

Ok(quote! {
#( #docs )*
#[derive(Clone)]
pub enum #name<'a> {
#( #variants ),*
}
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ impl<'a> SomeRecord<'a> for FeatMinMaxRecord {
}
}

#[derive(Clone)]
pub enum BaseCoord<'a> {
Format1(BaseCoordFormat1<'a>),
Format2(BaseCoordFormat2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ impl<'a> std::fmt::Debug for IndexSubtableArray<'a> {
}

/// [IndexSubtables](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtables) format type.
#[derive(Clone)]
pub enum IndexSubtable<'a> {
Format1(IndexSubtable1<'a>),
Format2(IndexSubtable2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_cmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ impl<'a> From<PlatformId> for FieldType<'a> {
}

/// The different cmap subtable formats.
#[derive(Clone)]
pub enum CmapSubtable<'a> {
Format0(Cmap0<'a>),
Format2(Cmap2<'a>),
Expand Down
2 changes: 2 additions & 0 deletions read-fonts/generated/generated_colr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ impl<'a> SomeRecord<'a> for Clip {
}

/// [ClipBox](https://learn.microsoft.com/en-us/typography/opentype/spec/colr#baseglyphlist-layerlist-and-cliplist) table
#[derive(Clone)]
pub enum ClipBox<'a> {
Format1(ClipBoxFormat1<'a>),
Format2(ClipBoxFormat2<'a>),
Expand Down Expand Up @@ -1488,6 +1489,7 @@ impl<'a> From<Extend> for FieldType<'a> {
}

/// [Paint](https://learn.microsoft.com/en-us/typography/opentype/spec/colr#paint-tables) tables
#[derive(Clone)]
pub enum Paint<'a> {
ColrLayers(PaintColrLayers<'a>),
Solid(PaintSolid<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_gdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ impl<'a> std::fmt::Debug for LigGlyph<'a> {
}

/// [Caret Value Tables](https://docs.microsoft.com/en-us/typography/opentype/spec/gdef#caret-value-tables)
#[derive(Clone)]
pub enum CaretValue<'a> {
Format1(CaretValueFormat1<'a>),
Format2(CaretValueFormat2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_glyf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ impl<'a> From<CompositeGlyphFlags> for FieldType<'a> {
}

/// Simple or composite glyph.
#[derive(Clone)]
pub enum Glyph<'a> {
Simple(SimpleGlyph<'a>),
Composite(CompositeGlyph<'a>),
Expand Down
3 changes: 3 additions & 0 deletions read-fonts/generated/generated_gpos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ impl<'a> From<ValueFormat> for FieldType<'a> {

/// [Anchor Tables](https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#anchor-tables)
/// position one glyph with respect to another.
#[derive(Clone)]
pub enum AnchorTable<'a> {
Format1(AnchorFormat1<'a>),
Format2(AnchorFormat2<'a>),
Expand Down Expand Up @@ -1047,6 +1048,7 @@ impl<'a> SomeRecord<'a> for MarkRecord {
}

/// [Lookup Type 1](https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-1-single-adjustment-positioning-subtable): Single Adjustment Positioning Subtable
#[derive(Clone)]
pub enum SinglePos<'a> {
Format1(SinglePosFormat1<'a>),
Format2(SinglePosFormat2<'a>),
Expand Down Expand Up @@ -1330,6 +1332,7 @@ impl<'a> std::fmt::Debug for SinglePosFormat2<'a> {
}

/// [Lookup Type 1](https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-1-single-adjustment-positioning-subtable): Single Adjustment Positioning Subtable
#[derive(Clone)]
pub enum PairPos<'a> {
Format1(PairPosFormat1<'a>),
Format2(PairPosFormat2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_gsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ impl<'a> std::fmt::Debug for SubstitutionLookup<'a> {
}

/// LookupType 1: [Single Substitution](https://learn.microsoft.com/en-us/typography/opentype/spec/gsub#lookuptype-1-single-substitution-subtable) Subtable
#[derive(Clone)]
pub enum SingleSubst<'a> {
Format1(SingleSubstFormat1<'a>),
Format2(SingleSubstFormat2<'a>),
Expand Down
5 changes: 5 additions & 0 deletions read-fonts/generated/generated_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ impl<'a> SomeRecord<'a> for RangeRecord {
}

/// [Coverage Table](https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table)
#[derive(Clone)]
pub enum CoverageTable<'a> {
Format1(CoverageFormat1<'a>),
Format2(CoverageFormat2<'a>),
Expand Down Expand Up @@ -1438,6 +1439,7 @@ impl<'a> SomeRecord<'a> for ClassRangeRecord {
}

/// A [Class Definition Table](https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#class-definition-table)
#[derive(Clone)]
pub enum ClassDef<'a> {
Format1(ClassDefFormat1<'a>),
Format2(ClassDefFormat2<'a>),
Expand Down Expand Up @@ -2343,6 +2345,7 @@ impl<'a> std::fmt::Debug for SequenceContextFormat3<'a> {
}
}

#[derive(Clone)]
pub enum SequenceContext<'a> {
Format1(SequenceContextFormat1<'a>),
Format2(SequenceContextFormat2<'a>),
Expand Down Expand Up @@ -3485,6 +3488,7 @@ impl<'a> std::fmt::Debug for ChainedSequenceContextFormat3<'a> {
}
}

#[derive(Clone)]
pub enum ChainedSequenceContext<'a> {
Format1(ChainedSequenceContextFormat1<'a>),
Format2(ChainedSequenceContextFormat2<'a>),
Expand Down Expand Up @@ -3760,6 +3764,7 @@ impl<'a> std::fmt::Debug for VariationIndex<'a> {
}

/// Either a [Device] table (in a non-variable font) or a [VariationIndex] table (in a variable font)
#[derive(Clone)]
pub enum DeviceOrVariationIndex<'a> {
Device(Device<'a>),
VariationIndex(VariationIndex<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_postscript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl<'a> std::fmt::Debug for Index2<'a> {
}

/// Associates a glyph identifier with a Font DICT.
#[derive(Clone)]
pub enum FdSelect<'a> {
Format0(FdSelectFormat0<'a>),
Format3(FdSelectFormat3<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ impl<'a> std::fmt::Debug for AxisValueArray<'a> {
}

/// [Axis Value Tables](https://docs.microsoft.com/en-us/typography/opentype/spec/stat#axis-value-tables)
#[derive(Clone)]
pub enum AxisValue<'a> {
Format1(AxisValueFormat1<'a>),
Format2(AxisValueFormat2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_test_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl<'a> std::fmt::Debug for Table3<'a> {
}
}

#[derive(Clone)]
pub enum MyTable<'a> {
Format1(Table1<'a>),
MyFormat22(Table2<'a>),
Expand Down
1 change: 1 addition & 0 deletions read-fonts/generated/generated_variations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ impl<'a> std::fmt::Debug for DeltaSetIndexMapFormat1<'a> {
}

/// The [DeltaSetIndexMap](https://learn.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#associating-target-items-to-variation-data) table
#[derive(Clone)]
pub enum DeltaSetIndexMap<'a> {
Format0(DeltaSetIndexMapFormat0<'a>),
Format1(DeltaSetIndexMapFormat1<'a>),
Expand Down
Loading