Skip to content

Commit

Permalink
[IFT] in font_patch.rs add public method comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
garretrieger committed Oct 4, 2024
1 parent 6826ca9 commit 72281f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions read-fonts/generated/generated_ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ impl<'a> std::fmt::Debug for IdStringData<'a> {
}
}

/// [Per Table Brotli Patch](https://w3c.github.io/IFT/Overview.html#per-table-brotli)
/// [Table Keyed Patch](https://w3c.github.io/IFT/Overview.html#table-keyed)
#[derive(Debug, Clone, Copy)]
#[doc(hidden)]
pub struct TableKeyedPatchMarker {
Expand Down Expand Up @@ -1692,7 +1692,7 @@ impl<'a> FontRead<'a> for TableKeyedPatch<'a> {
}
}

/// [Per Table Brotli Patch](https://w3c.github.io/IFT/Overview.html#per-table-brotli)
/// [Table Keyed Patch](https://w3c.github.io/IFT/Overview.html#table-keyed)
pub type TableKeyedPatch<'a> = TableRef<'a, TableKeyedPatchMarker>;

impl<'a> TableKeyedPatch<'a> {
Expand Down
11 changes: 11 additions & 0 deletions skrifa/src/font_patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ use std::collections::BTreeSet;
use write_fonts::FontBuilder;

pub trait IncrementalFontPatchBase {
/// Apply an incremental font patch (<https://w3c.github.io/IFT/Overview.html#font-patch-formats>)
///
/// Applies the patch to this base. In the base the patch is associated with the supplied
/// compatibility_id and has the specified encoding.
///
/// Returns the byte data for the new font produced as a result of the patch application.
fn apply_patch(
&self,
compatibility_id: &[u32; 4],
Expand All @@ -31,6 +37,11 @@ pub trait IncrementalFontPatchBase {
}

pub trait IncrementalFontPatch {
/// Applies this patch to the given font.
///
/// In the font this patch is associated with the supplied compatibility_id.
///
/// Returns the byte data for the new font produced as a result of the patch application.
fn apply(&self, font: &FontRef, compatibility_id: &[u32; 4]) -> Result<Vec<u8>, ReadError>;
}

Expand Down
2 changes: 1 addition & 1 deletion write-fonts/generated/generated_ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ impl<'a> FontRead<'a> for IdStringData {
}
}

/// [Per Table Brotli Patch](https://w3c.github.io/IFT/Overview.html#per-table-brotli)
/// [Table Keyed Patch](https://w3c.github.io/IFT/Overview.html#table-keyed)
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TableKeyedPatch {
Expand Down

0 comments on commit 72281f6

Please sign in to comment.