Commit Graph

202 Commits

Author SHA1 Message Date
Behdad Esfahbod 20076cc41e [coretext] Add version guards for kCTLanguageAttributeName 2014-08-12 19:26:35 -04:00
Behdad Esfahbod 1b3011c27d [coretext] Pass buffer language to CoreText 2014-08-12 19:17:49 -04:00
Behdad Esfahbod 3eb6a4dbf2 [coretext] Minor 2014-08-12 19:17:45 -04:00
Behdad Esfahbod 08acfe0d3a [hb-coretext] Fix cluster order of notdef runs in RTL text 2014-08-12 19:17:45 -04:00
Behdad Esfahbod 81b8d9777b [coretext] Fix buffer resizing
Was very broken.  Now fixed and tested.
2014-08-12 15:50:15 -04:00
Behdad Esfahbod c3e924fb9e [coretext] Rewind scratch-allocated arrays when not needed anymore 2014-08-12 15:50:15 -04:00
Behdad Esfahbod fd0001d7db [coretext] Compare CGFont and PS name, if CTFont didn't match
See comments.

Fixes vertical text.  CoreText backend is in very good shape now!

Also see:
5a0eed3b50
25f4fb9b56

Fixes http://github.com/behdad/harfbuzz/pull/36
2014-08-12 10:34:01 -04:00
Behdad Esfahbod 5a0eed3b50 [coretext] Implement vertical shaping
Currently doesn't work though, we detect font fallback.  Apparently
matching on ct_font is not safe for this.  Looks like commit
25f4fb9b56 wasn't enough after all.
2014-08-11 23:47:16 -04:00
Behdad Esfahbod 1b55077f03 [coretext] Remove unnecessary alt_size
Wasn't needed after a6b8dc8742.
2014-08-11 20:45:12 -04:00
Behdad Esfahbod 10b1104d79 [coretext] Use CFRunStatus
Assert that all runs had expected direction, and take hint for
non-monotone clusters.
2014-08-11 20:02:45 -04:00
Behdad Esfahbod fd1a6aa8d0 [coretext] Minor 2014-08-11 20:01:37 -04:00
Behdad Esfahbod 130856c705 [coretext] Remove debug printf! 2014-08-11 19:16:26 -04:00
Behdad Esfahbod 4acce77db7 [coretext] Pass buffer direction to CoreText
Have to use a CTTypesetter for this.
2014-08-11 17:46:50 -04:00
Behdad Esfahbod 5ec45dd37c [coretext] Minor
It's hard to handle all possible NULL returns from CoreText.  Add one
more...
2014-08-11 17:46:12 -04:00
Behdad Esfahbod 624a299b82 [coretext] Attach marks to base clusters
Fixes https://githu.com/behdad/harfbuzz/issues/49
to the extent that it can be fixed.
2014-08-11 15:29:18 -04:00
Behdad Esfahbod 3c41ccb535 [coretext] Use input clusters
Before, this shaper was returning UTF-16 cluster indices instead of
returning whatever cluster values the user had had set up in the buffer.
Ouch!
2014-08-11 15:11:59 -04:00
Behdad Esfahbod a6b8dc8742 [coretext] Fix buffer resize handling
We can't really resize buffer and continue in this shaper as we are
using the scratch buffer for string_ref and log_cluster.  Restructure
shaper to retry from (almost) scratch.
2014-08-11 15:08:53 -04:00
Behdad Esfahbod 9b3c60c88b [coretext] Always compute log_clusters
To be used soon.
2014-08-11 13:46:56 -04:00
Behdad Esfahbod 9ce067c775 [coretext] Simplify cluster mapping 2014-08-11 02:44:50 -04:00
Behdad Esfahbod 49f7fb6376 [coretext] Minor 2014-08-10 19:19:38 -04:00
Behdad Esfahbod 25f4fb9b56 [coretext] Fix fallback detection
Fixes http://github.com/behdad/harfbuzz/pull/36
2014-08-10 19:05:52 -04:00
Behdad Esfahbod 77a7a53ace [coretext] Fix last range
Test with:

hb-view /Library/Fonts/Zapfino.ttf ZapfinoZapfino --features=-dlig[7:] --shaper=coretext
2014-08-10 19:05:52 -04:00
Behdad Esfahbod 92aeee3f04 Minor 2014-08-10 17:42:19 -04:00
Behdad Esfahbod b9993d8d6d [coretext] Fix assert on Yosemite
Apparently those functions documented as sometimes returning NULL
actually exercise that right in OS X 10.10 Yosemite.  The scratch
was too small for that.  I *think* I fixed it, but haven't tested
as I don't have Yosemite.
2014-08-10 17:40:24 -04:00
Behdad Esfahbod 087733dd66 [coretext] Use CGFont as face_data 2014-08-10 17:33:16 -04:00
Behdad Esfahbod 7627100f42 Mark unsigned integer literals with the u suffix
Simplifies hb_in_range() calls as the type can be inferred.
The rest is obsessiveness, I admit.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod fb8cc86ff9 Rename sort() to qsort()
In an effort to make the algorithm used clear.
2014-06-19 15:31:09 -04:00
Behdad Esfahbod 7526373e70 [coretext] Remove unused var 2014-06-17 11:45:26 -04:00
Behdad Esfahbod a9e25e90a4 [coretext] Add hb_coretext_face_create()
Not tested.
2014-03-14 19:55:46 -07:00
Behdad Esfahbod c79865f90f [coretext] Add coretext_aat shaper
This is a higher-priority shaper than default shaper ("ot"), but
only picks up fonts that have AAT "morx"/"mort" table.

Note that for this to work the font face's get_table() implementation
should know how to return the full font blob.

Based on patch from Konstantin Ritt.
2014-03-14 19:38:58 -04:00
Behdad Esfahbod c29993a181 [coretext] Handle surrogate pairs when generating notdef glyphs
Fixes github.com/behdad/harfbuzz/pull/19
2014-01-28 17:29:42 -05:00
Behdad Esfahbod 748b2782e4 [coretext] Minor optimization 2014-01-28 17:10:05 -05:00
Behdad Esfahbod aec468f01e [coretext] Add TODO 2013-11-29 19:21:58 -05:00
Behdad Esfahbod 58cc233e8b [coretext] Cleanup 2013-11-29 19:17:42 -05:00
Khaled Hosny c8213c6198 [coretext] Avoid font fallback with CoreText shaper
CoreText does automatic font fallback (AKA "cascading") for  characters
not supported by the requested font, and provides no way to turn it off,
so detect if the returned run uses a font other than the requested one
and fill in the buffer with .notdef glyphs instead of random indices
glyph from a different font.
2013-11-29 19:01:56 -05:00
Behdad Esfahbod 68c372ed2e More scratch-buffer cleanup 2013-11-13 14:45:43 -05:00
Behdad Esfahbod 8fcadb9cf9 [coretext] More scratch buffer fixes 2013-11-13 14:33:57 -05:00
Behdad Esfahbod 16f175cb2e Fix scratch-buffer alignment warnings 2013-11-12 17:22:49 -05:00
Behdad Esfahbod 3613696b57 [coretext] Fully support user features
Based on patch from Jonathan Kew and data from Apple.

It's not working correctly though, and I suspect I'm hitting a bug in
CoreText.  When I do this:

hb-shape /Library/Fonts/Zapfino.ttf ZapfinoZapfino --shaper coretext \
--features=-liga

I expect both ligatures to turn off, but only the second one does:

[Z_a_p_f_i_n_o=0+2333|Z=7+395|a=8+285|p_f=9+433|i=11+181|n=12+261|o=13+250]

whereas if I disable 'dlig' instead of 'liga', both are turned off.
Smells...

Doesn't resolve conflicting feature settings.
2013-08-12 12:01:05 -04:00
Behdad Esfahbod a782a5e9a3 [coretext] Start adding support for features
Unlike AAT, looks like with CoreText very few OT features can be mapped.
:(
2013-08-07 22:08:29 -04:00
Behdad Esfahbod c461371419 [CoreText] Don't leak the CTLine object (and everything that hangs off it)
Patch from Jonathan Kew.
2013-07-30 14:48:23 -04:00
Behdad Esfahbod 7235f33f9e Fix misc warnings reported by cppcheck
https://bugs.freedesktop.org/show_bug.cgi?id=65544
2013-06-10 15:08:49 -04:00
Behdad Esfahbod e923e6487b [coretext] Fixed typo
Oops.  Thanks Khaled for catching this.
2012-12-09 19:39:40 -05:00
Behdad Esfahbod 9a8395824b [coretext] Add hb_coretext_face_get_cg_font()
Not sure if it's useful, but it was missing.
2012-12-09 18:47:36 -05:00
Behdad Esfahbod 8611235688 [coretext] Remove hack around GlyphID
We not namespace our types, so the hack is not needed anymore.
2012-12-09 18:47:09 -05:00
Behdad Esfahbod 7d52e6601f Whitespace 2012-11-16 18:49:54 -08:00
Behdad Esfahbod 45c1383cc7 Minor 2012-08-14 09:33:18 -04:00
Behdad Esfahbod 301168dae7 [CoreText] Port to shape_plan infrastructure 2012-07-30 17:48:04 -04:00
Behdad Esfahbod 027857d041 Start adding a unified shaper access infrastructure
Add global shape_plan.  Unused so far.
2012-07-26 21:14:02 -04:00
Jonathan Kew ac2085d4b3 [CoreText] Ensure cluster indices in output buffer are non-decreasing.
Does not provide Uniscribe-compatible results, but should at least avoid
breaking hb-view due to out-of-order cluster values.

For RTL runs, ensure cluster values are non-increasing (instead of
non-decreasing).
2012-07-26 15:58:45 -04:00
Behdad Esfahbod 441d3bb7de Minor 2012-07-26 12:01:12 -04:00
Jonathan Kew aa6d849838 [CoreText] Add basic Core Text backend for comparison with our native shaping
Does not attempt to handle clusters in a Uniscribe- or HarfBuzz-compatible way;
just returns the original string indexes that CT maintains. These may even be
out-of-order in the case of reordrant glyphs.
2012-07-24 15:52:32 -04:00