Commit Graph

5105 Commits

Author SHA1 Message Date
Behdad Esfahbod d8c57e85d9 [GDEF] Move code around 2018-08-26 09:04:34 -07:00
Behdad Esfahbod 453e0c60b1 Add template keyword
I swear I have no idea why this is needed, but it is...
2018-08-26 01:30:52 -07:00
Behdad Esfahbod c44b0caf0d Fixup 2018-08-26 01:29:30 -07:00
Behdad Esfahbod 4096fbe487 [ot-face] Port GDEF to unified table accelerator model as well 2018-08-26 01:25:54 -07: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 963413fc54 WIP 2018-08-26 00:47:55 -07:00
Behdad Esfahbod e6cb938065 [ot-face] Unify accelerators and tables 2018-08-26 00:21:29 -07:00
Behdad Esfahbod 7f8b6fe67d Minor 2018-08-26 00:07:12 -07:00
Behdad Esfahbod 59bca0d2cb [ot-font] Rename 2018-08-26 00:06:12 -07:00
Behdad Esfahbod 1c48a7ef06 [ot-font] Cache tables on face, not font 2018-08-25 23:57:16 -07:00
Behdad Esfahbod 71f8893eff [ot-font] Use init0 2018-08-25 23:27:45 -07:00
Behdad Esfahbod f36ae6f8a8 [ot-font] Make everything (cmap/metrics) lazy 2018-08-25 23:26:45 -07:00
Behdad Esfahbod 62fc54725a [ot-font] Fallback vertical advance to UPEM
Used to be ascent+descent.  Whatever. This is more convenient for
upcoming changes.
2018-08-25 23:15:52 -07:00
Behdad Esfahbod d950022c8a Add hb-ot-face.cc/hh 2018-08-25 23:06:37 -07:00
Behdad Esfahbod dae39c58fb [face] Introduce character-map API
New API:
+hb_face_collect_unicodes
+hb_face_collect_variation_selectors
+hb_face_collect_variation_unicodes
2018-08-25 22:44:39 -07:00
Behdad Esfahbod 66384db97c Minor 2018-08-25 22:39:17 -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 82b12bcadd [unicode] Add HB_UNICODE_MAX
New API:
HB_UNICODE_MAX
2018-08-25 22:07:17 -07:00
Behdad Esfahbod b09a0336ca [cmap] More hb_auto_t<>(...) 2018-08-25 22:04:39 -07:00
Behdad Esfahbod 28634db07e [cmap] Fix skipping gid0 in Format4 collect_unicodes() 2018-08-25 21:23:43 -07:00
Behdad Esfahbod acce1fa3ea Use new hb_auto_t<> constructor with Coverage::Iter 2018-08-25 21:15:39 -07:00
Behdad Esfahbod ddea4d19cf Add 1-param passthrough constructor to hb_auto_t<>
And use.
2018-08-25 21:08:15 -07:00
Behdad Esfahbod c8cfb702e9 [cmap] Minor 2018-08-25 16:18:00 -07:00
Behdad Esfahbod 1dcf5fb038 [cmap Add hb_subset_collect_variation_unicodes()
To be moved to hb-face.h later.
2018-08-25 16:12:18 -07:00
Behdad Esfahbod 4806b3800d [cmap] Add hb_subset_collect_variation_selectors()
To be moved to hb-face later.
2018-08-25 15:58:40 -07:00
Behdad Esfahbod 3336de2479 [cmap] Remove unused code 2018-08-25 15:41:25 -07:00
Behdad Esfahbod 1becabe06c [cmap] Use bsearch to find subtables 2018-08-25 15:37:56 -07:00
Behdad Esfahbod 02fe03e09a [cmap] Factor out find_best_subtable 2018-08-25 15:33:05 -07:00
Behdad Esfahbod b41c43b4e1 Minor 2018-08-25 15:25:03 -07:00
Behdad Esfahbod 7d382fa276 [cmap] Implement collect_unicodes() for Format0/6/10 2018-08-25 09:42:52 -07:00
Behdad Esfahbod bd0e542525 [cmap] Simplify collect_unicodes()
Don't use accelerator (almost).  Hooks up Format13 as well.
2018-08-25 09:33:30 -07:00
Behdad Esfahbod d60c465627 Rename get_all_codepoints() to collect_unicodes() 2018-08-25 08:48:42 -07:00
Behdad Esfahbod 531051b8b9 [ot-font] Return char-not-found if mapped to gid 0
OpenType cmap table can use gid=0 to mean "not covered" to produce
more optimized cmap subtables.  Return false from get_nominal_glyph()
for those.  hb-ft already does this.
2018-08-25 08:44:18 -07:00
Behdad Esfahbod aadb2a9188 Add face-builder
New API:
+hb_face_builder_create
+hb_face_builder_add_table
2018-08-25 08:18:53 -07:00
Behdad Esfahbod 6cac9dc9cc [blob] Add as_bytes() 2018-08-24 10:29:45 -07:00
Behdad Esfahbod 29a9a08838 [sanitize] Document how sanitize machinery works 2018-08-24 10:24:45 -07:00
Behdad Esfahbod 142ac5a6be [serialize] Add copy_bytes() and copy_blob() 2018-08-24 10:07:49 -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
Emil A Eklund 22defe0965 Add guard around free_static_C_locale
Add HB_USE_ATEXIT guard around free_static_C_locale missed by previous
commit.
2018-08-14 18:10:17 -07:00
Emil A Eklund 7112c6413c Guard free_static function definitions with macro
Add HB_USE_ATEXIT macros around free_static function definitions to
avoid unused function compiler warnings/errors.
2018-08-14 14:04:10 -07:00
Behdad Esfahbod 63be5dcdde 1.8.8 2018-08-14 10:59:34 -07:00
Behdad Esfahbod c9a22fa124 [icu] Pass normalizer instance down as user_data 2018-08-13 17:02:21 -07:00
Behdad Esfahbod f0ef096b8c Don't add reference in get_unicode_funcs() functions
Users don't expect a new reference returned from a get() function.
Indeed, all users of that API I foud where NOT destroying the reference.
Just change the implementations to NOT return a reference.

This applies to the following APIs:
hb_unicode_funcs_get_default()
hb_glib_get_unicode_funcs()
hb_icu_get_unicode_funcs()

Fixes https://github.com/harfbuzz/harfbuzz/issues/1134
2018-08-13 10:30:41 -07:00
Behdad Esfahbod 9bbd1cdf06 [uniscribe] Use lazy loader
Fixes https://github.com/harfbuzz/harfbuzz/issues/1129
2018-08-12 18:20:53 -07:00
Behdad Esfahbod 2663689936 Another clang bot fix 2018-08-12 18:10:59 -07:00
Behdad Esfahbod 989e71a982 Silence clang 2018-08-12 17:47:59 -07:00
Behdad Esfahbod 6750ec692c [lazy] Use for C_locale 2018-08-12 17:42:16 -07:00
Behdad Esfahbod 747d2564e6 [lazy] Port more 2018-08-12 17:32:10 -07:00
Behdad Esfahbod 7bd508a0c4 [lazy] Rename free() 2018-08-12 17:19:55 -07:00
Behdad Esfahbod a3b97db910 [lazy] Port more to it 2018-08-12 17:14:32 -07:00
Behdad Esfahbod 6901090945 [lazy] Make hb_lazy_loader_t<> more usable 2018-08-12 16:59:37 -07:00
Behdad Esfahbod bb905e9afc [lazy] Minor 2018-08-12 16:44:44 -07:00
Behdad Esfahbod 3945cd78a9 Minor 2018-08-12 16:33:48 -07:00
Behdad Esfahbod c21a1b95df [icu] Use get_relaxed for normalizer access
We've had the proper barriers already.  No need for more with every access.
2018-08-12 16:30:39 -07:00
Behdad Esfahbod 125fefa2a6 [icu] Fix for breakage after recent change 2018-08-12 16:29:41 -07:00
Behdad Esfahbod 53442be1ed [lazy] Use for ft_library 2018-08-12 16:20:11 -07:00
Behdad Esfahbod 7a8d480378 [lazy] Add .free() 2018-08-12 16:00:13 -07:00
Behdad Esfahbod c7ca30a533 [ot/ft] Port font_funcs statis to lazy-loader 2018-08-12 13:46:53 -07:00
Behdad Esfahbod cb3fc3685c [ucdn/glib/icu] Port unicode_funcs statics to lazy-loader 2018-08-12 13:39:01 -07:00
Behdad Esfahbod 1b6b481262 [lazy] Allow calling fini() multiple times 2018-08-12 13:16:40 -07:00
Behdad Esfahbod 918ad9f5d9 [lazy] More 2018-08-12 13:12:29 -07:00
Behdad Esfahbod 5abdf5eeba [lazy] More shuffle 2018-08-12 12:48:44 -07:00
Behdad Esfahbod 5d9863be6e Minor 2018-08-12 12:27:47 -07:00
Behdad Esfahbod f9a3eab810 Add explicit_operator
Fixes https://github.com/harfbuzz/harfbuzz/issues/1127
2018-08-12 12:21:56 -07:00
Behdad Esfahbod 470acb6c32 Rename 2018-08-12 12:13:36 -07:00
Martin Hosken 39607dc98e Support _ in feature ids 2018-08-11 16:55:16 -07:00
Behdad Esfahbod 652cd45c65 [coretext] Another try 2018-08-09 01:02:02 -07:00
Behdad Esfahbod 3f3585ca14 Fix coretext build (hopefully) 2018-08-09 00:58:17 -07:00
Behdad Esfahbod aa3b6017ed Revert "[iter] Make operator bool explicit"
This reverts commit 66920a6bac.

Some of our bots (Oracle Studio and Apple gcc 4.2) do not allow
explicit except for constructors.

https://github.com/harfbuzz/harfbuzz/issues/1127
2018-08-09 00:56:28 -07:00
Behdad Esfahbod e1a2354220 [atomic] More 2018-08-09 00:53:25 -07:00
Behdad Esfahbod f1f4b45ac3 Fix lazy_loader fini()
Was creating object even if wasn't there.
2018-08-09 00:28:40 -07:00
Behdad Esfahbod 1f7380944d [atomic] Add hb_atomic_ptr_t<> and port all uses
Found and fixed a couple bugs.

Found a couple multithreading issues.  Marked them with "XXX-MT-bug".
2018-08-09 00:27:01 -07:00
Behdad Esfahbod 6e42f4c53f [atomic] Remove hb_atomic_int_impl_t now that it's always int 2018-08-08 22:51:35 -07:00
Behdad Esfahbod 1227a9e5a5 [atomic] Unify typedef
Removes volatile from fallback implementation.  That was handwavy
anyway.
2018-08-08 22:45:49 -07:00
Behdad Esfahbod 5cd1888c9d [atomic] Change Mac atomic int type to int
If ever int is not 32bit, we'll fix this...
2018-08-08 22:43:53 -07:00
Behdad Esfahbod e1de86eac1 [atomic] Change Windows atomic int type to int 2018-08-08 22:42:33 -07:00
Behdad Esfahbod aee2d10b2b [atomic] Change Solaris atomic int to signed 2018-08-08 22:40:10 -07:00
Behdad Esfahbod b6fdcf4f8b 1.8.7 2018-08-08 22:01:38 -07:00
Behdad Esfahbod 51ffc3e65a Fix previous commit to use atomic operations 2018-08-08 22:01:38 -07:00
Behdad Esfahbod 883957688c Fix assertion failure
https://bugzilla.mozilla.org/show_bug.cgi?id=1476334
2018-08-08 21:42:18 -07:00
Behdad Esfahbod e49a38b20e 1.8.6 2018-08-07 09:55:42 -07:00
Behdad Esfahbod b0ff79acd8 Add +hb_font_get_glyph_advances_for_direction
New API:
+hb_font_get_glyph_advances_for_direction
2018-08-07 09:52:06 -07:00
Behdad Esfahbod 28e2f467e1 Actually add hb_font_get_glyph_[hv]_advances
New API:
+hb_font_get_glyph_h_advances
+hb_font_get_glyph_v_advances
2018-08-07 09:47:00 -07:00
Behdad Esfahbod 996775191a Minor 2018-08-07 09:44:36 -07:00
Behdad Esfahbod 3d7c555a19 Remove get_advances_nil and alias it to get_advances_default 2018-08-07 09:37:52 -07:00
Behdad Esfahbod 66920a6bac [iter] Make operator bool explicit
We would need to write:

  for (Iter<T> it (...); bool (t); t++)

instead of:

  for (Iter<T> it (...); t; t++)

But I think it's an improvement in code readability in the long term.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1127
2018-08-06 15:32:13 -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 b912fbea17 Remove most uses of direct comparison to Null objects 2018-08-06 06:38:59 -07:00
Behdad Esfahbod 3506672ce9 Port _nil objects to Null() machinery
Finally, unified!
2018-08-06 06:17:48 -07:00
Behdad Esfahbod 1abd427acf [BASE] Rename horzi/vert to h/v 2018-08-06 05:53:35 -07:00
Behdad Esfahbod da48aca1be [BASE] Misc fixes
The code was badly broken.  In better shape now, but still, needs
a full review before ever working.
2018-08-06 05:52:12 -07:00
Behdad Esfahbod f9cfa5cb0e Change null-pool specialization to min_size again 2018-08-06 05:29:15 -07:00
Behdad Esfahbod 25147ff808 Move Null system to hb-null.hh 2018-08-06 05:01:52 -07:00
Behdad Esfahbod f800368df3 Remove unused macros 2018-08-06 04:58:34 -07:00
Behdad Esfahbod 19e0091299 Minor 2018-08-06 04:54:31 -07:00
Behdad Esfahbod 37be774af9 Minor 2018-08-06 04:52:12 -07:00
Behdad Esfahbod e1acff806b Move hb_vector_t to hb-vector-private.hh 2018-08-06 04:42:46 -07:00
Behdad Esfahbod be336dadc0 Move some more code around 2018-08-06 04:32:51 -07:00
Behdad Esfahbod 92806ee055 Move null data definitions to hb-static.cc
Also remove "    " null data for Tag.  Just use zeroes.
2018-08-05 21:41:52 -07:00
Behdad Esfahbod 1b4d5a2402 Minor 2018-08-03 19:55:09 -07:00
Behdad Esfahbod 7df7963b46 Make lazy loader deal with OOM 2018-08-03 19:54:33 -07:00
Behdad Esfahbod 30ff8ac865 Rename 2018-08-03 17:33:13 -07:00
Behdad Esfahbod 85ba4a190f [ot] Comment 2018-08-03 17:06:42 -07:00
Behdad Esfahbod 07afc1a213 [ot] Add misc tables to tables_t
Most unused.
2018-08-03 17:03:32 -07:00
Behdad Esfahbod 74b4df2cde [ot] Move GDEF into tables_t 2018-08-03 16:58:05 -07:00
Behdad Esfahbod 0271c7ab3b [ot] Move GSUB/GPOS into tables_t 2018-08-03 16:45:57 -07:00
Behdad Esfahbod f73d2775cf [ot] More shuffling
Misc. table loading now properly automated.
2018-08-03 16:34:25 -07:00
Behdad Esfahbod 52fbd23d86 [ot] Minor 2018-08-03 16:22:16 -07:00
Behdad Esfahbod 6a0a298aab [ot] Move code around 2018-08-02 23:13:19 -07:00
Behdad Esfahbod 5e718a751e [ot] Use switch for checking for blacklisted GDEF tables
Faster / more compact code.
2018-08-02 23:04:42 -07:00
Behdad Esfahbod b5cdf5280d [ot] In GDEF blacklisting logic, remove the glyph index check for Times
Just blacklist based on table sizes like we do for other fonts.
2018-08-02 22:56:42 -07:00
Behdad Esfahbod c988b11999 Move code around 2018-08-02 22:55:52 -07:00
Behdad Esfahbod 574b37e933 Minor 2018-08-02 02:22:38 -07:00
Behdad Esfahbod d4d1bf8177 Fix for recent rename 2018-08-02 02:04:02 -07:00
Behdad Esfahbod 91126aa11a [uniscribe] Update for recent changes 2018-08-02 02:03:13 -07:00
Behdad Esfahbod 66952ec47b Remove unused table reference 2018-08-02 01:45:12 -07:00
Behdad Esfahbod 443de26fa5 Minor 2018-08-02 01:43:02 -07:00
Behdad Esfahbod ee35af738b Make lazy-loader safe for nil objectification 2018-08-02 01:37:57 -07:00
Behdad Esfahbod 6404c49d07 Minor 2018-08-02 01:36:08 -07:00
Behdad Esfahbod ff7826e90b Reduce storage by sharing face amongst lazy_loaders 2018-08-02 01:29:05 -07:00
Behdad Esfahbod bdd3c11a19 Internal templatization of lazy-loaders 2018-08-02 01:09:14 -07:00
Behdad Esfahbod ed7b2e58fc Remove OT namespace from hb-machinery-private.hh 2018-08-02 00:08:08 -07:00
Behdad Esfahbod cb1491f92e Minor 2018-08-01 22:50:45 -07:00
Behdad Esfahbod 16ccfafbbd [face] Sprinkle const in the API 2018-08-01 22:50:06 -07:00
Behdad Esfahbod 3d22aefede Rename 2018-08-01 18:03:32 -07:00
Behdad Esfahbod 1a624c6e06 Add comment re (our only) race condition 2018-08-01 17:53:30 -07:00
Behdad Esfahbod 44d1fb37ef 1.8.5 2018-08-01 14:51:51 -07:00
Behdad Esfahbod 13f4c137c6 [atomic] Fix Solaris ones to add proper barriers 2018-08-01 14:15:00 -07:00
Behdad Esfahbod 19dfaa3515 [atomic] Remove volatile from IBM impl signature 2018-08-01 14:15:00 -07:00
Behdad Esfahbod 2093a3e0cb [atomic] Oops 2018-08-01 14:15:00 -07:00
Behdad Esfahbod 19b98348ff [atomic] Use read-barrier for get() 2018-08-01 14:15:00 -07:00
Behdad Esfahbod 006d4f031a [atomic] Some more minor tweaks 2018-08-01 14:15:00 -07:00
Ebrahim Byagowi 1a7fed6318
Revert "Add a new API, hb_ot_layout_get_feature_name_ids (#976)" (#1121)
This reverts commit 0c1b287b72.
2018-08-01 12:15:44 +04:30
Behdad Esfahbod dfc86e4b35 [atomic] Fix cast to fallback ptr_get() 2018-08-01 00:22:18 -07:00
Behdad Esfahbod 7a4d576e81 [gobject] Fix copy/paste error 2018-08-01 00:19:25 -07:00
Behdad Esfahbod ad27562742 [atomic] On IBM, use light-weight sync for everything
lwsync() is a full read/write-barrier.  That's all we need, never
need sync().  I'm not sure why an isync() was used in fetch_and_add,
but since that's a read-modify-write, I just changed it to have
lwsync() on both sides.
2018-07-31 23:01:05 -07:00
Behdad Esfahbod fd638d215f [atomic] Add XXX items around Solaris ops
Since add_int and cas are both read-modify-write, I wonder if we
also need a barrier after them.
2018-07-31 23:00:15 -07:00
Behdad Esfahbod 896ff15ae6 [atomic] Fix get() impl
Originally, glib's atomic_get was implemented as "memory_barrier; load".
I copied this into cairo, fontconfig, and harfbuzz.  However, that's
wrong.  Correct way is "load; memory_barrier".  The details are long
and hard to fully grasp.  Best to read:

  https://www.kernel.org/doc/Documentation/memory-barriers.txt

Also see my report against GNOME:

  https://gitlab.gnome.org/GNOME/glib/issues/1449

Note that this is irrelevant if C++11-like atomic ops are available.
2018-07-31 22:51:38 -07:00
Behdad Esfahbod d7a15799d4 [gobject] Hook up hb_map_t 2018-07-31 22:28:28 -07:00
Behdad Esfahbod 63c74e8d1d [atomic] Fix fallback impl 2018-07-31 22:21:21 -07:00
Behdad Esfahbod 4bc16aca47 [atomic] Add get_relaxed / set_relaxed
To help TSan and be more "correct".
2018-07-31 21:29:18 -07:00
Behdad Esfahbod 3dd1b88765 [atomic] Use CONSUME, not ACQUIRE, memory-order for get()
Although, all implementations just elevate that to ACQUIRE.
But requirement for us is just CONSUME.
2018-07-31 20:28:36 -07:00
Behdad Esfahbod 06b91d935d Revert "[atomic] Make pointer get op relaxed instead of acquire"
This reverts commit b1e5650c67.

After lots of head-scratching and finally finding the only truly
readable source to be the good old:

  https://www.kernel.org/doc/Documentation/memory-barriers.txt

I've convinced myself that we need consume memory-ordering on get().
The location of memory-barrier in a load should be after, not before
the load.  That needs fixing.  I'll do that separately.
2018-07-31 20:28:36 -07:00
Garret Rieger 2bdd903c69 [subset] limit the max codepoint value to the unicode limit.
When collecting all codepoints in the cmap avoid using large amount of memory for fonts that declare coverage over all 32 bit integers.
2018-07-31 18:40:38 -07:00
Garret Rieger 89733755a4 [subset] use add_array to populate feature_indexes.
This is much faster then calling a bunch of individual add()'s.
2018-07-31 18:26:09 -07:00
Garret Rieger 7d92bef9c5 [subset] collect features first, then use those to collect lookups. 2018-07-31 18:26:09 -07:00
Behdad Esfahbod af876cce30 [indic] Flip default logic for double-halants in old-school
Oriya went down from 9 to 2.

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707311 out of 707394 tests passed. 83 failed (0.0117332%)
GUJARATI: 366355 out of 366457 tests passed. 102 failed (0.0278341%)
GURMUKHI: 60729 out of 60747 tests passed. 18 failed (0.0296311%)
KANNADA: 951300 out of 951913 tests passed. 613 failed (0.0643966%)
MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
MYANMAR: 1115830 out of 1123883 tests passed. 8053 failed (0.716534%)
ORIYA: 42327 out of 42329 tests passed. 2 failed (0.00472489%)
SINHALA: 271596 out of 271847 tests passed. 251 failed (0.0923313%)
TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
2018-07-31 15:29:48 -07:00
Behdad Esfahbod 92ba9905ca [indic] Allow double-halant in old-spec Devanagari
Fixes https://github.com/harfbuzz/harfbuzz/issues/1071
2018-07-31 15:19:32 -07:00
Behdad Esfahbod 5772edc0ea [khmer] Typo 2018-07-31 14:10:31 -07:00