Commit Graph

9135 Commits

Author SHA1 Message Date
Garret Rieger 5c4e0ffd97 [subset] Add a basic priority queue datastructure (binary heap). 2021-03-17 15:53:57 -07:00
Garret Rieger dd8e5d0e1b [subset] Only run the repacker for GSUB/GPOS. 2021-03-17 15:53:57 -07:00
Garret Rieger aaa7873d42 [subset] add topological sort by closest distance via Dijkstra's algorithm. 2021-03-17 15:53:57 -07:00
Garret Rieger 8ebe5d734f Implement will_overflow (). 2021-03-17 15:53:57 -07:00
Garret Rieger 6b1ea4cbe7 [subset] hook up the repacker to run if offset overflows are encountered during subsetting. 2021-03-17 15:53:57 -07:00
Garret Rieger f4c78cc7dd [subset] Implement Kahn's algo for topological sorting instead of BFS. 2021-03-17 15:53:57 -07:00
Garret Rieger 00f393dc3f [subset] finish up BFS sort implementation. 2021-03-17 15:53:57 -07:00
Garret Rieger 1584d3cb8f [subset] Start a proof of concept implementation of the GSUB/GPOS offset overflow resolver. 2021-03-17 15:53:57 -07:00
Qunxin Liu 56ca435787 [subset] fix for collect_features and remove_redundant_lamngsys
previously remove_redundant_sys () is missing in harfbuzz, after
redundant langsys removal, some features are removed as well in
prune_features() in fonttools. This change is trying to get the same
result between harfbuzz and fonttools.
2021-03-17 14:24:04 -07:00
Qunxin Liu 0e1c0fa404 [subset] optimize glyph closure method: step 5
add testcase and some fixes
2021-03-17 15:22:07 -06:00
Qunxin Liu b8a58a0c0b [subset] optimize glyph closure method: step 4
optimize recurse_lookups in Context/ChainContext
glyph closure, only the glyphs that the parent lookup
can apply the recursion to can participate in recursing
the lookup.
2021-03-17 15:22:07 -06:00
Qunxin Liu 62423504ee [subset] optimize glyph closure method: step 3
Add function intersects_coverage_glyphs that collects
set of matching glyphs in Coverage table
2021-03-17 15:22:07 -06:00
Qunxin Liu ef78d0f923 [subset] optimize glyph closure method: step 2
Add function intersects_class_glyphs that collects
set of glyphs matching class in ClassDef table
2021-03-17 15:22:07 -06:00
Qunxin Liu b4fc593c3c [subset] optimize glyph closure method: step1
Previous GSUB glyph closure is done by recursively visiting
all reachable lookup tables that apply to any glyphs in the
current/input glyph set, but actually only the glyphs that
the parent lookup can apply the recursion to can participate
in recursing the lookup. This is step 1 for glyph closure
optimization:
1. Add stack of currently active glyph set pointers into hb_closure_context_t
2. Update closure() method in simple GSUB tables to use
this stack in order not to change current glyph set at different stages
of recursion
3. Add function may_have_non_1to1() to GSUB tables
2021-03-17 15:22:07 -06:00
Garret Rieger 2df39bcae7 [subset] don't allocate a set to use as a glyph filter for PairPosFormat2. 2021-03-16 14:49:35 -07:00
Garret Rieger bb54e1047d [subset] Also filter class1 by coverage when collecting variation indices for PairPosFormat2. 2021-03-16 14:49:35 -07:00
Garret Rieger 190b7a98f8 [subset] Update PairPosFormat2 subsetting to match fontTools updated subsetting (https://github.com/fonttools/fonttools/pull/2221)
- subset class def 1 against the coverage table.
- Don't re-use class 0 in class def 2.
- Ignore class 0 glyphs for the purposes of determing format 1 vs format 2 encoding for ClassDef.

Add an additional test case which demonstrates these issues.
2021-03-16 14:49:35 -07:00
Khaled Hosny 03538e872a 2.8.0 2021-03-16 19:28:35 +02:00
Behdad Esfahbod 9e397ff2fb [buffer] Fix order of HB_INTERNAL HB_DISCARD
Sucks that has to be specified in this order. But that is what it is for now.

Was only exhibiting problem on C++>=17 since that's when the [[nodiscard]]
was introduced.
2021-03-15 16:51:17 -06:00
Behdad Esfahbod 8450f43ae1 [buffer] HB_NODISCARD next_glyph() 2021-03-15 16:01:35 -06:00
Behdad Esfahbod f4bc7673db [buffer] Implement copy_glyph() in terms of output_info() 2021-03-15 16:01:35 -06:00
Behdad Esfahbod f73982a699 [buffer] Implement replace_glyph() in terms of replace_glyphs(1,1)
I get exact same binary size with this, suggesting that compiler is
optimizing these as needed.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod 862f913489 [buffer] Implement output_glyph() in terms of replace_glyphs(0,1)
To my surprise, saves ~20kb in my build (non-size-optimized) build.
The output_glyph() method is never used in the fast paths, so doesn't
matter if is not fully optimized for the special case it is.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod 34a1204f10 [buffer] HB_NODISCARD output_glyph()
Also, generalize and use replace_glyphs() in morx where output_glyph() was used
in a loop.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod e6be9eb4fb [buffer] HB_NODISCARD output_info() 2021-03-15 14:12:10 -06:00
Behdad Esfahbod 2a0dbb3ee5 [buffer] HB_NODISCARD copy_glyph() 2021-03-15 14:10:39 -06:00
Behdad Esfahbod b05e5d9a79 [buffer] HB_NODISCARD next_glyphs() 2021-03-15 14:08:08 -06:00
Behdad Esfahbod 4ae8aab83b [buffer] HB_NODISCARD has_separate_output() 2021-03-15 14:01:52 -06:00
Behdad Esfahbod 8d3701f507 [buffer] HB_NODISCARD in_error() 2021-03-15 14:01:32 -06:00
Behdad Esfahbod 41e05479b6 [buffer] HB_NODISCARD shift_forward() 2021-03-15 14:00:00 -06:00
Behdad Esfahbod 83b3784d1d [buffer] HB_NODISCARD make_room_for() 2021-03-15 13:59:14 -06:00
Behdad Esfahbod c355508a89 [buffer] HB_NODISCARD ensure_glyphs() / ensure_unicode() 2021-03-15 13:58:30 -06:00
Behdad Esfahbod bc22305b6a [buffer] HB_NODISCARD ensure_inplace() 2021-03-15 13:57:18 -06:00
Behdad Esfahbod cac6c86d2f [buffer] HB_NODISCARD move_to() 2021-03-15 13:56:46 -06:00
Behdad Esfahbod 05d2d37f9a [buffer] HB_NODISCARD ensure() 2021-03-15 13:56:46 -06:00
Behdad Esfahbod d8028a0762 [buffer] HB_NODISCARD enlarge() 2021-03-15 13:34:36 -06:00
Behdad Esfahbod 3f1998a065 [buffer] HB_NODISCARD replace_glyph() 2021-03-15 13:33:44 -06:00
Behdad Esfahbod 607979d12f [buffer] HB_NODISCARD replace_glyphs() 2021-03-15 13:23:48 -06:00
Behdad Esfahbod 906c9928bb [buffer] Return success status from buffer ops that can fail
Previous error-handling philosophy was that user doesn't need to
immediately know whether operation failed. But as can be seen after
we added malloc-failing fuzzing, there's just so many places in the
code that a failure of these operations needs to be mitigated before
further operations. So I'm moving towards returning success here,
and possibly making it nodiscard.
2021-03-15 13:13:45 -06:00
Behdad Esfahbod a5b8e7db4d [hangul] Improve error handling
I did a review; changed some "return"s to "break"s, which should be identical.
Removed one check just before "continue" because not necessary.
The added error check is the actual fix.

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31755
2021-03-15 12:46:58 -06:00
Behdad Esfahbod 99767f9386 [hangul] Whitespace 2021-03-15 12:36:59 -06:00
Behdad Esfahbod 3622120fab [subset] Make ClassDef format2 .intersects() return false if range value 0
We treat Class0 as "doesn't intersect".  That's the only meaningful
interpretation. If one allos Class0 to mean "intersects", then the
intersects() result should be true iff glyphset is non-empty.

Related to https://github.com/harfbuzz/harfbuzz/issues/2703
2021-03-10 12:21:43 -07:00
David Corbett e19de65eae
Update hb-ot-tag-table.hh (#2890) 2021-03-08 10:12:47 -08:00
Khaled Hosny 7686ff854b
[ot] Keep substituted Default_Ignorables (#2886)
Don’t replace Default_Ignorables with zero-width space if they are
substituted or multiplied, not just when ligated.

After this change, HarfBuzz output matches that of Uniscribe and
CoreText for the new tests.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2883
2021-03-04 13:09:32 -08:00
Behdad Esfahbod 5efa04c890 [Makefile] Rebuild .def files if config changed
I was getting check-symbols failure because my previous build was
without CoreText, and after reconfiguring with CoreText, the old
harfbuzz.defs file was not being regenerated.
2021-03-02 16:30:13 -07:00
Behdad Esfahbod d351bbf0fb [Makefile] Remove unused variable HBNODISTHEADERS
Not sure what it was used for before.
2021-03-02 16:30:13 -07:00
Behdad Esfahbod fd489433a8 [indic] Fix cluster-merging logic with cluster-level=1
Was producing non-monotonic cluster numbers because our faulty logic
was not merging clusters if something from before base and after base
had switched positions.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2272
2021-03-02 16:30:09 -07:00
Behdad Esfahbod 2902529b92 [subset] Fix HB_TINY build
Fixes https://github.com/harfbuzz/harfbuzzjs/issues/34#issuecomment-789247723
2021-03-02 15:05:39 -07:00
Behdad Esfahbod 7cb22ba7eb
Include C headers with their C++ names (#2882)
Remove unnecessary includes.

Fixes build with some known broken SDKs (Nintendo Switch?)

https://en.cppreference.com/w/cpp/header

Fixes https://github.com/harfbuzz/harfbuzz/pull/2881
2021-03-01 11:44:06 -08:00
Behdad Esfahbod 486da35cc0 m Add comments to IntType cast out operator
Okay, bots seem to be happy. Merging.
2021-02-23 13:58:35 -07:00