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

non-default text & knockout text renders incorrectly #50

Open
mmalex opened this issue Oct 24, 2023 · 3 comments
Open

non-default text & knockout text renders incorrectly #50

mmalex opened this issue Oct 24, 2023 · 3 comments
Labels
bug Something isn't working rendering An issue with rendering items

Comments

@mmalex
Copy link

mmalex commented Oct 24, 2023

hi! I've noticed that knockout text (reverse video) and fancy fonts (georgia on the mac, in this case) don't render correctly.
it looks like the inside/outside rules are wrong.
https://github.com/plinkysynth/scratch_stuff/blob/main/hellokicanvas.kicad_pcb (I tried to make a direct kicanvas link but its not loading?! it loads locally tho)

how it looks in browser

how it looks in kicad

I've also created a more minimal file consisting of the board outline and a single letter 'o' in georgia font, if that's helpful for a simpler repro.
https://github.com/plinkysynth/scratch_stuff/blob/main/minimal.kicad_pcb

sorry if this is a dup, I couldn't see one!

@mmalex mmalex added bug Something isn't working rendering An issue with rendering items labels Oct 24, 2023
@mmalex
Copy link
Author

mmalex commented Oct 24, 2023

(sorry I forgot to say - repros on chrome, firefox and safari mac, all up to date as of today.)
perhaps the fix will be as simple as setting - https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule - to evenodd, rather than nonzero (the default)? but I havent looked at the code. oh it looks like you're tesselating to triangles. that makes the fix trickier. :(

@theacodes
Copy link
Owner

theacodes commented Oct 24, 2023 via email

@mmalex
Copy link
Author

mmalex commented Oct 24, 2023

understood! I went and looked after I left my comment and saw that you're tesselating the polygons yourself. awesome, but yeah, makes it tricker. I guess you need a good javascript tesselator with support for self intersecting polygons + odd/even rules? ironically old old gl used to have a one liner more or less to do this (GLUtessellator) but I dont think GLU made it into the webgl age :) however, I can vouch for this guy being amazing so its exciting that this exists: https://github.com/memononen/tess2.js/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rendering An issue with rendering items
Projects
None yet
Development

No branches or pull requests

2 participants