Skip to content

Skip reversing the first point in each contour in FT_Outline_Reverse

Fix for issue: #1207 (closed)

Context

I'm currently running into an issue where FT_Outline_Decompose fails after FT_Outline_Reverse is run first. SF Mono is an example font where I can reproduce this issue for some glyphs.

For context, the reason I would like to call FT_Outline_Reverse on postscript glyph outlines to try to guarantee that all glyph paths I'm loading have a uniform orientation. This allows for additional paths to be appended to these outlines (for example, a rectangle path for a strikethrough) without running into winding number bugs based on the glyph orientation.

If I call FT_Outline_Reverse and then FT_Outline_Decompose on SF Mono, I hit this condition https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/src/base/ftoutln.c#L106 and the decompose fails because the path starts with a cubic control point (since the original path ended with a cubic control point, and then I reversed it)

Fix

This PR fixes the issue by skipping reversal for the first point in each contour. This guarantees that we don't output an outline that starts with a cubic control point, as long as the input outline doesn't start with a cubic control point.

Merge request reports