Skip to content

Commit

Permalink
move nullable attribute to where it belongs
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Nov 21, 2023
1 parent 932d3f0 commit c3e0e6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions read-fonts/generated/generated_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ impl<'a> Stat<'a> {
/// start of the design axes value offsets array. If axisValueCount
/// is zero, set to zero; if axisValueCount is greater than zero,
/// must be greater than zero.
pub fn offset_to_axis_value_offsets(&self) -> Offset32 {
pub fn offset_to_axis_value_offsets(&self) -> Nullable<Offset32> {
let range = self.shape.offset_to_axis_value_offsets_byte_range();
self.data.read_at(range.start).unwrap()
}

/// Attempt to resolve [`offset_to_axis_value_offsets`][Self::offset_to_axis_value_offsets].
pub fn offset_to_axis_values(&self) -> Result<AxisValueArray<'a>, ReadError> {
pub fn offset_to_axis_values(&self) -> Option<Result<AxisValueArray<'a>, ReadError>> {
let data = self.data;
let args = self.axis_value_count();
self.offset_to_axis_value_offsets()
Expand Down
4 changes: 2 additions & 2 deletions resources/codegen_inputs/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ table Stat {
#[read_offset_with($design_axis_count)]
design_axes_offset: Offset32<[AxisRecord]>,
/// The number of axis value tables.
#[nullable]
#[compile(array_len($offset_to_axis_value_offsets))]
axis_value_count: u16,
/// Offset in bytes from the beginning of the STAT table to the
/// start of the design axes value offsets array. If axisValueCount
/// is zero, set to zero; if axisValueCount is greater than zero,
/// must be greater than zero.
#[nullable]
#[read_offset_with($axis_value_count)]
#[compile_type(OffsetMarker<Vec<OffsetMarker<AxisValue>>, WIDTH_32>)]
#[compile_type(NullableOffsetMarker<Vec<OffsetMarker<AxisValue>>, WIDTH_32>)]
#[to_owned(convert_axis_value_offsets(obj.offset_to_axis_values()))]
offset_to_axis_value_offsets: Offset32<AxisValueArray>,
/// Name ID used as fallback when projection of names into a
Expand Down

0 comments on commit c3e0e6d

Please sign in to comment.