Skip to content

Commit

Permalink
Test for 24 bit bias in IFT format 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
garretrieger committed Sep 19, 2024
1 parent bbf8caf commit ec6c87e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions font-test-data/src/ift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub fn codepoints_only_format2() -> BeBuffer {
[1, 2, 3, 4u32], // compat id

4u8, // default patch encoding
(Uint24::new(3)), // entry count
(Uint24::new(4)), // entry count
{0u32: "entries_offset"},
0u32, // entry string data offset

Expand All @@ -202,7 +202,12 @@ pub fn codepoints_only_format2() -> BeBuffer {
// Entry id = 3
0b00100000u8, // format = CODEPOINT_BIT_2
5u16, // bias
[0b00001101, 0b00000011, 0b00110001u8] // codepoints = [5..22]
[0b00001101, 0b00000011, 0b00110001u8], // codepoints = [5..22]

// Entry id = 4
0b00110000u8, // format = CODEPOINT_BIT_1 | CODEPOINT_BIT_2
(Uint24::new(80_000)), // bias
[0b00001101, 0b00000011, 0b00110001u8] // codepoints = [80_005..80_022]
};

let offset = buffer.offset_for("entries") as u32;
Expand Down
4 changes: 2 additions & 2 deletions skrifa/src/patchmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,9 @@ mod tests {
test_intersection(&font, [0x02], [], [1]);
test_intersection(&font, [0x15], [], [3]);
test_intersection(&font, [0x07], [], [1, 3]);
test_intersection(&font, [80_007], [], [4]);

test_intersection_with_all(&font, [], [1, 3]);
test_intersection_with_all(&font, [], [1, 3, 4]);
}

#[test]
Expand Down Expand Up @@ -1415,7 +1416,6 @@ mod tests {
}

// TODO(garretrieger): test decoding of other entry features for format 2
// - 24 bit bias.
// - no codepoints
// - ignored entries can still be copied
}

0 comments on commit ec6c87e

Please sign in to comment.