Commit Graph

422 Commits

Author SHA1 Message Date
Behdad Esfahbod 385f78b312 [aat] Remove deleted-glyhs after applying kerx/kern
Finally:  Fixes https://github.com/harfbuzz/harfbuzz/issues/1356

Test case:
$ ./hb-shape GeezaPro.ttc -u U+0628,U+064A,U+064E,U+0651,U+0629
[u0629.final.tehMarbuta=4+713|u064e_u0651.shaddaFatha=1@0,-200+0|u064a.medial.yeh=1+656|u0628.initial.beh=0+656]

The mark positioning (kern table CrossStream kerning) only works if deleted
glyph (as result of ligation) is still in stream and pushed through the
state machine.
2018-11-07 17:20:47 -05:00
Behdad Esfahbod ca23567f41 Disable fallback mark positioning if kern table has cross-stream kerning
Happens even if the cross-stream kerning is for cursive attachment only.  Oh well..
2018-11-07 16:19:51 -05:00
Behdad Esfahbod 5cf6f94dfd Don't apply both kerx and kern
Ouch!
2018-11-07 16:07:22 -05:00
Behdad Esfahbod 41cff7afc9 Minor 2018-11-07 16:05:36 -05:00
Behdad Esfahbod 649cc3ef27 [kerx] Don't disable crossKerning if kern feature is off 2018-11-07 14:07:13 -05:00
Behdad Esfahbod 0c3b061ac2 [kern] Apply erlier, where GPOS/kerx are applied 2018-11-07 13:58:41 -05:00
Behdad Esfahbod 914b595f25 [ot-face] Include hb-ot-face directly in hb_face_t
Simplifying access coming next.
2018-11-05 23:10:12 -05:00
Behdad Esfahbod 17335a8161 Clean up buffer->swap_buffers() calls
That function checks for buffer->successful already.  No need
to check at call site.
2018-11-04 02:25:07 -05:00
Behdad Esfahbod 095f5add0b [kern] Push apply loop to each subtable 2018-11-02 13:23:54 -04:00
Behdad Esfahbod 80d9a427cf [docs] Document remaining sections 2018-10-27 04:58:32 -07:00
Behdad Esfahbod 39bd07aed5 Fix bunch of unused parameter warnings
Show up with gcc -O0.

There's a few more but those are functions that need to be filled in.

Maybe this is a lost battle...
2018-10-26 21:22:26 -07:00
Behdad Esfahbod f33ad6d692 [aat] Fix up previous commit and add files 2018-10-23 14:31:51 -07:00
Behdad Esfahbod ffe3478448 [aat] Allow enabling/disabling features
Only works at entire-buffer range, not sub-ranges.

Test with:

$ hb-shape Zapfino.dfont Zapfino
[Z_a_p_f_i_n_o=0+2333]

$ hb-shape Zapfino.dfont Zapfino --features=-dlig
[Z=0+416|a=1@-21,0+264|p_f=2+433|i=4+181|n=5+261|o=6+250]

$ hb-shape Zapfino.dfont Zapfino --features=+dlig
[Z_a_p_f_i_n_o=0+2333]

Fixes https://github.com/harfbuzz/harfbuzz/issues/1303
2018-10-23 14:14:03 -07:00
Behdad Esfahbod 76324d95ca Shift code around 2018-10-23 13:09:30 -07:00
Behdad Esfahbod cf92d6579e [trak] Allow disabling tracking for ranges of text
Fixes https://github.com/harfbuzz/harfbuzz/issues/1303
2018-10-23 03:10:56 -07:00
Ebrahim Byagowi 22ecefd88e Make tracking optout possible using 'trak' ot feature
So '--features=-trak' or 'font-feature-settings: 'trak' 0;' can prevent
applying of tracking if used.
2018-10-23 02:57:55 -07:00
Behdad Esfahbod 0b9d60e1a1 [aat] Apply kerx if GPOS kern was not applied
Ned tells me this is what Apple does.
2018-10-11 13:26:58 -04:00
Behdad Esfahbod b59a428af0 Minor 2018-10-11 13:24:17 -04:00
Behdad Esfahbod d6a12dba6d [trak] Fix, and hook up
Works beautifully!  Test coming.
2018-10-11 11:10:06 -04:00
Behdad Esfahbod 34caadc5c7 Ugh. Re-enable accidentally disabled GPOS 2018-10-10 22:17:07 -04:00
Behdad Esfahbod 504cb68fc9 Disable mark advance zeroing as well as mark fallback positioning if doing kerx 2018-10-10 21:29:46 -04:00
Behdad Esfahbod 60f86d32d7 [kerx] Don't loop over kerning subtables if kerning disabled 2018-10-10 18:10:05 -04:00
Behdad Esfahbod 38a7a8a89e Allow HB_OPTIONS=aat to prefer AAT tables over OT
Fixes https://github.com/harfbuzz/harfbuzz/issues/322
2018-10-10 17:44:46 -04:00
Behdad Esfahbod 7727e73756 [kerx] Actually hook up, and fix crash 2018-10-10 13:24:51 -04:00
Behdad Esfahbod a03850a356 Fix GPOS/kern interaction
Oops.  Was checking for kern feature in GSUB, not GPOS.
2018-10-10 10:57:28 -04:00
Behdad Esfahbod d1be805e78 More rewriting plan compile
Hopefully more clear.
2018-10-10 10:49:45 -04:00
Behdad Esfahbod 961ab46b24 More reshuffle plan compile 2018-10-10 10:42:10 -04:00
Behdad Esfahbod 2091b509e3 [kerx] Hook up to shaper 2018-10-10 10:41:08 -04:00
Behdad Esfahbod e655fd38cf Apply TT or fallback kerning when GPOS does not have kern feature
Previously we only did if there was no GPOS whatsoever.  This applies
to Arial, Times New Roman, etc in Win7.  Was not kerning before.  It
is now.
2018-10-10 10:19:07 -04:00
Behdad Esfahbod 53e5594500 [kerx] Implement Format0 apply()
Not hooked up to be called yet.
2018-10-09 22:35:22 -04:00
Behdad Esfahbod a51958819f Apply TrueType/OpenType kern table when GPOS kern feature is not available
Fixes https://github.com/harfbuzz/harfbuzz/issues/250
2018-10-08 23:57:45 -04:00
Behdad Esfahbod 09ad2613c8 Separate fallback kern vs mark positioning 2018-10-08 23:30:24 -04:00
Behdad Esfahbod c0d3bf1baf Minor 2018-10-08 16:32:44 -04:00
Behdad Esfahbod 94368855c6 Remove some code
We use scratch-flags to short-circuit this function.  No need for previous
early loop.
2018-10-07 18:52:48 -04:00
Behdad Esfahbod 71b65eb27d Add API for setting invisible-codepoint
Fixes https://github.com/harfbuzz/harfbuzz/issues/1216

New API:
hb_buffer_set_invisible_codepoint()
hb_buffer_get_invisible_codepoint()

hb-shape / hb-view --invisible-codepoint
2018-10-07 18:43:26 +02:00
Behdad Esfahbod a62f37d6fa Change vendor features from Harf/Buzz to HARF/BUZZ
a01194aaf4 (commitcomment-30772041)

"The tag space of tags consisting of four uppercase letters (A-Z) with no punctuation,
spaces, or numbers, is reserved as a vendor space. Font vendors may use such tags to
identify private features."
2018-10-05 02:49:29 +02:00
Behdad Esfahbod a01194aaf4 Enable two OpenType features, 'Harf' and 'Buzz'
One early, before script-specific features, one late, after.  Allows font
developers to detect us and behave differently if needed.
2018-10-04 13:00:37 +02:00
Behdad Esfahbod 14ff3cbe0f Apply morx if there's no GSUB! 2018-10-04 11:34:21 +02:00
Behdad Esfahbod b710ea4fde Clean Fitzpatrick hack 2018-10-03 21:17:59 +02:00
Behdad Esfahbod 03fb6dd4c7 Rewrite grapheme-formation in terms of new work
Also, don't attach ZWNJ to previous cluster.  Closer to Unicode graphemes.
2018-10-03 21:11:40 +02:00
Behdad Esfahbod 3b78318510 [emoji] Mark emoji contination sequences as continuation
This adds a new grapheme bit.  Not used yet.

Part of https://github.com/harfbuzz/harfbuzz/issues/1159
2018-10-03 20:19:42 +02:00
Behdad Esfahbod 123326e20a Dotted-circle all marks, not just non-spacing, at text beginning 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 0a371fee4d Minor 2018-10-02 14:48:39 +02:00
Behdad Esfahbod 94d15528f8 Minor 2018-10-02 14:45:09 +02:00
Behdad Esfahbod 729f634728 Disable joiner-skipping when looking back for base to attach mark to
Fixes https://github.com/harfbuzz/harfbuzz/issues/1189
2018-10-02 14:41:31 +02:00
Behdad Esfahbod 48c513fec9 Minor 2018-10-02 14:19:34 +02:00
Behdad Esfahbod cca757ae56 Minor 2018-10-02 14:10:26 +02:00
Behdad Esfahbod 96eca87f89 Move things 2018-10-02 13:24:40 +02:00
Behdad Esfahbod 10b6c7c638 Minor include cleanup 2018-10-02 13:11:18 +02:00
Behdad Esfahbod 1d1734e985 Shuffle code around 2018-10-02 13:04:05 +02:00
Behdad Esfahbod d9867497d0 Minor 2018-09-24 18:11:59 -04:00
Behdad Esfahbod f048ead84a Some more 2018-09-24 18:04:17 -04:00
Behdad Esfahbod 71c9f84e7c Make --features rand=1 available to the user
Use rand=255 to mean "randomize".

Part of https://github.com/harfbuzz/harfbuzz/pull/803
2018-09-11 10:47:59 +02:00
Behdad Esfahbod 80de4bcd26 Minor clean up of 'rand' patchset 2018-09-11 10:47:59 +02:00
David Corbett f05df643b4 Allow requesting a specific glyph for 'rand'
Randomization only happens by default. If the user specifies a value for
'rand', that value is respected.
2018-09-11 10:47:59 +02:00
David Corbett c2a75e07e5 Implement 'rand' 2018-09-11 10:47:59 +02:00
Behdad Esfahbod b929100f87 [ot-face] Unify GSUB/GPOS accelerators in the table accelerator framework 2018-08-26 01:15:47 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod 1c6b369324 [ot] Rename hb_ot_layout_t to hb_ot_face_data_t 2018-08-23 11:30:21 -07:00
Behdad Esfahbod 79e21984b1 Add batch advance width callback function
New API:
+hb_font_funcs_set_glyph_h_advances_func
+hb_font_funcs_set_glyph_v_advances_func
+hb_font_get_glyph_h_advances
+hb_font_get_glyph_h_advances_func_t
+hb_font_get_glyph_v_advances
+hb_font_get_glyph_v_advances_func_t
2018-08-06 09:45:17 -07:00
Koji Ishii 9533364cc3 batchwidth 2018-08-06 09:44:46 -07:00
Behdad Esfahbod 3d22aefede Rename 2018-08-01 18:03:32 -07:00
Behdad Esfahbod 42c183f803 Minor 2018-07-27 14:55:29 -07:00
prrace 2e25d8f491 Fix unlikely leaks 2018-07-27 14:54:08 -07:00
Behdad Esfahbod db5d430eff [aat] Update for blob changes
Also, uncomment code again, just "if (0)" it out, so it doesn't get stale again.
2018-07-17 18:14:45 +02:00
Behdad Esfahbod bddeb2b10c Minor renamings of internal inline functions 2018-07-10 14:13:21 +02:00
Garret Rieger 57badadb76 [subset] add a new closure call to hb-ot-layout that can compute the closure over multiple lookups. 2018-06-06 17:50:12 -06:00
Behdad Esfahbod f9abbf83b6 Fix fallout from 975bdd5ef5
Ouch!
2018-06-02 15:46:08 -07:00
Behdad Esfahbod 7185b273b3 Rename in_error to !successful
Towards possibly using Null pool for some nil objects.
2018-05-31 20:03:34 -07:00
Behdad Esfahbod 6c2227640b Add HB_DISALLOW_COPY_AND_ASSIGN 2018-05-25 16:21:27 -07:00
Behdad Esfahbod f673cfbd64 Support scripts that are written both LTR and RTL
Right now only Old Italic is marked as such.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1000
2018-05-07 14:12:17 -07:00
Behdad Esfahbod a60ba7964e s/finish/fini
For consistency.
2018-05-01 19:01:25 -04:00
Behdad Esfahbod ac2ece3e15 [ot] Comment out AAT include 2018-03-07 15:52:42 +01:00
Ebrahim Byagowi 1ab16f4556
[aat] Implement trak logic (#816) 2018-02-24 12:49:42 +03:30
Behdad Esfahbod eada749e46 Use HB_SET_VALUE_INVALID consistently 2018-02-21 00:35:47 -08:00
Behdad Esfahbod 046690a4df [aat] Add hb_aat_apply_context_t 2018-01-19 16:40:13 -08:00
Behdad Esfahbod fd03449094 Rename hb_apply_context_t to hb_ot_apply_context_t 2018-01-19 16:40:13 -08:00
Behdad Esfahbod ee16b9d8d3 Revert accidental morx enablement 2018-01-12 11:28:09 +01:00
Behdad Esfahbod cdfa801ff4 [aat] Tweak previous commit 2018-01-12 11:12:20 +01:00
Behdad Esfahbod 3b1e97f364 Add HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES
New API:
HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES
hb-shape / hb-view --remove-default-ignorables

One more text-rendering-tests test passing.  Eleven failing.
2018-01-10 03:36:03 +01:00
Behdad Esfahbod 0ed69c9462 Disable processing of morx table in ot shaper
So I can merge this to master...
2018-01-10 02:50:49 +01:00
Behdad Esfahbod 748b989a1f [aat/morx] Implement NoncontextualSubtables
Also makes hb-ot-shape call morx for now instead of GSUB... Just for testing.
2018-01-10 02:50:49 +01:00
Behdad Esfahbod 4cf3ab1d81 Minor 2018-01-10 02:50:49 +01:00
ebraminio 7c6937e7c7
Move all references of old url to the new address (#622) 2017-11-20 14:49:22 -05:00
Behdad Esfahbod baf7779d2d Limit how much recursion GSUB/GPOS does
This only counts recursions right now.  Good start.

Hopefully...
Fixes https://github.com/behdad/harfbuzz/issues/429
2017-11-14 21:55:37 -08:00
Behdad Esfahbod 8b9d9b71b0 Fix set initialization issues 2017-10-22 17:48:06 -04:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod 9786fcd8fd Fix GPOS v_origin ordering
This should affect mark attachment in vertical text.  I have no font to test,
but this sounds the right order.

Noticed while debugging https://github.com/behdad/harfbuzz/issues/532
2017-10-03 17:22:43 +02:00
Behdad Esfahbod 7cc348041d [unsafe-to-break] Fix unsafe-to-break for cluster-level=1
Fixes tests/shaping/tests/cluster.tests
2017-09-04 20:06:21 -07:00
Behdad Esfahbod c449d2d8c9 [unsafe-to-break] Mark during fraction-slash formation
Fixes tests/automatic-fractions.tests
2017-08-30 17:28:22 -07:00
Behdad Esfahbod 1c17c2bde5 [unsafe-to-break] Copy flag to all glyphs in a cluster
Makes consumption easier.
2017-08-11 19:06:07 -07:00
Behdad Esfahbod e2a2b5b229 [unsafe-to-break] Be careful with flag propagation when merging clusters 2017-08-10 20:11:35 -07:00
Behdad Esfahbod 5aec2fb8d0 Remove TODO item that is not going to happen 2017-03-02 11:46:33 -08:00
Behdad Esfahbod 466b3e58bd Shuffle things around a bit 2017-02-03 16:57:15 -08:00
Khaled Hosny 2452543fdd [ot] Fix automatic fraction for RTL scripts (#405)
The numbers for right-to-left scripts are processed also from right to
left, so the order of applying “numr” and “dnom” features should be
reversed in such case.

Fixes https://github.com/behdad/harfbuzz/issues/395
2017-01-18 12:48:13 -08:00
Behdad Esfahbod e2b878055b Disable OTL processing for Hebrew if GPOS doesn't have Hebrew subtable
New approach to fix this:
69f9fbc420

Previous approach was reverted as it was too broad.  See context:
https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368

With U+05E9,U+05B8,U+05C1,U+05DC and Arial Unicode, we now (correctly) disable
GDEF and GPOS, so we get results very close to Uniscribe, but slightly different
since our fallback position logic is not exactly the same:

Before:		[gid1166=3+991|gid1142=0+737|gid5798=0+1434]
After:		[gid1166=3+991|gid1142=0@402,-26+0|gid5798=0+1434]
Uniscribe:	[gid1166=3+991|gid1142=0@348,0+0|gid5798=0+1434]
2016-12-22 14:43:23 -06:00
Behdad Esfahbod 1a0f4aa6df Revert "Synthesize GDEF glyph class for any glyph that does not have one in GDEF"
This reverts commit 69f9fbc420.

See https://github.com/behdad/harfbuzz/issues/347#issuecomment-268873401
Fixes https://github.com/behdad/harfbuzz/issues/347
2016-12-22 14:43:14 -06:00
Behdad Esfahbod 0aedfd59be [GX] Apply 'rvrn' feature before any other feature 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 72ada4f0c6 [GX] Hook up feature variations
Shape-plan caching is not implemented.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 69f9fbc420 Synthesize GDEF glyph class for any glyph that does not have one in GDEF
Previously we only synthesized GDEF glyph classes if the glyphClassDef
array in GDEF was null.  This worked well enough, and is indeed what
OpenType requires: "If the font does not include a GlyphClassDef table,
the client must define and maintain this information when using the
GSUB and GPOS tables."  That sentence does not quite make sense since
one needs Unicode properties as well, but is close enough.

However, looks like Arial Unicode as shipped on WinXP, does have GDEF
glyph class array, but defines no classes for Hebrew.  This results
in Hebrew marks not getting their widths zeroed.  So, with this change,
we synthesize glyph class for any glyph that is not specified in the
GDEF glyph class table.  Since, from our point of view, a glyph not
being listed in that table is a font bug, any unwanted consequence of
this change is a font bug :).

Note that we still don't get the same rendering as Uniscribe, since
Uniscribe seems to do fallback positioning as well, even though the
font does have a GPOS table (which does NOT cover Hebrew!).  We are
not going to try to match that though.

Test string for Arial Unicode:

	U+05E9,U+05B8,U+05C1,U+05DC

Before:		[gid1166=3+991|gid1142=0+737|gid5798=0+1434]
After:		[gid1166=3+991|gid1142=0+0|gid5798=0+1434]
Uniscribe:	[gid1166=3+991|gid1142=0@348,0+0|gid5798=0+1434]

Note that our new output matches what we were generating until July
2014, because the Hebrew shaper used to zero mark advances based on
Unicode, NOT GDEF.  That's 9e834e29e0.

Reported by Greg Douglas.
2016-03-17 11:59:43 -07:00