Skip to content

Commit

Permalink
Hack around unsupported glyphs (#618)
Browse files Browse the repository at this point in the history
Currently, if we get a glyph which the current font "doesn't support"
(such as if that font only supports bitmap images, which we don't), then
the entire transforms stream gets misaligned. That leads to some funny
rendering, such as
![Screenshot of the mason example, with misaligned text, some upside
down characters and incorrect looking
layout.](https://github.com/linebender/vello/assets/36049421/87e84446-7959-48db-9744-f3eac5dad3ff)

This PR works around this, by instead of skipping these glyphs,
inserting an empty encoding into their location.
  • Loading branch information
DJMcNab authored Jun 24, 2024
1 parent 886604b commit b716620
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions vello_encoding/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,14 @@ impl Resolver {
};
let glyph_start = self.glyphs.len();
for glyph in glyphs {
let Some((encoding, stream_sizes)) = session.get_or_insert(glyph.id) else {
continue;
};
let (encoding, stream_sizes) =
session.get_or_insert(glyph.id).unwrap_or_else(|| {
// HACK: We pretend that the encoding was empty.
// In theory, we should be able to skip this glyph, but there is also
// a corresponding entry in `resources`, which means that we would
// need to make the patching process skip this glyph.
(Arc::new(Encoding::new()), StreamOffsets::default())
});
run_sizes.add(&stream_sizes);
self.glyphs.push(encoding);
}
Expand Down

0 comments on commit b716620

Please sign in to comment.