Skip to content

Commit

Permalink
Merge pull request #285 from jfkthame/filter-range-warning
Browse files Browse the repository at this point in the history
Warn rather than fail if min/max of a condition table range are reversed
  • Loading branch information
khaledhosny authored Oct 2, 2024
2 parents cf38b5d + 2f38c58 commit 874862a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/layout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1145,13 +1145,17 @@ bool ParseConditionTable(const ots::Font *font,
return OTS_FAILURE_MSG("Axis index out of range in condition");
}

// Check min/max values are within range -1.0 .. 1.0 and properly ordered
// Check min/max values are within range -1.0 .. 1.0.
if (filter_range_min_value < -0x4000 || // -1.0 in F2DOT14 format
filter_range_max_value > 0x4000 || // +1.0 in F2DOT14 format
filter_range_min_value > filter_range_max_value) {
filter_range_max_value > 0x4000) { // +1.0 in F2DOT14 format
return OTS_FAILURE_MSG("Invalid filter range in condition");
}

// Warn if range is improperly ordered (and therefore useless).
if (filter_range_min_value > filter_range_max_value) {
OTS_WARNING("Misordered filter range in condition table");
}

return true;
}

Expand Down

0 comments on commit 874862a

Please sign in to comment.