2082 Commits

Author SHA1 Message Date
Thatchapon Unprasert
447c9e1887
Support sbix Glyphs with graphicType "flip" (#3433)
* Support sbix Glyphs with graphicType = "flip"

Since iOS 17.4 beta, Apple introduced the "flip" graphic type for the sbix glyphs to reference the another glyph to be flipped by their render engine. Their use case is for directional emojis.

Example emoji: https://emojipedia.org/woman_walking_facing_right#technical

This is the example of the output XML after this PR:

```
<glyph graphicType="flip" name="u1F3C3.0.M.u27A1" originOffsetX="0" originOffsetY="0">
    <ref glyphname="u1F3C3.0.M" />
</glyph>
```

Before, it was just `<hexdata>` with some data in it.
2024-01-26 11:09:44 +00:00
Cosimo Lupo
f96b2128a1
[feaLib] keep declaration order of ligatures within ligature set
Fixes #3428
2024-01-24 12:59:00 +00:00
Behdad Esfahbod
9afac79105 [lerp_recording] Make into a generator 2023-12-07 04:49:59 -07:00
Behdad Esfahbod
167e0cb646 [ttGlyphSet] Use lerp_recordings 2023-12-07 04:49:59 -07:00
Behdad Esfahbod
4f6c739181 Move LerpGlyphSet and lerp_recordings to more prominent places
Fixes https://github.com/fonttools/fonttools/issues/3361
2023-12-07 04:49:59 -07:00
Behdad Esfahbod
772dc549f3
[ttGlyphSet] Add option to not recalculate glyf bounds (#3348)
Avoids unnecessary work in the interpolator.
2023-11-21 12:06:57 -07:00
Cosimo Lupo
f518e5a704
[OS/2] don't error getting/setting codepages if version=0
return empty set, or set the bits and bump the version to match
2023-11-15 12:21:02 +00:00
Cosimo Lupo
4610bf39e3
[glyf] skip empty components when computing bounds of composite glyphs 2023-11-14 16:47:20 +00:00
Khaled Hosny
be8ec35934 [OS/2] Add recalcCodePageRanges
Ported from the ufo2ft code (which is port from FontForge code), with
some additional functions for parity with recalcUnicodeRanges.
2023-11-11 01:54:00 +02:00
Cosimo Lupo
53e71f9eb7
Merge pull request #3309 from fonttools/pyup-scheduled-update-2023-10-23
Scheduled weekly dependency update for week 43
2023-11-03 10:33:00 +00:00
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Cosimo Lupo
92cbfee0d0
[Debg] in toXML, dump the JSON as multi-line string with indentation
the table is for debugging, so let's make it easier for human-beings to read its content when dumped to TTX
2023-10-26 14:56:29 +01:00
Behdad Esfahbod
db393f6560 [glyf] Review feedback 2023-10-16 12:30:36 -04:00
Behdad Esfahbod
67be79d77a [glyf] Use a boundsCache within _setCoordinates
Speeds up "pixel" fonts that reuse the same component a lot.
Speeds up instantiating Handjet by 47%.
2023-10-14 13:02:21 -04:00
Behdad Esfahbod
e1117da0af [glyf] Speed up getGlyphID()
Speeds up compiling of fonts with lots of composite glyphs.
For example, 40% speedup in decompile/compiling Handjet font:

./fonttools ttLib Handjet\[ELGR,ELSH,wght\].ttf -t'*' -o out.ttf
2023-10-14 12:57:32 -04:00
Behdad Esfahbod
cc09d5f381 [TupleVariation] Slightly speed up compileCoords
Small but measurable speedup.
2023-10-14 12:57:32 -04:00
Behdad Esfahbod
9eeee75b03 [glyf] Speed up recalcBounds() 2023-10-13 13:53:44 -04:00
Behdad Esfahbod
fe37e91258 [glyf] Speed up recalcBounds of composite glyphs
Brings down decompile/compiling of Handjet font from 11s to 0.3s.

Test with:
time ./fonttools ttLib Handjet.ttf -o out.ttf -tglyf

Part of fixing https://github.com/fonttools/fontbakery/discussions/4301
2023-10-13 13:52:19 -04:00
Behdad Esfahbod
377105f0c1 [glyf] Speed up coordinates slice access 2023-10-13 12:22:48 -04:00
Behdad Esfahbod
36eec087c4 [ttLib.main] Accept list of tables to decompile
Useful for performance measurement of load / save.
2023-10-13 12:13:21 -04:00
Cosimo Lupo
5c8bce194b
Merge pull request #3162 from robhagemans/bugfix-ebdt-reversebytes
Bug fix for `TypeError` in `_reverseBytes()` in module `E_B_D_T_`, currently breaks on `bytes` arguments longer than 1
2023-10-06 11:14:10 +01:00
Cosimo Lupo
442576fb1f Fix UnbouldLocalError and let {h,v}hea be no-op when no {v,h}mtx is present
Fixes https://github.com/fonttools/fonttools/issues/3289
2023-10-06 10:30:33 +01:00
Cosimo Lupo
880d7b3f9d
black 2023-08-20 11:59:40 +01:00
Cosimo Lupo
457f11c29b
Fix AttributeError: 'OffsetToWriter' object has no attribute 'repeatIndex'
Fixes #3260
2023-08-20 11:47:54 +01:00
Khaled Hosny
ae31d05605 [ttLib] Fix warning when calling addMultilingualName() with "ar" name
I get warning from _makeMacName() because it does not have a TTFont, but
the font is there, just not passed from addMultilingualName() ->
findMultilingualName() -> _makeMacName().
2023-08-13 14:21:32 +03:00
Cosimo Lupo
a8d5d45b39
Merge pull request #3241 from fonttools/better-packer
[otBase/packer] Allow sharing tables reached by different offset sizes
2023-08-04 16:06:15 +01:00
Behdad Esfahbod
4ccbcf3eb3 [COLR] Fix thinko 2023-08-03 17:56:38 -06:00
Behdad Esfahbod
286e6466cd [otBase/packer] Remove offsetSize from OTTableWriter 2023-08-03 11:17:41 -06:00
Behdad Esfahbod
2b629e51c2 [otBase/packer] Allow sharing tables reached by different offset sizes
This makes us match hb-subset now.

Fixes https://github.com/fonttools/fonttools/issues/3236
2023-08-03 11:10:16 -06:00
Rob Hagemans
0e691fb432 add doctest to _reverseBytes (not detected due to _memoize) 2023-07-22 15:46:19 +01:00
Rob Hagemans
4801d84ecc fix _memoize, as suggested by Cosimo Lupo 2023-07-22 12:24:32 +01:00
Behdad Esfahbod
530e409416 [name] Speed up NameRecordVisitor
Don't visit large tables without any name records.
2023-07-20 10:16:04 -06:00
Behdad Esfahbod
d27cc3abf8 Revert "Merge pull request #3214 from fonttools/subset-speed-regression"
This reverts commit f7965ba0086ebad9e3fa103935dc2edf41ffe780, reversing
changes made to 31319a7ef218237eea7cd6713ec29032a5cdd752.
2023-07-20 10:16:04 -06:00
Cosimo Lupo
687e23cf3f
[NameVisitor] remove logging, caller can log if they wish 2023-07-20 10:27:30 +01:00
Cosimo Lupo
8846b57304
Merge pull request #3201 from NightFurySL2001/patch-1
Convert panoseDefault to namespace object
2023-07-12 19:24:16 +01:00
Cosimo Lupo
c9d965b581
Merge pull request #3185 from m4rc1e/clean-nametable
Remove redundant name table records
2023-07-12 19:12:15 +01:00
Marc Foley
cfede76fd9 Implement Cosimo feedback 2023-07-10 15:01:40 +01:00
NFSL2001
be44c92cfa
Update Lib/fontTools/ttLib/tables/O_S_2f_2.py
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
2023-07-07 23:12:44 +08:00
NightFurySL2001
ef8e15a08c
Use Panose class 2023-07-07 22:09:58 +08:00
Behdad Esfahbod
9974a74a18 [cubic-glyf] Fix drawPoints() contour ending with cubic offCurve
Fixes https://github.com/fonttools/fonttools/issues/3189
2023-06-27 11:48:25 -04:00
Behdad Esfahbod
4ae0a93692 black
I'm sorry.
2023-06-27 08:49:31 -06:00
Behdad Esfahbod
9ec121322b [cubic-glyf] Emit integers instead of floats when possible
I was seeing unnecessary ".0" in the SVG output. Granted,
should probably be fixed in the SVG pen as well. Will do.
2023-06-27 08:43:44 -06:00
Behdad Esfahbod
0b11a46e3a [cubic-glyf] Fix rendering no-oncurve outlines
Test coming.
2023-06-27 08:39:29 -06:00
Marc Foley
edf8891fba Use NameRecordVisitor in subsetter 2023-06-27 15:23:56 +01:00
Marc Foley
a792851131 add removeUnusedNames staticmethod to name table 2023-06-27 12:06:18 +01:00
Rob Hagemans
2a75378fa6 _reverseBytes() may apply to bytes and ints (loop over bytes), but ints have no len() 2023-06-12 21:30:55 +01:00
Cosimo Lupo
dfec4abf6d
glyf: use 'round' parameter in _getCoordinatesAndControls
as Behdad suggested in review
2023-06-08 11:47:47 +01:00
Cosimo Lupo
5c0f05cc42
allow to pass 'round' parameter in ttGlyphPen, optimize for noRound 2023-06-08 11:41:07 +01:00
Cosimo Lupo
86777525a6
drop oncurve if it's impliable either before OR after rounding
ofter the rounding gives us an opportunity to make an oncurve impliable, for points that were not equidistant become so after round, so why not take it!
2023-06-07 18:13:58 +01:00
Cosimo Lupo
1ca554332c
_getCoordinatesAndControls: make sure coords are rounded toInt() as gvar expects
ufo2ft will no longer send varLib already-rounded master glyf tables (to give it an opportunity to compute implied oncurves on the pre-rounded coords) so when retrieving coordinates off the glyf table in order to compute gvar deltas we have to round
2023-06-07 18:05:48 +01:00