Commit Graph

171 Commits

Author SHA1 Message Date
David Corbett 21646cc4a6 Do not mark the first glyph as unsafe to break
Fixes #791.
2018-02-17 13:35:34 -08:00
Bruce Mitchener dae20fb5a7 Use nullptr instead of 0. 2018-01-31 08:18:48 -08:00
Bruce Mitchener 90218fa93c Fix typos. 2018-01-31 08:18:15 -08:00
Bruce Mitchener 0c66043a92 [coretext] Fix memory leaks.
In `reference_table`, if the data is empty and we return early,
we still need to release the data object.

In `hb_coretext_shape`, there two edge cases where an early
return should release the attributed string.
2018-01-31 08:04:15 -08:00
Behdad Esfahbod 1245395a60 [coretext] In hb_coretext_font_create() set ptem
Otherwise setting the CTFont was ineffective as it would have been
recreated anyway unless font size was set to 18 CSS points.
2017-12-17 12:33:08 -05:00
Behdad Esfahbod d5e29303db [coretext] Add hb_coretext_font_create()
Fixes https://github.com/harfbuzz/harfbuzz/issues/628

New API:
hb_coretext_font_create()
2017-12-02 14:52:57 -08:00
ebraminio 7c6937e7c7
Move all references of old url to the new address (#622) 2017-11-20 14:49:22 -05:00
Behdad Esfahbod e4da380200 [coretext/uniscribe/directwrite/graphite/fallback] Update for unsafe-to-break
Fixes https://github.com/behdad/harfbuzz/issues/615

We'll see which bots I broke.
2017-11-10 17:14:27 -08:00
Behdad Esfahbod 40ec3bbb55 Consolidate debug stuff into hb-debug.hh
Part of fixing https://github.com/behdad/harfbuzz/pull/605
2017-11-03 17:18:17 -04:00
Behdad Esfahbod 98acdde3c6 [coretext/uniscribe] Fix build
https://travis-ci.org/behdad/harfbuzz/jobs/295039536#L3468
https://ci.appveyor.com/project/behdad/harfbuzz/build/1.0.697/job/dr1ujlntxafeqbej#L142
2017-10-31 11:17:43 -06:00
Behdad Esfahbod 80cc0a7e3e [coretext] Fix build
error: static_assert expression is not an integral constant expression
2017-10-17 11:14:48 -07:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod c3448e8d21 Use static_assert instead of custom ASSERT_STATIC 2017-10-15 12:02:00 +02:00
Behdad Esfahbod c2cf68dbdf [coretext] Fix build 2017-10-13 10:30:19 +02:00
Behdad Esfahbod 95883fc5d4 [coretext] Pass correct font size to CoreText
CoreText "point"s are not typographic points, but CSS pixels.  Ie.
they are 96 per inch, not 72 per inch.
2017-10-13 10:22:20 +02:00
Behdad Esfahbod 8923033eb2 [coretext] Use fabs() to silence compiler warning 2017-10-12 12:02:04 +02:00
Dominik Röttsches dd4b321b4a [coretext] Activate tracking for system fonts
Another attempt at fully fixing
https://github.com/behdad/harfbuzz/issues/360
2017-10-12 11:54:17 +02:00
Behdad Esfahbod 6a2cbc6ef5 [coretext] Use fabsf() instead of abs()
Fixes bots.

Link libharfbuzz.so with -lm.  Surprising that we survived without
it so far!
2017-10-12 10:46:09 +02:00
Behdad Esfahbod e1b6d92302 Remove cast of functions to (hb_destroy_func_t)
Fixes https://github.com/behdad/harfbuzz/issues/474
2017-10-11 15:51:31 +02:00
Behdad Esfahbod 717fcb51dd [coretext] Minor 2017-10-11 15:38:21 +02:00
Behdad Esfahbod 06c14225b2 [coretext] Minor 2017-10-11 15:29:53 +02:00
Behdad Esfahbod a4b46212c5 [coretext] Adjust font size check for 0 2017-10-11 15:29:22 +02:00
Behdad Esfahbod 84686bf4c7 [coretext-aat] Also pass through CoreText if font has kerx table
SFNSText has kerx table which apparently is applied.
2017-10-11 15:02:48 +02:00
Behdad Esfahbod 296d0134c9 [coretext] Change default point size to 12 2017-10-11 14:09:30 +02:00
Dominik Röttsches a5ebe1d4ae [coretext] Recreate CTFont if pt size changed
Attempt at fixing #360
2017-10-11 13:33:05 +02:00
Dominik Röttsches db7a73ce07 [coretext] Fix build 2017-10-11 13:24:48 +02:00
Behdad Esfahbod f334130756 [coretext] Another try 2017-10-11 13:17:46 +02:00
Behdad Esfahbod a8e466c3c1 [coretext] Move CT_Font to font data
Towards implementing optical sizing.  Untested; won't compile.

https://github.com/behdad/harfbuzz/issues/360
2017-10-11 13:05:59 +02:00
Behdad Esfahbod f9b4c6570a [coretext] Move font size to a macro 2017-10-11 12:51:25 +02:00
Behdad Esfahbod 16d02a58cf [coretext] Change default font size from 36 to 18 2017-10-11 12:28:06 +02:00
Behdad Esfahbod 239119a631 [unsafe-to-break] Mark all positions as unsafe in alternative shapers 2017-08-13 15:08:34 -07:00
Cosimo Lupo 9813be3d12 [coretext] Allow to disable kern (#508)
* Minor

* [coretext] Fix leak

* [coretext] Do not reset num_features

* [coretext] allow to disable kern; re-enabling doesn't seem to be working
2017-07-14 17:11:46 +01:00
Behdad Esfahbod d4bb52b9fd Unbreak hb-coretext build 2017-02-09 14:13:25 -08:00
Behdad Esfahbod 466b3e58bd Shuffle things around a bit 2017-02-03 16:57:15 -08:00
Behdad Esfahbod 72ada4f0c6 [GX] Hook up feature variations
Shape-plan caching is not implemented.
2016-12-16 19:06:26 -06:00
Ebrahim Byagowi fc4e671f31 [coretext] Use intended coretext version check logic (#315) 2016-09-09 11:58:28 -07:00
Khaled Hosny 4867734528 Try to unbreak building on older macOS again (#314) 2016-09-07 18:44:37 -07:00
Dominik Röttsches b717cd7be5 Do reconfigure the cascade list for Emoji font on OS X 10.9.5 (#313)
This seems to fix crash issues on 10.9.5 reported on Chrome, compare
crbug.com/549610
2016-09-07 13:56:57 -07:00
Khaled Hosny a0f1b44b6c [coretext] Blind fix for build on MacOS 10.9 2016-08-16 03:09:04 +02:00
Behdad Esfahbod 333173103b Fix sign of shift operators
This one:

  map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);

before the fix, the shift was done as an int, causing overflow
if it ever got to 1 << 31.  Sprinkle 'u's around.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
2016-08-08 17:28:14 -07:00
Behdad Esfahbod 489acf6c31 [coretext] "Fix" crashes on CoreText < 10.10
Fixes https://github.com/behdad/harfbuzz/issues/297
2016-07-22 17:41:43 -07:00
Ebrahim Byagowi 874421203e [coretext] Speculative fix for CoreText nullptr access (#288) 2016-07-11 16:19:21 -07:00
Behdad Esfahbod fc9de44a03 Comments 2016-06-30 09:46:52 -07:00
Dominik Röttsches a0223274b9 Discard reconfigured CTFont if URL changes
Fixes https://github.com/behdad/harfbuzz/issues/267
2016-06-16 14:19:39 +02:00
Behdad Esfahbod 59089622db [coretext] Clarify comment 2016-04-04 14:56:15 -07:00
Behdad Esfahbod 89137e325a Minor 2016-02-22 16:00:59 +09:00
Behdad Esfahbod 15063b12f7 [coretext] Move CTFont construction to face_data 2016-02-22 15:56:29 +09:00
Behdad Esfahbod ba3d49d9a5 [coretext] Move code around 2016-02-22 15:50:12 +09:00
Behdad Esfahbod 90194efb84 [coretext] Move code around 2016-02-22 15:42:53 +09:00
Behdad Esfahbod 238b943e85 [coretext] Fix leak! 2016-02-22 15:31:22 +09:00
Behdad Esfahbod e561122856 [coretext] Move code around 2016-02-22 15:28:37 +09:00
Behdad Esfahbod 04c6443153 [coretext] Ignore PPEM in font size selection 2016-02-22 15:12:27 +09:00
Behdad Esfahbod 62c2711121 [coretext] Limit grapheme-cluster forming to cluster-level=0 2016-02-22 15:07:20 +09:00
Behdad Esfahbod 061105ec44 [coretext] Fix shaping with varying font size
Fixes https://github.com/libass/libass/issues/212
2016-02-22 14:59:39 +09:00
Behdad Esfahbod a39ff95fce [coretext] Speed up CoreText font fallback
Fixes https://code.google.com/p/chromium/issues/detail?id=547912
2016-01-11 12:28:37 +00:00
Nico Weber a7f0e25daf Remove unused HB_SHAPER_DATA_ENSURE_DECLARE lines.
The coretext_aat shaper delegates to the regular coretext_..._ensure() functions, so coretext_aat_..._ensure() functions defined by these macros are unused. The compiler warns about them, which in turn can confuse people to think that the coretext_aat_..._ensure() functions weren't called by accident.
2015-12-30 16:05:52 -05:00
Nico Weber 8b1224f0ee Remove unused `retry:` label.
Fixes a -Wunused-label warning when building harfbuzz with clang -Wall.
2015-12-28 21:31:28 -05:00
Behdad Esfahbod b8811429b6 Fix Since tags
Fixes https://github.com/behdad/harfbuzz/issues/103
2015-09-03 15:53:22 +04:30
Behdad Esfahbod ed6962c795 [coretext] Use i32 instead of u32 as well
Shouldn't cause *any* functional changes, but is more correct.
2015-08-20 15:39:53 +01:00
Behdad Esfahbod 958c268fa3 [coretext] Add TODO item 2015-08-19 13:22:12 +01:00
Behdad Esfahbod 50ad7788ee [coretext] Remove assert that kicks in on Mac OS 10.6
http://crbug.com/419769
2015-08-18 10:22:16 +01:00
Behdad Esfahbod 39851ce84e [coretext] Oops; fix issue number for previous commit 2015-04-21 19:23:27 -07:00
Behdad Esfahbod 24f17afeaf [coretext] Fix positioning with trailing whitespace
Fixes https://code.google.com/p/chromium/issues/detail?id=476913
2015-04-21 19:21:32 -07:00
Behdad Esfahbod 982d94eaa2 [coretext] Don't generate notdef glyph for default-ignorables
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326
2015-01-28 10:51:33 -08:00
Behdad Esfahbod 6917a045fd [coretext] Unbreak glyph positioning in presence of notdef runs
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326

This was originally broken in:

	commit 5a0eed3b50
	Author: Behdad Esfahbod <behdad@behdad.org>
	Date:   Mon Aug 11 23:47:16 2014 -0400

	    [coretext] Implement vertical shaping
2015-01-28 10:50:54 -08:00
Behdad Esfahbod b0b38bb892 [coretext] Fix positioning of notdef 2015-01-21 19:19:33 -08:00
Behdad Esfahbod 70622e5089 [coretext] Fix scaling
Before we were not accounting for possible differences in x_scale and
y_scale, as well as the signs of those.  All should be in good shape
now.
2015-01-21 18:51:42 -08:00
Behdad Esfahbod 221ba02b08 [coretext] Use vertical advance for notdef in vertical direction 2015-01-21 18:51:42 -08:00
Behdad Esfahbod 522b1cc526 [coretext] Hide feature_mappings 2014-08-14 13:29:30 -04:00
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