Skip to content

Commit

Permalink
Fix pluralization of 'patch' in codegen.
Browse files Browse the repository at this point in the history
  • Loading branch information
garretrieger committed Oct 4, 2024
1 parent f947f8a commit 0b41aca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions font-codegen/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,8 @@ pub(crate) fn remove_offset_from_field_name(name: &str) -> Cow<str> {
// as we encounter actual tables, instead of trying to be systematic
let suffix = if temp.ends_with("attach") {
"es"
} else if temp.ends_with("patch") {
"es"
} else if temp.ends_with("data") {
""
} else {
Expand Down
2 changes: 1 addition & 1 deletion read-fonts/generated/generated_ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ impl<'a> TableKeyedPatch<'a> {
}

/// A dynamically resolving wrapper for [`patch_offsets`][Self::patch_offsets].
pub fn patchs(&self) -> ArrayOfOffsets<'a, TablePatch<'a>, Offset32> {
pub fn patches(&self) -> ArrayOfOffsets<'a, TablePatch<'a>, Offset32> {
let data = self.data;
let offsets = self.patch_offsets();
ArrayOfOffsets::new(offsets, data, ())
Expand Down
2 changes: 1 addition & 1 deletion skrifa/src/font_patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'a> FontPatch for TableKeyedPatch<'a> {
let i = i as usize;
let next = i + 1;

let table_patch = self.patchs().get(i)?;
let table_patch = self.patches().get(i)?;
let (Some(offset), Some(next_offset)) =
(self.patch_offsets().get(i), self.patch_offsets().get(next))
else {
Expand Down
14 changes: 7 additions & 7 deletions write-fonts/generated/generated_ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ pub struct TableKeyedPatch {
/// Unique ID that identifies compatible patches.
pub compatibility_id: Vec<u32>,
pub patches_count: u16,
pub patchs: Vec<OffsetMarker<TablePatch, WIDTH_32>>,
pub patches: Vec<OffsetMarker<TablePatch, WIDTH_32>>,
}

impl TableKeyedPatch {
Expand All @@ -870,13 +870,13 @@ impl TableKeyedPatch {
format: Tag,
compatibility_id: Vec<u32>,
patches_count: u16,
patchs: Vec<TablePatch>,
patches: Vec<TablePatch>,
) -> Self {
Self {
format,
compatibility_id: compatibility_id.into_iter().map(Into::into).collect(),
patches_count,
patchs: patchs.into_iter().map(Into::into).collect(),
patches: patches.into_iter().map(Into::into).collect(),
}
}
}
Expand All @@ -888,7 +888,7 @@ impl FontWrite for TableKeyedPatch {
(0 as u32).write_into(writer);
self.compatibility_id.write_into(writer);
self.patches_count.write_into(writer);
self.patchs.write_into(writer);
self.patches.write_into(writer);
}
fn table_type(&self) -> TableType {
TableType::Named("TableKeyedPatch")
Expand All @@ -898,8 +898,8 @@ impl FontWrite for TableKeyedPatch {
impl Validate for TableKeyedPatch {
fn validate_impl(&self, ctx: &mut ValidationCtx) {
ctx.in_table("TableKeyedPatch", |ctx| {
ctx.in_field("patchs", |ctx| {
self.patchs.validate_impl(ctx);
ctx.in_field("patches", |ctx| {
self.patches.validate_impl(ctx);
});
})
}
Expand All @@ -912,7 +912,7 @@ impl<'a> FromObjRef<read_fonts::tables::ift::TableKeyedPatch<'a>> for TableKeyed
format: obj.format(),
compatibility_id: obj.compatibility_id().to_owned_obj(offset_data),
patches_count: obj.patches_count(),
patchs: obj.patchs().to_owned_table(),
patches: obj.patches().to_owned_table(),
}
}
}
Expand Down

0 comments on commit 0b41aca

Please sign in to comment.