Function ttf_parser::tables::gvar::infer_deltas
source · fn infer_deltas(
tuple: &VariationTuple<'_>,
points_set: SetPointsIter<'_>,
points: GlyphPointsIter<'_>,
all_points: GlyphPointsIter<'_>,
curr_point: GlyphPoint,
) -> (f32, f32)
Expand description
Infer unreferenced deltas.
A font can define deltas only for specific points, to reduce the file size. In this case, we have to infer undefined/unreferenced deltas manually, depending on the context.
This is already a pretty complex task, since deltas should be resolved only inside the current contour (do not confuse with component). And during resolving we can actually wrap around the contour. So if there is no deltas after the current one, we have to use the first delta of the current contour instead. Same goes for the previous delta. If there are no deltas before the current one, we have to use the last one in the current contour.
And in case of ttf-parser
everything is becoming even more complex,
since we don’t actually have a list of points and deltas, only iterators.
Because of ttf-parser
’s allocation free policy.
Which makes the code even more complicated.
https://docs.microsoft.com/en-us/typography/opentype/spec/gvar#inferred-deltas-for-un-referenced-point-numbers