46 Commits

Author SHA1 Message Date
Cosimo Lupo
ff07d30c33
[Snippets] remove apply-feature-file; this is now feaLib/__main__.py 2017-01-13 11:26:50 +00:00
Cosimo Lupo
2a4b3d5814
[Snippets] add otf2ttf.py using cu2qu for CFF -> TrueType conversion
See discussion at https://github.com/fonttools/fonttools/issues/802

Derived from:
https://github.com/googlei18n/cu2qu/issues/47
2017-01-12 11:02:41 +00:00
Cosimo Lupo
b7bb391033
don't use sys.exit(...) inside main(), but only under if __name__ == "__main__"
The convention is that sys.exit(...) is called only if a module is run as a script,
and that main() entry points use return statements to report exit codes: 0 (or None)
for successful execution, or any non-zero integer for errors.

E.g. see the console scripts generated when installing with pip.
2017-01-11 12:10:58 +00:00
Sascha Brawer
1d28abdb65 [gvar] Rename GlyphVariation to TupleVariation
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
2017-01-04 12:41:55 +01:00
Behdad Esfahbod
e90f9b7d58 [symfont] Minor 2016-12-22 16:11:04 -06:00
Behdad Esfahbod
4868a631b9 [Snippets/interpolatable] Improve error reporting
Also enable full vector.  It's necessary for accurate report.
2016-11-07 20:30:57 -08:00
Behdad Esfahbod
3a4f1fb170 [Snippets/interpolatable] Skip incompatible glyphs 2016-10-30 14:28:07 +02:00
Behdad Esfahbod
3872e3ba3b Revert "remove 'fontTools' symbolic link in Snippets as not cross-plaftorm"
This reverts commit d2e73ca1abf37eaa65a870851cb8427cb6541131.

Even if not cross-platform, this provides useful functionality on Linux and
Mac.
2016-10-13 15:47:49 -07:00
Cosimo Lupo
d2e73ca1ab remove 'fontTools' symbolic link in Snippets as not cross-plaftorm 2016-08-19 14:41:18 +01:00
Cosimo Lupo
fae8e1b498 Merge pull request #631 from anthrotype/woff-metadata-snippets
Snippets: add 'merge_woff_metadata.py' and 'dump_woff_metatada.py' scripts
2016-08-07 19:28:21 +01:00
Behdad Esfahbod
501e1f2f7e [symfont] Remove another level of indirection
Saves another few percents, though not as much as previous commit.
2016-07-11 12:23:56 -07:00
Behdad Esfahbod
7fd9dce0e9 [symfont] Speed up a bit
Remove one level of indirection in access to point data in generated
functions; ie. use p0, p1, ... instead of P[0], P[1], ...

Makes for about 10% speedup.
2016-07-11 12:23:56 -07:00
Behdad Esfahbod
cde56fce66 [symfont] Minor 2016-07-11 12:23:56 -07:00
Cosimo Lupo
9c6c4c4f4c merge_woff_metadata.py: make sure flavor is in "woff" or "woff2" 2016-07-04 16:11:04 +01:00
Cosimo Lupo
0782513d4d Snippets: add 'merge_woff_metadata.py' and 'dump_woff_metatada.py' scripts
This is just to exemplify how one could use the `TTFont.flavorData` attribute to get/set the WOFF metadata.
See discussion at https://github.com/behdad/fonttools/issues/630
2016-07-04 15:51:51 +01:00
Behdad Esfahbod
3868ac845f [Snippets/interpolatable.py] Flesh out some more 2016-06-24 19:00:56 -04:00
Behdad Esfahbod
0deb34829c [Snippets/interpolatable.py] Add preliminary script for detecting interpolation errors
Very basic.  Right now detects if glyphs have wrong order of contours / components.
2016-06-15 18:46:59 +04:00
Behdad Esfahbod
b3414e9ffd [symfont] Use AreaPen from fontTools
It's about 20% faster.
2016-06-14 01:26:39 -04:00
Behdad Esfahbod
acbd3df647 [symfont] Add function to print function sources for caching 2016-06-14 01:23:40 -04:00
Behdad Esfahbod
1a48fc27a1 [symfont] Remove one level of function call 2016-06-14 01:16:57 -04:00
Behdad Esfahbod
56c27f45c9 Speed up perimeterPen
It's still too slow, but an improvement.

Also, remove duplicate copy from symfont.
2016-06-13 18:50:01 -04:00
Behdad Esfahbod
b7cf54aef1 [symfont] Minor 2016-06-13 18:20:42 -04:00
Behdad Esfahbod
c34739760c [symfont] Handle closePath()
Apparently some draw() implementations expect closePath() to
draw a line to the contour beginning.

In fact, looks like fontTools's TrueType draw() always does the
lineTo() before closePath(), but the CFF draw() doesn't.

As raised in
https://github.com/behdad/fonttools/pull/618#issuecomment-225314022
2016-06-10 16:06:22 -07:00
Behdad Esfahbod
7822958fa5 [symfont] Negate sign in green() function
Following the theorem declaration:
https://en.wikipedia.org/wiki/Green%27s_theorem

we should negate the result.  Ie, for a counter-clockwise curve,
the area must be positive.

Raised in
https://github.com/behdad/fonttools/pull/618#issuecomment-225205335
2016-06-10 15:58:56 -07:00
Behdad Esfahbod
0204b66d30 [symfont] Simplify lambdify
A possible alternative solution to the proposed dummify solution...

Might fix https://github.com/behdad/fonttools/issues/595
2016-04-30 15:49:44 +02:00
n8willis
8325ae8c00 Fix berstein typo. 2016-04-26 19:16:46 -05:00
Cosimo Lupo
17bb7891ad [Snippets/apply-feature-file.py] add -v option to increase logging verbosity 2016-04-09 18:13:42 +01:00
Behdad Esfahbod
6bfe6989de [Snippets/symfont] Add glyph perimeter to GlyphStatistics 2016-04-06 18:15:43 -07:00
Behdad Esfahbod
2e816d6c2d [symfont] Permissions 2016-03-21 10:12:26 -07:00
Cosimo Lupo
b2ac89cc42 [apply-feature-file.py] swap args position in addOpenTypeFeatures func call
this changed in commit 5e64857b975c842acadd0eba859c689a23c81b63

Fixes #553
2016-03-20 19:31:28 +00:00
Behdad Esfahbod
8d9f04c576 Typo 2016-03-13 11:24:35 -07:00
Behdad Esfahbod
7319cd0afc Minor 2016-03-12 02:21:07 -08:00
Behdad Esfahbod
b01c41bcea [Snippets] Add symfont.py, for symbolic font statistics analysis 2016-03-10 06:13:18 -08:00
Sascha Brawer
c3e2d37299 Snippet for applying a feature file to a font
It would be nice to also handle MTI feature files, and to process
TTX in addition to binary fonts, and and and... but it's a start.
https://github.com/behdad/fonttools/issues/527
2016-03-09 17:19:10 +01:00
Dave Crossland
b49763c50a Snippets/README -> README.md, link to other utils
Closes #467
2016-02-04 13:14:34 -05:00
Cosimo Lupo
3d8b498ad1 [Snippets/interpolate] replace warnings with logging
Here I use logging.basicConfig to configure the root logger, and hence all the other loggers,
including fontTools'.

I could have used fontTools.configLogger as well (and get predefined formatter, etc.), but wanted
to show that one can also configure the fontTools logger using the built-in logging configuration
functions (e.g. basicConfig, config.dictConfig and config.fileConfig).
2016-01-27 19:02:48 +00:00
Behdad Esfahbod
b7e2391e66 [Snippets] Add script for cmap subtable format conversion
Fixes https://github.com/behdad/fonttools/issues/340
2015-08-20 13:24:02 +01:00
Behdad Esfahbod
b23d7cba8c [Snippets] Add layout-features.py that prints GSUB/GPOS features 2015-08-20 12:36:19 +01:00
Behdad Esfahbod
41dcb5a2cc Minor 2015-08-20 11:13:54 +01:00
Cosimo Lupo
2591a1075d [Snippets] add woff_compress.py and woff2_decompress.py sample scripts 2015-08-07 18:23:41 +01:00
Behdad Esfahbod
63a6b1c747 [GX] Fix phantom points in interpolate.py 2015-06-27 19:24:58 -07:00
Sascha Brawer
6cab1e6c1d [GX] Use Microsoft/OpenType weight class for weight axis
https://www.microsoft.com/typography/otspec/os2.htm#wtc
2015-06-26 22:03:25 +02:00
Sascha Brawer
ef98f8ac12 Use the same range as Skia for the weight axis
With this change, the "Thin" instance now renders fine, too.
Apparently, the axis values need to be positive; this was not
clear to me from reading the specification.
2015-06-26 21:14:12 +02:00
Sascha Brawer
97c7168749 [GX] Code snippet for building interpolated fonts 2015-06-26 13:29:33 +02:00
Behdad Esfahbod
a1c013bd8b Add Snippets/README 2015-01-21 13:18:15 -08:00
Behdad Esfahbod
cb6c9d092d Add snippet to subset fpgm functions 2015-01-21 13:17:11 -08:00