Skip to content

Commit

Permalink
Fix bug in .ttc handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Jun 2, 2024
1 parent 50a5b9e commit 8a2f02d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ fn parse(data: &[u8], index: u32) -> Result<Face<'_>> {
let mut r = Reader::new(data);
let mut kind = r.read::<FontKind>().ok_or(UnknownKind)?;

// TODO: Add a test font for ttc.

// Parse font collection header if necessary.
if kind == FontKind::Collection {
let mut r = Reader::new_at(data, 12 + 4 * (index as usize));
r = Reader::new_at(data, 12 + 4 * (index as usize));
let offset = r.read::<u32>().ok_or(MalformedFont)?;
let subdata = data.get(offset as usize..).ok_or(MalformedFont)?;
r = Reader::new(subdata);
Expand Down

0 comments on commit 8a2f02d

Please sign in to comment.