Commit Graph

536 Commits

Author SHA1 Message Date
Behdad Esfahbod c13ff39520 [layout] Rename apply_recurse_func to specialization of dispatch_recurse_func 2022-06-08 18:42:09 +01:00
Behdad Esfahbod 42051fe18a [layout] s/inplace/always_inplace/g 2022-06-08 04:00:21 -06:00
Behdad Esfahbod b96622d15c [layout] Use a cache for main input ClassDef of (Chain)ContextLookupFormat2
This commit adds a per-lookup caching infrastructure to GSUB/GPOS, and
uses it to cache input ClassDef.get_class value for (Chain)ContextLookupFormat2.

For fonts heavy on use of heave class-based2 context matching, this shows
a good speedup. For NotoNastaliqUrdu for example, I observe 17% speedup.

Unfortunately not many other lookups can use a cache like this :(.

https://github.com/harfbuzz/harfbuzz/pull/3636
2022-06-07 09:14:38 -06:00
Behdad Esfahbod 15543f70e0 [indic-like] Move allocation of syllable() buffer var to shapers that use it
In indic, we don't have a pause location release the var.
2022-06-05 08:15:47 -06:00
Behdad Esfahbod e6409d3905 Revert "[layout] Use a cache for main input ClassDef of (Chain)ContextLookups"
This reverts commit 57d1c08739.

Err. This was an accident.
2022-06-05 06:57:37 -06:00
Behdad Esfahbod 57d1c08739 [layout] Use a cache for main input ClassDef of (Chain)ContextLookups 2022-06-05 06:54:19 -06:00
Behdad Esfahbod 997d9cc466 [map] Make unique_ptr hashable 2022-06-02 18:47:42 -06:00
Behdad Esfahbod e9407a2bd2 Use shared_ptr<hb_set_t> in one place
See if valgrind is happy...
2022-06-02 12:00:43 -06:00
Behdad Esfahbod 3957d2927d [layout] Remove stale comment 2022-05-29 07:30:58 -06:00
Behdad Esfahbod 044d7a06db [indic-like] Add per-lookup per-syllable flag
This allows mix-and-matching per-syllable and other lookups.
In fact, removes the clear-syllables call completely.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3513
2022-03-28 17:39:54 -06:00
Garret Rieger b342adeb96 [reorg] Move GSUB into OT::Layout::GSUB namespace. 2022-03-23 18:05:24 -06:00
Behdad Esfahbod cad2fe8e63 [baseline] Fix HB_NO_METRICS build
Fixes https://github.com/harfbuzz/harfbuzz/issues/3482
2022-03-15 10:49:29 -06:00
Behdad Esfahbod a8a89b80b4 [layout] Whitespace 2022-03-15 10:48:03 -06:00
Behdad Esfahbod 6bf8f0a38f [baseline] Use ot-metrics fallback API 2022-03-15 10:44:41 -06:00
Matthias Clasen e7ab42b246 [layout] Fix handling of baseline variations
For BASE table format 1.1, the handling of design
space vs user space coordinates was inconsistent.
We were applying design -> user transformation
twice for the deltas, leading to wrong baseline
values.

Patch by Ebrahim Byagowi <ebrahim@gnu.org>

Fixes: #3476
2022-03-10 09:29:56 -07:00
Khaled Hosny 8d1b000a3e 4.0.0 2022-03-01 21:27:32 +02:00
Matthias Clasen 95bb2ff719 [ot-layout] Add central baselines
Add HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL
and HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_CENTRAL
which are the centers of the ideographic em-box
and face box.
2022-02-16 17:37:35 -06:00
Matthias Clasen f81578fd86 [ot-layout] Synthesize missing baselines
Add a variation of hb_ot_layout_get_baseline that
synthesizes missing baselines, using heuristics in part
taken from the CSS Inline Layout Module, Level 3.

Includes some new tests for synthesized baselines.
The base2.ttf is a subset of Noto Sans Bengali that
includes just the Bengali Ka.

New API: hb_ot_layout_get_baseline_with_fallback
2022-02-16 17:37:33 -06:00
Behdad Esfahbod 98079109e6 [ot-layout] Add +hb_ot_layout_get_horizontal_baseline_tag_for_script()
New API:
+hb_ot_layout_get_horizontal_baseline_tag_for_script()
2022-02-16 13:54:22 -06:00
Matthias Clasen 9909e33268 Improve docs for hb_ot_layout_get_ligature_carets
Add some relevant details to the documentation
for this function.

Fixes: #3168
2022-02-15 18:48:54 -06:00
Garret Rieger bc899650c7 [subset] Fix for issue #3397.
cur_intersected_glyphs gets modified during recursion leading to incorrect filtering of sub tables in some cases. So don't use cur_intersected_glyphs. Instead just add an additional entry onto the parent_active_glyphs () stack.

Additionaly expands NotoNastaliqUrdu tests to include coverage of the issue from #3397.
2022-01-28 14:20:33 -08:00
Behdad Esfahbod bea5369c6d [buffer] Rename swap_buffers() to sync() 2022-01-04 10:52:05 -07:00
Garret Rieger d67025705f [subset] reset the visited lookup count before each closure iteration. 2021-12-10 15:13:49 -07:00
Behdad Esfahbod 394f772937 [map] Allow storing classes in the hashmap
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293

The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Matthias Clasen 1e07d42aa6 Typo fix 2021-11-07 07:58:28 +02:00
Matthias Clasen 1fd7fd9823 Cosmetics: Avoid confusing indentation
This line had me confused for a second because
the condition looked like a cast and the if just
looked misplaced. Add a line break to prevent
such confusion.
2021-11-06 09:19:55 -07:00
Matthias Clasen 3471f8f69e docs: Clarify a doc comment
Reword the docs for hb_ot_layout_script_select_language and
be a bit more specific about the returned index.
2021-11-06 09:19:55 -07:00
Qunxin Liu 364b6b3989 [subset] Don't assume FeatureList is sorted
Though the spec said FeatureRecords are sorted alphabetically by feature
tag, there're font files with unsorted FeatureList. And harfbuzz is not
able to subset these files correctly because we use binary search in
finding featureRecords when collecting lookups. Also
find_duplicate_features needs to be updated to handle this.
2021-11-02 15:15:02 -07:00
Behdad Esfahbod 6d555ce82e [meta] Use std::forward instead of hb_forward() 2021-11-02 00:18:22 -06:00
Khaled Hosny b36f1510ec [doc] Add missing version tags 2021-09-18 23:09:07 +02:00
Behdad Esfahbod 95b04f7409 [buffer] Remove unnecessary have_separate_output() 2021-07-12 17:36:38 -06:00
Behdad Esfahbod 3807061d63 [ot-layout] Don't remove_output() before reverse substitution
No need anymore, because of new swap_buffers() semantics.

Just assert instead.
2021-07-12 17:36:22 -06:00
Behdad Esfahbod a7f4c985a8 [ot-layout] Always swap_buffers() even if no substitutions happened 2021-07-12 17:00:46 -06:00
Behdad Esfahbod 62b441e6ff [layout] Use Proxy::inplace instead of table index check
Equivalent.
2021-07-12 16:59:34 -06:00
Behdad Esfahbod 431f164003 [layout] Don't call clear_output() before pause-func 2021-07-12 16:57:25 -06:00
Behdad Esfahbod 1cb0ca1f2c Whitespace 2021-07-12 16:52:51 -06:00
Behdad Esfahbod 40884af17e [ot-layout] Narrow down random feature logic vs safe-to-break 2021-07-09 16:34:08 -07:00
Behdad Esfahbod 33b579d0ad [ot-layout] Clear random flag for subsequent flags
Ouch!
2021-07-09 16:34:08 -07:00
Behdad Esfahbod bb48bf52a4 Rename misc uses of "free"
In preparation for fixing https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Garret Rieger bc06af977f [subset] speed up feature collection when tags are specified.
Precompute a feature index filter to avoid needing to iterate the feature tag list for each encountered feature index. For this particular fuzzer case speeds up feature collection from 50s to 2s.
2021-06-20 17:45:19 -07:00
Behdad Esfahbod 93e6a9bc4e Revert "Remove unneeded buffer clear_output / remove_output calls"
This reverts commit 06175b7143.

One of the sanitizers is failing. Pushing again as PR to debug.
I have suspicions.
2021-06-15 15:38:49 -06:00
Behdad Esfahbod 06175b7143 Remove unneeded buffer clear_output / remove_output calls
Made sure clear_output is always paired with swap_buffers.
Trying to see if we can move towards RAII-like buffer iterators
instead of the buffer keeping an iterator internally.
2021-06-15 14:33:27 -06:00
Khaled Hosny a9fb6a0c3c [aat] Add start table/end table to buffer messages
Related to https://github.com/harfbuzz/harfbuzz/issues/3008
2021-06-06 10:35:28 -07:00
Behdad Esfahbod cf9538e808 Removal remaining uses of "blacklist" terminology 2021-06-04 22:33:16 -06:00
Khaled Hosny 90713f270e [hb-ot-layout] Document some return values 2021-04-30 14:05:33 -06:00
Qunxin Liu 0e1c0fa404 [subset] optimize glyph closure method: step 5
add testcase and some fixes
2021-03-17 15:22:07 -06:00
Behdad Esfahbod 8450f43ae1 [buffer] HB_NODISCARD next_glyph() 2021-03-15 16:01:35 -06:00
Khaled Hosny 5151c2b668 [introspection] Replace deprecated allow-none
Use optional or nullable as appropriate.
2020-12-30 19:21:49 -08:00
Khaled Hosny 8e8c3e5878 [docs] Complete hb-ot-layout docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny a8e72ee784 [docs] Use %true and %false consistently 2020-12-30 23:28:26 +02:00