Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse font face shape so winding is CLOCKWISE #373

Closed
wants to merge 1 commit into from

Conversation

hamoid
Copy link
Member

@hamoid hamoid commented Jun 19, 2023

This tries to fix the issue presented at https://openrndr.discourse.group/t/converting-font-characters-to-contours/576/2

I searched and it seems like the affected .shape() method is not called anywhere in openrndr or orx, so I don't expect side effects.

Without this change it seems like the outer contour is COUNTER_CLOCKWISE and the inner one is CLOCKWISE.

@hamoid
Copy link
Member Author

hamoid commented Jun 19, 2023

Can the winding depend on the font used?

@edwinRNDR
Copy link
Member

Can the winding depend on the font used?

I have no idea if winding order is even specified for fonts. Should look that up

@hamoid
Copy link
Member Author

hamoid commented Jun 20, 2023

https://stackoverflow.com/questions/65765644/how-to-tell-if-the-paths-in-a-font-are-clockwise-or-counterclockwise

https://groups.google.com/g/comp.fonts/c/jysddVs06XM

lately I have been running across fonts whose outermost contours are
Counter-Clockwise

So maybe we need to check the winding and reverse it if needed to make it predictable?

@hamoid
Copy link
Member Author

hamoid commented Jun 21, 2023

What about

        return if(shapeContours.first().winding == Winding.COUNTER_CLOCKWISE)
            Shape(shapeContours.map { it.reversed.close() })
        else
            Shape(shapeContours.close())

?

@hamoid hamoid closed this Jul 20, 2023
@hamoid hamoid deleted the reverseFontFaceShape branch July 20, 2023 13:25
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.

None yet

2 participants