Commit Graph

4079 Commits

Author SHA1 Message Date
Behdad Esfahbod cb43bdbc2f [ft] If there's no variations set, don't set them on hb-font 2018-01-05 13:06:25 +00:00
Behdad Esfahbod 127bcc6ece Merge remote-tracking branch 'fdo/master' 2018-01-05 12:50:22 +00:00
Behdad Esfahbod 8c0d1916a4 Improve CGJ skipping logic
Previously we made CGJ unskippable.  Now, if CGJ did NOT prevent
any reordering, allow skipping over it.  To make this work we
had to make changes to the Arabic mark reordering algorithm
implementation to renumber moved MCM marks.  See comments.

Fixes https://github.com/harfbuzz/harfbuzz/issues/554
2018-01-05 12:48:19 +00:00
Ebrahim Byagowi 72bec1cd09
Improve tests (#679) 2018-01-05 12:42:20 +03:30
Behdad Esfahbod 293e443529 Minor 2018-01-04 16:06:25 +00:00
Bruce Mitchener 8a0952db7e atomics: Favor compiler primitives over macOS APIs. (#676)
In macOS 10.12, the `OSMemoryBarrier` and related APIs were deprecated
in favor of using `std::atomic`. On the way to supporting `std::atomic`,
we can favor using the "Intel primitives" which are also available on
macOS.
2018-01-04 15:10:10 +03:30
Ebrahim Byagowi 5ed26fc5bd
[cmake] Run src/ tests (#675) 2018-01-04 10:11:34 +03:30
Behdad Esfahbod f8daeef4c4 [use] Simplify more 2018-01-03 14:27:34 +00:00
Behdad Esfahbod 877d15e73c [use] Simplify
Fixes https://github.com/harfbuzz/harfbuzz/pull/661
2018-01-03 14:24:44 +00:00
Behdad Esfahbod 308f419215 [use] Fix Brahmi Number Joiner 1107F
Fixes https://github.com/harfbuzz/harfbuzz/pull/660
2018-01-03 14:22:07 +00:00
Bruce Mitchener 85ec6d3443 Fix typos. 2018-01-02 13:26:44 -05:00
David Corbett 7bfdf1a941 Forbid Batak killers after vowel signs 2017-12-24 14:21:22 -08:00
Behdad Esfahbod 72ecaae0ad [use] Allow ZWJ before/after Halant
https://github.com/harfbuzz/harfbuzz/issues/542#issuecomment-353169729
2017-12-24 16:05:07 -05:00
Behdad Esfahbod bc92245b68 Minor 2017-12-24 15:54:58 -05:00
Volker H. Simonis a9432bde7e HarfBuzz 1.7.1 and later don't compile on AIX with xlC (#655) 2017-12-19 20:22:24 -05:00
Behdad Esfahbod 2fe5f885b6 [set] Handle nil set in add_range() / add_sorted_array()
Fixes https://github.com/harfbuzz/harfbuzz/issues/657
2017-12-19 14:48:26 -05: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 493a005d95 [set] In add_sorted_array(), bail if data is not sorted 2017-12-16 11:49:39 -05:00
Behdad Esfahbod a7bd6d7a4c [collect_glyphs] Bail if input data looks like garbage
Specificaly, when a range or sorted array has unexpected order, we take that as
font data being garbage and bail out.  This fixes significant slowdown on a bad
version of Chandas font which has a 600KB GPOS with garbage inside.

Later on, I like to add a maximum-work counter for collect_glyphs to protect
against malicious fonts as well.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=794896
2017-12-16 11:39:32 -05:00
Behdad Esfahbod 1ce7d6e215 [set] Optimize add_array() / add_sorted_array()
Does page lookup as needed.
2017-12-16 11:39:11 -05:00
Behdad Esfahbod 71e6adf1e2 [collect_glyphs] handle ClassDef better 2017-12-16 11:07:37 -05:00
Behdad Esfahbod 87cc5a65cb [collect_glyphs] In PairPosFornat2 do not collect classDef1
The coverage already covered that.
2017-12-16 06:18:07 -08:00
Behdad Esfahbod 81f27df4d9 More work towards improving collect_glyphs() against bad input
The three "XXXXX"'s should be switched to false.  Doing that separately for ease
of bisecting...
2017-12-16 06:12:06 -08:00
Behdad Esfahbod 5d02572034 [set] Add add_sorted_array()
Not optimized to use sortedness yet.  Also start putting in place infra
to faster reject bad data.

A version of Chandas.ttf found on some Chrome bots has 660kb of GPOS,
mostly junk.  That is causing 48 million of set->add() calls in
collect_glyphs(), which is insane.

In the upcoming commits, I'll be speeding that up by optimizing
add_sorted_array(), while also reducing work by rejecting out-of-sort
arrays quickly and propagate the rejection.

Part of https://bugs.chromium.org/p/chromium/issues/detail?id=794896
2017-12-14 19:35:47 -08:00
Behdad Esfahbod 9d6511a734 [set] Reduce number of preallocated pages from 8 to 1
Now that pagesize is 8192, this feels better.
2017-12-14 19:07:17 -08:00
Behdad Esfahbod ae2e2b068e Fix partial tracing debug builds 2017-12-14 19:07:17 -08:00
Behdad Esfahbod 9daa88cd79 Minor 2017-12-14 19:07:17 -08:00
Behdad Esfahbod f424a34223 [set] Change pagesize from 512 bits to 8192 bits
Fixes perf regression on some heavy fonts in Chrome's FT+HB
interaction.

See:
https://bugs.chromium.org/p/chromium/issues/detail?id=782220

More work to be done:
https://bugs.chromium.org/p/chromium/issues/detail?id=794896
2017-12-14 13:30:38 -08:00
Behdad Esfahbod 0fe62c1f33 [set] Add add_array()
To be used to optimize adding a whole bunch of (sorted) items at the same time,
as in CoverageFormat1.
2017-12-14 10:39:00 -08:00
Behdad Esfahbod 03b7a221f7 [debug] Use %p to print pointers
Fixes https://github.com/harfbuzz/harfbuzz/issues/640
2017-12-05 13:13:58 -08:00
Nathan Willis 0dc03ef757 Indic: always hyphenate pre-base-reordering, for clarity. 2017-12-05 11:29:43 -08:00
Behdad Esfahbod be59f3cbf4 Silence unused-variables warning on MSVC
Fixes https://github.com/harfbuzz/harfbuzz/issues/635
2017-12-05 09:01:28 -08:00
David Corbett 80c1b01f05 Allow digits in language system tags 2017-12-05 08:56:41 -08:00
David Corbett 85bb89a88b Fix string matching in parse_bool 2017-12-04 13:10:16 -08:00
Olivier Blin 0fd89dc61c [hb-ft] Fix build when Multiple Master font support is disabled in freetype
FT_Set_Var_Blend_Coordinates() is not available when "Multiple Master
font interface" is disabled in freetype's modules.cfg
2017-12-04 10:52:06 -08:00
Behdad Esfahbod eeb26d21d4 [set] Actually commit fixes mentioned in previous commit! 2017-12-02 15:22:04 -08:00
Behdad Esfahbod 0744149cda [set] Protect against bad input in hb_set_add_range() 2017-12-02 15:06:15 -08: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
Behdad Esfahbod 9d0194b3a8 [set] Optimize add_range() some more
It's as good as it gets, and seems to be on par with previous set implementation
in my benchmark.

Would be great if someone can double-check my bitops.
2017-12-01 13:56:06 -08:00
Behdad Esfahbod 438c325a25 [set] Optimize add_range()
With new set implementation, this became really costy.  Optimize it.
There's more to be done, but this shaves off most of the fat.

Part of fixing https://bugs.chromium.org/p/chromium/issues/detail?id=782220
2017-12-01 13:34:14 -08:00
Behdad Esfahbod be9e307a88 [ot] Ensure layout in hb_ot_layout_table_get_lookup_count() 2017-12-01 12:37:05 -08:00
Behdad Esfahbod 16fba5b215 [ot] Fix Extension type recurse to disallow recursing to another Extension
Particularly hazardous if the second layer mixes forward and backward lookups.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4336
2017-11-29 16:08:11 -08:00
David Corbett 9f259769a6 Categorize U+A8B4 as Consonant_Medial 2017-11-21 13:48:32 -08:00
Behdad Esfahbod 8d55340593 Fix fallback positioning of double diacritic marks
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=787284
2017-11-20 19:43:22 -08:00
David Corbett 87d74605f5 Categorize U+0C80 as Consonant_Placeholder 2017-11-20 13:10:28 -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 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 173dab6300 Minor move 2017-11-14 21:27:24 -08:00
Behdad Esfahbod c6173a392c Add Offset16 and Offset32 2017-11-14 21:09:03 -08:00
Behdad Esfahbod 6f335ed1e5 Replace USHORT/SHORT/ULONG/etc with UINT16/INT16/UINT32/etc 2017-11-14 21:06:07 -08:00
Behdad Esfahbod a130ee6df5 Remove a couple of unused consts 2017-11-14 20:30:03 -08:00
Behdad Esfahbod e20e47eaa1 [glyf] Try fixing undefined-behavior
Might fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1463
2017-11-14 20:25:29 -08:00
Behdad Esfahbod 7b40876a58 [ot] Remove unneeded TODO item
Looks like hb-ot-font is complete after all!

CFF font names and CFF glyph metrics don't work though...
2017-11-14 20:22:05 -08:00
Behdad Esfahbod eab4feb5e2 [hmtx] Use curiously recurring template pattern
https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
2017-11-14 20:17:15 -08:00
Behdad Esfahbod 977ddff1f1 [ot] Move hb_ot_face_cmap_accelerator_t 2017-11-14 20:06:19 -08:00
Behdad Esfahbod a7f15959b5 Shuffle 2017-11-14 20:02:24 -08:00
Behdad Esfahbod a85d7ead04 [ot] Move hb_ot_face_metrics_accelerator_t 2017-11-14 20:00:34 -08:00
Behdad Esfahbod f00a94e1ec Adjust privacy for recent changes 2017-11-14 19:54:48 -08:00
Behdad Esfahbod 7e2839c438 [ot] Move hb_ot_face_glyf_accelerator_t 2017-11-14 19:52:29 -08:00
Behdad Esfahbod c4e18e54dc [ot] Move hb_ot_face_cbdt_accelerator_t 2017-11-14 19:52:26 -08:00
Behdad Esfahbod 9b04b0384f [ot] Fold hb_ot_face_post_accelerator_t 2017-11-14 19:31:50 -08:00
Behdad Esfahbod 702d86ba6b [ot] Fold hb_ot_face_kern_accelerator_t 2017-11-14 19:25:51 -08:00
Behdad Esfahbod 909de95a11 Minor build fix 2017-11-14 16:22:52 -08:00
Behdad Esfahbod e5930722d4 Fix invalid buffer access in OOM times
Hopefully fully fixes
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1856
2017-11-14 15:47:55 -08:00
Behdad Esfahbod fcd6c338ff Fix more compiler warnings 2017-11-14 15:04:19 -08:00
Behdad Esfahbod 7fdf16b2ce Fix compiler warning 2017-11-14 15:04:19 -08:00
David Corbett 87f0ad183c Allow U+20F0 in USE clusters 2017-11-14 15:04:10 -08:00
Behdad Esfahbod 93f7c1652a Revert "[glib/ucdn/icu/ft/ot] Make returned funcs inert"
This reverts commit 5daf3bd449.

If other atexit callbacks try to destruct the objects we destruct
in atexit callbacks, bad things will happen.

I'll come up with some other way to catch premature destruction
of HB-owned objects.

Fixes https://github.com/behdad/harfbuzz/issues/618
2017-11-14 10:59:54 -08:00
Behdad Esfahbod c48475f33a Whitespace 2017-11-13 20:26:29 -08:00
Behdad Esfahbod 83d6802736 Clean up GlyphID
After 4a27c17ea0 we do not need
the special GlyphID.cmp(hb_codepoint_t), so just make GlyphID
a typedef.

Fixes https://github.com/behdad/harfbuzz/issues/612
2017-11-13 20:25:02 -08:00
Behdad Esfahbod 7f39f57614 Implement strtod_l() on MSVC
Patch from Jean Ghali on mailing list.
2017-11-13 15:04:13 -08: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
Martin Hosken 4de03a1585 Fix graphite intergration reordered clusters problem 2017-11-10 16:24:06 -08:00
Behdad Esfahbod 8eed9cb11e [kern] Fix invalid memory access if offset is zero
If offset is zero, we return Null() object.  Wasn't prepared for that.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4088
2017-11-09 18:09:40 -08:00
Behdad Esfahbod c4f4c0a2fa Fix indexing in unsafe-to-break marking for 'stch' feature
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4099
2017-11-08 17:04:31 -08:00
David Corbett 5a9cba9744 Mark non-initial left matras as unsafe to break 2017-11-08 19:12:10 -05:00
Behdad Esfahbod a615030683 [kern] Implement format-2 kern subtable 2017-11-06 15:40:07 -05:00
Behdad Esfahbod 82a38d1f7a [kern] Allow subtables longer than 64kb
Apparently calibri.ttf does this:
https://github.com/fonttools/fonttools/pull/1094#discussion_r148933791
2017-11-06 15:28:24 -05:00
Behdad Esfahbod 625ae08fce [kern] Towards implementing format-2 2017-11-06 15:06:30 -05:00
David Corbett 74e82adaea Mark glyphs involved in 'stch' as unsafe to break 2017-11-06 15:06:23 -05:00
Behdad Esfahbod 5aad819433 Simplify tracing code when tracing is disabled
Fixes https://github.com/behdad/harfbuzz/pull/605
2017-11-03 17:18:17 -04: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 384862d7ee Remove NO_COPY() 2017-11-03 17:18:17 -04:00
Unknown 97145df249 Trivial typos
Found using `codespell -i 3 -w -I '../harf-whitelist.txt'`
whereas the whitelist contents were:
```
beng
iff
pres
ot
te
teh
```
2017-11-03 15:31:21 +02:00
Behdad Esfahbod 4b3278ef8d [ot] Hook up horizontal kerning to kern table
Seems to work.  Yay!

Still to do: run kerning if GPOS doesn't have 'kern' feature.
2017-11-01 19:41:29 -06:00
Behdad Esfahbod 77acc1106e [kern] More...
Almost there.
2017-11-01 19:40:51 -06:00
Behdad Esfahbod 49c0f35580 [kern] See if this helps with making VS bot happy 2017-11-01 18:16:07 -06:00
Behdad Esfahbod 2c439210c9 [uniscribe] Fix a couple of VS warnings 2017-11-01 18:13:35 -06:00
Behdad Esfahbod 4c43a23bf4 [kern] Implement Format0 2017-11-01 18:12:26 -06:00
Behdad Esfahbod ac3d937c6c [kern] Implement some more 2017-11-01 17:54:56 -06:00
Behdad Esfahbod 2a16f647ae [kern] Start implementing kern table
Pushing this out early to catch bot errors since I'm using template tricks
we were not using in HarfBuzz before.
2017-11-01 17:32:34 -06:00
ebraminio 102f5ead49
Enable PSVita (arm-none-eabi) compile again and add it to CI (#594) 2017-11-01 02:10:18 -07:00
Behdad Esfahbod 92bb508642 [indic] Use mutable for virama_glyph 2017-10-31 22:58:03 -06:00
Behdad Esfahbod 6c04dcb28d Use bsearch() for large SFNT table directories 2017-10-31 20:11:00 -06:00
Behdad Esfahbod b0e33da02d Add BinSearchArrayOf<> 2017-10-31 20:05:37 -06:00
Behdad Esfahbod aca378f51e Sanitize (Headless)ArrayOf()::len to ensure it doesn't use offsets 2017-10-31 18:11:10 -06:00
Behdad Esfahbod 5f04711314 Fix HeadlessArrayOf::sanitize_shallow() 2017-10-31 18:10:40 -06:00
Behdad Esfahbod 7ce9f397d1 Rename hb-sort-r.hh -> hb-dsalgs.hh 2017-10-31 16:54:31 -06:00
Behdad Esfahbod 8eaff980fc Remove HB_TAG_CHAR4 2017-10-31 16:54:31 -06:00
David Corbett d016c5bdb9 Categorize Grantha candrabindu for use in Tamil 2017-10-31 16:54:23 -06:00