linusromer / harmonize-tunnify-inflection Goto Github PK
View Code? Open in Web Editor NEWA FontForge plug-in to harmonize or tunnify or add inflection points to the selected parts.
License: GNU Lesser General Public License v3.0
A FontForge plug-in to harmonize or tunnify or add inflection points to the selected parts.
License: GNU Lesser General Public License v3.0
This isn't a "real" issue -- I'm using this as a context for some code feedback.
Please keep in mind that while all code feedback winds up sounding like a list of criticisms that's not really what I'm doing here. In particular I'm not listing things that would be required for an eventual integration of the code in to FontForge -- I suspect such a list would be shorter. I'm just making whatever observations might be handy.
First, if you download the zip in fontforge/fontforge#3991 (comment) you'll find a sort of "model" for keeping this sort of code inside a namespace. (Given that this is python I'm sure its only one of many such models). The reason that might interest you is because it would allow your code to be used any of three ways, two of which could be useful. Suppose if at the bottom instead of running registerMenuItem()
directly you were to put:
if __name__ == '__main__':
if fontforge.hasUserInterface():
[foo (like fontforge.registerUserInterface())]
else:
[bar]
In that case if your file is loaded as a python module someone could use its functionality in their own script. Then if you put code in place of [bar]
it would execute when the script is run from the command line. And finally if you put code in place of foo
it would run when loaded via the python config directory.
Code comments:
None
in place of are_contours_selected
should have the same effect -- when there is no enable_function
the option should always be enabled....,"Harmonize");
, ...,"Harmonize handles");
etc. you could have ...,"Your tool name", "Harmonize");
, ...,"Your tool name", "Harmonize handles");
etc.fontforge.point.type
field. Given how it works that may be fine, but I would recommend considering a looser test in on_same_line
for smooth points (rounding can result in a larger angle divergence than .05). (Also -- and this is really picky -- given that trig functions are expensive why not base this criterion on the cross product divergence as in side
?)selected
field works for these points as of a recent release.)c.closed
. The data structure will normally save you here, but someone could add two off-curve points to the end of an open contour and you could wind up with a false positive.Those are my thoughts for the time being.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.