Skip to content

[feaLib] raise FeatureLibError for a STAT axis location with no or to… - #4268

Merged
anthrotype merged 1 commit into
fonttools:mainfrom
RavSinghChandan:fealib-stat-location-value-count
Oct 9, 2026
Merged

anthrotype merged 1 commit into
fonttools:mainfrom
RavSinghChandan:fealib-stat-location-value-count

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

A STAT location takes 1, 2 or 3 values (Axis Value formats 1, 3 and 2). With 4 values, as in

AxisValue { location wght 100 200 300 400; name "Regular"; };

or with none (location wght;), the parser accepted it, Builder.buildSTAT skipped the record because no format matched, and the build then failed in otlLib.builder._buildAxisRecords with a bare KeyError: 'name' and no line number.

parse_STAT_location now raises a FeatureLibError at the location: "Expected 1, 2 or 3 values for axis wght, but 4 were found." Added two parser tests next to test_stat_axis_value_format2_bad_range.

…o many values

A location takes 1, 2 or 3 values (Axis Value formats 1, 3 and 2). With 0 or
4+ the parser accepted it, the builder skipped the record, and the build then
failed in otlLib with a bare KeyError: 'name'.
@anthrotype
anthrotype merged commit 97dace2 into fonttools:main Oct 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants