Skip to content

Commit

Permalink
[IFT] update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
garretrieger committed Oct 11, 2024
1 parent c3d5458 commit a3b74ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion font-test-data/src/ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ pub fn test_font_for_patching() -> Vec<u8> {
font_builder.add_table(&head).unwrap();

// ## glyf ##
// glyphs are padded to even number of bytes since loca format wil be short.
// glyphs are padded to even number of bytes since loca format will be short.
let glyf = BeBuffer::new()
.push_with_tag(1u8, "gid_0")
.extend([2, 3, 4, 5u8, 0u8])
Expand Down
2 changes: 0 additions & 2 deletions incremental-font-transfer/src/font_patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ use std::collections::BTreeSet;

use write_fonts::FontBuilder;

// TODO(garretrieger): support applying multiple glyph keyed patches in a single operation at the top level API.

/// An incremental font patch which can be used to extend a font.
///
/// See: <https://w3c.github.io/IFT/Overview.html#font-patch-formats>
Expand Down
15 changes: 9 additions & 6 deletions incremental-font-transfer/src/glyph_keyed.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
//! TODO write me.

/// Implementation of Glyph Keyed patch application.
///
/// Glyph Keyed patches are a type of incremental font patch which stores opaque data blobs
/// keyed by glyph id. Patch application places the data blobs into the appropriate place
/// in the base font based on the associated glyph id.
///
/// Glyph Keyed patches are specified here:
/// <https://w3c.github.io/IFT/Overview.html#glyph-keyed>
use crate::font_patch::copy_unprocessed_tables;
use crate::font_patch::PatchingError;

Expand Down Expand Up @@ -314,9 +320,6 @@ fn synthesize_glyf_and_loca<OffsetType: LocaOffset + TryFrom<usize>>(
Ok(())
}

// TODO: Idea - can we actually construct the new glyf table on the fly during the brotli decompression process?
// ie. eliminate the intermediate buffer that stores GlyphPatches?

fn patch_glyf_and_loca<'a>(
glyph_patches: &'a [GlyphPatches<'a>],
glyf: &[u8],
Expand All @@ -331,7 +334,7 @@ fn patch_glyf_and_loca<'a>(
Loca::Long(_) => false,
};

// Step 0: merge the invidual patches into a list of replacement data for gid.
// Step 0: merge the individual patches into a list of replacement data for gid.
// TODO(garretrieger): special case where gids is empty, just returned umodified copy of glyf + loca?
let (gids, replacement_data) =
dedup_gid_replacement_data(glyph_patches.iter(), Tag::new(b"glyf"))
Expand Down

0 comments on commit a3b74ec

Please sign in to comment.