Closed gregdavill closed 3 years ago
Multiline seems to work quite well now.
I have noticed some f-strings, so those will need to be changed to the old "".format()
style for python 2.7 compatibility (Windows/MacOS v5 builds of KiCad)
Some fonts I'm getting errors with character that I know they can display..
I was unaware that windows scripting required python 2 support to work. I will start work on converting svg2mod to also work under python2.
I've pushed updates to a branch python2
to svg2mod/svg2mod to remove python3 specific syntax. After some testing I'll push an update that has support for both 2.7 and 3
The "dash" renders correctly this this? That would be nice. I think I learned that on MacOS, KiCAD depends on Python 2 instead of whatever more recent (and supported) version I install. Is this correct? I wish there was something I could do except wait and test when it's "ready".
I was unaware that windows scripting required python 2 support to work. I will start work on converting svg2mod to also work under python2.
Yeah, On v5 and the older MSYS2 v5.99 builds. The newer MSVC builds are python 3.8 I believe. It's also very tricky to make use of pip for dependancies, so it's actually quite nice that we can use fonttools without needing, for example, numpy.
I've pushed updates to a branch
python2
to svg2mod/svg2mod to remove python3 specific syntax. After some testing I'll push an update that has support for both 2.7 and 3
Great! I'll take a look, and pull those changes in.
I did see an issue with Fredoka
the default font from original buzzard and your ttf->svg parsing. Switching to the one from fonttools fixed that issue. https://github.com/gregdavill/svg2mod/commit/0848c9ae3fed97ca41f6e72a1fcb6d0ad4147def
The "dash" renders correctly this this? That would be nice. I think I learned that on MacOS, KiCAD depends on Python 2 instead of whatever more recent (and supported) version I install. Is this correct? I wish there was something I could do except wait and test when it's "ready".
Yes, it turns out that the old code was infact ignoring text-baseline and placing glyphs in the bottom left corner. Resulting in - _
looking like two _ _
and g
being above the baseline.
Yep, the goal is to still make sure we're compatible with all the versions. This weekend I'll hopefully finish up this change so it's in a usable state to try out.
Some fonts I'm getting errors with character that I know they can display..
I tested parsing just this character and got the same issue.
This week and next week are pretty busy so I don't know how soon I can take a look at this, but it likely has to do with the fact that that character is actually two codes, the U
and the -
modifier.
Once I have some more time I will figure out a way to handle these double coded characters.
I tested parsing just this character and got the same issue. This week and next week are pretty busy so I don't know how soon I can take a look at this, but it likely has to do with the fact that that character is actually two codes, the
U
and the-
modifier. Once I have some more time I will figure out a way to handle these double coded characters.
Ahh, I see. On most of the fonts I've tried, these aren't classed as composite. Only UbuntuMono-B
has these as composite glyphs. This is an issue that can be sorted out later.
I tested parsing just this character and got the same issue. This week and next week are pretty busy so I don't know how soon I can take a look at this, but it likely has to do with the fact that that character is actually two codes, the
U
and the-
modifier. Once I have some more time I will figure out a way to handle these double coded characters.
This appears to be fixed by passing the glyphSet through to the pen instead of an individual glyph.
pen = SVGPathPen(ttf.getGlyphSet())
glf.draw(pen)
Now confirmed working on Windows v5.1.9
And on Windows Version: (5.99.0-9081-g8c2fe42ef0-dirty), release build
It should be possible to test on OSX now if you would like to help out there @CaptClaude? Do you know the steps to checkout a merge-request to test?
cd KiBuzzard
git fetch origin
git checkout origin/feature-svg2mod
git submodule update --init
Then if you hit any issues and want to revert back
git checkout origin/main
I took a quick look and the switch to the SVGPathPen
caused some issues inside of svg2mod. I do like the approach better, but paths with multiple start and stops is still occasionally causing an issue.
I have more optimizations for the hole inlining algorithm to make it faster to render as well as addressing this issue planned as projects to work on after this semester finishes in 2 weeks.
Works for me. The pic is all of the fonts, top to bottom in order with assorted L & R caps. Is there a reason why there isn't a left ")"?
And no, I would not have known how to get that without your patient help. I should learn git. Just like I should improve my Python. And get a haircut...
Edit: Tried multi-line and 10 lines works but there appears to be a limit to how many characters total can be put into a label - something I am certain you can confirm.
ü & ö (presumably others) do not work. You get a label but the accented character (entered using the usual method (option-u then o) but that character does not and it is not possible to enter anything after that letter.
I took a quick look and the switch to the
SVGPathPen
caused some issues inside of svg2mod. I do like the approach better, but paths with multiple start and stops is still occasionally causing an issue.I have more optimizations for the hole inlining algorithm to make it faster to render as well as addressing this issue planned as projects to work on after this semester finishes in 2 weeks.
Okay, I did see this happen on some fonts. I also saw a different issue with Fredoka with the original code, hence the change. I'm happy to keep looking into this too.
Works for me.
Nice! Thanks for testing that out :)
The pic is all of the fonts, top to bottom in order with assorted L & R caps. Is there a reason why there isn't a left ")"?
I don't think the original plugin had a )
/ (
on the left/right caps. We can look into adding those.
Edit: Tried multi-line and 10 lines works but there appears to be a limit to how many characters total can be put into a label - something I am certain you can confirm.
There is a soft-limit of 64 characters. This is in place to keep the UI snappy.
ü & ö (presumably others) do not work. You get a label but the accented character (entered using the usual method (option-u then o) but that character does not and it is not possible to enter anything after that letter.
I've not taken a look at this issue further yet in these changes. We can keep discussing that issue in the other issue thread. If this is working in the KiCad dialog boxes we should be able to get it working in this plugin.
At the moment, diacritical marks are a very, very, low priority for me and 64 characters is certainly more than enough for me as well. I'm a happy camper. Happy to help, it's almost like I know what I'm doing (although I have been comfortable in *NIX for decades).
I put a small fix/workaround into svg2mod here, until your larger changes are done @Sodium-Hydrogen. https://github.com/gregdavill/svg2mod/commit/8a59e7682988b7031d151ad168b109589bfe561c
By adding this small delta we avoid intersecting with the ends of parallel lines multiple times, which I think was the issue before. With this change some of the glyphs that had issues are looking correct again.
I think this is now in a state which we can merge this into main. I'll do a little bit more testing on python 2.7, some of these changes broken 3.8.
Mr. Noob asks: Now that this is merged, do I just delete and git clone https://github.com/gregdavill/KiBuzzard --recursive
?
Thanks!
Mr. Noob asks: Now that this is merged, do I just delete and
git clone https://github.com/gregdavill/KiBuzzard --recursive
? Thanks!
If you've not made any code changes then that's the easiest/cleanest option, yes.
Hmmm... Did that and the plugin does not show up after closing/opening KiCAD and Refresh Plugins. Delete everything just cloned and restore what I moved out (just in case) and the plugin is back.
I will take another look at this again tomorrow.
Description
As per the suggestion from @Sodium-Hydrogen here: https://github.com/gregdavill/KiBuzzard/issues/7#issuecomment-797878780
After finding some issue with the Kerning support in freetype, I started looking into fonttools instead. Along with this also svg2mod, as it has better support for generating KiCad modules/footprints.
This PR is still a work in progress, but initial impressions are good. We'll need to remove/rewrite most of the original Buzzard code, but the result should be more usable, and extendable.
It already is looking trivial to support https://github.com/gregdavill/KiBuzzard/issues/17
Compatibility
A main concern with KiBuzzard is to ensure that it operates correctly on different platforms and on Stable+Nightly. This means we need to be supporting python 2.7. So we do need to stick with an older version of fonttools for this.
With better Kerning and a proper baseline that Text is generated on we may need to handle invert text differently, As this now look a tad un-even due to the
g
hanging below the baseline.One way to work-around this is to add UI to support custom margins on the border.