Skip to content

Commit

Permalink
Don’t crash if there isn’t a GDEF table
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Sep 19, 2024
1 parent 195a4ab commit 81d8a2d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ttj/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub(crate) struct SerializationContext<'a> {

impl<'a> SerializationContext<'a> {
pub fn new(font: &'a FontRef<'a>, names: NameMap) -> Result<Self, ReadError> {
let (gdef_regions, gdef_locations) = if let Some(Ok(ivs)) = font.gdef()?.item_var_store() {
let (gdef_regions, gdef_locations) = if let Ok(Some(ivs)) = font
.gdef()
.and_then(|gdef| gdef.item_var_store().transpose())
{
let regions = ivs.variation_region_list()?.variation_regions();

// Find all the peaks
Expand Down

0 comments on commit 81d8a2d

Please sign in to comment.