Commit Graph

10541 Commits

Author SHA1 Message Date
Qunxin Liu 493e40ff78 [subset] add one empty byte to glyf table
if it's going to end up empty after subsetting
This will make OTS happy and match what fontTools is doing now.
2020-02-19 12:24:38 +03:30
Ebrahim Byagowi a7dec0cb51 [glyf] Tweak path_builder_t 2020-02-18 16:22:12 +03:30
Ebrahim Byagowi d52ea2a42c [glyf] minor 2020-02-18 15:46:02 +03:30
Ebrahim Byagowi 3b0c58f811 [glyf] minor, use private font coords to simplify 2020-02-18 15:43:25 +03:30
Ebrahim Byagowi dcd2729e71 [glyf] Move contour_bounds_t into scope it is actually used 2020-02-18 15:38:57 +03:30
Ebrahim Byagowi 8bb47fa17d [glyf] minor, spacing 2020-02-18 15:06:58 +03:30
Ebrahim Byagowi 21a5fe4f09 [glyf] Make returning phantoms to not require another vector 2020-02-18 14:38:55 +03:30
Ebrahim Byagowi 5c03fbe7e0 [glyf] do a phantom only iteration when possible 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 11f3fca01d [glyf/gvar] Remove need of passing end points vector around 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 0f2c2d989b [glyf] Push consumer machine one more level further 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 11f5f7c59c [glyf] Adopt a state machine like style for the path builder
Toward making glyf path reader alloc free at least on gvar absence.
2020-02-18 00:49:09 +03:30
Ebrahim Byagowi 60f8f384f9 [glyf] Switch to ttf-parser's glyf to path algorithm
It consumes each point at a time and doesn't need to know contour size before hand
2020-02-18 00:49:09 +03:30
ariza 3c792c2aa5 add test cases for hb_unwrap_type 2020-02-17 21:16:15 +00:00
ariza 168ceeac49 renamed to hb_unrwap_type(); now recursive 2020-02-17 21:16:15 +00:00
ariza 71552ecc26 add hb_get_type 2020-02-17 21:16:15 +00:00
ariza 6585846352 pop_pack(share=false) in end_serialize()
issue #2177
2020-02-16 17:16:29 -08:00
Michiharu Ariza 39fb57c0e4
add share option to pop_pack() (#2176)
as a solution for #2164
2020-02-16 08:38:41 -08:00
ariza 9c6499d9f4 rewrite read_points() to take lambda & consts args
replacing awkward x/y_setter_t structs
2020-02-16 00:56:31 -08:00
Ebrahim Byagowi a94d1af193 [fuzz] minor style fixes 2020-02-12 19:30:31 +03:30
Ebrahim Byagowi 1c015d3e9f [fuzz] minor fuzzer case move, oops 2020-02-12 19:19:37 +03:30
Ebrahim Byagowi 49341faee2 [fuzz] minor, move two fuzzer cases to their correct place 2020-02-12 19:17:18 +03:30
Behdad Esfahbod d663e28af1 [serialize] Catch signedness overflows in check_assign()
Should address https://github.com/harfbuzz/harfbuzz/pull/2163#pullrequestreview-355137936
2020-02-12 15:41:21 +00:00
Ebrahim Byagowi 97229244eb [fuzzer] Fix hb-set-fuzzer minor overflow issue
Size shouldn't be smaller than the struct not its pointer size.

Fixes https://crbug.com/oss-fuzz/20655
2020-02-12 15:41:51 +03:30
Garret Rieger 7b42403c1c Add explicit values to the set fuzzer enums. 2020-02-11 13:25:44 -08:00
Garret Rieger e805923310 Add a few basic seeds for the set fuzzer. 2020-02-11 13:25:44 -08:00
Ebrahim Byagowi ff984ed3cd Use multiplication to avoid undefined behaviour per clang
Newer versions of MSVC with /we4146 don't like putting negative sign behind a
unsigned number as https://github.com/harfbuzz/harfbuzz/pull/2069
That however have made https://crbug.com/1050424 this complain:
  src/hb-ot-color-sbix-table.hh:304:28: runtime error: negation of -2147483648 cannot be represented in type 'int';
                                        cast to an unsigned type to negate this value to itself
which apparently can be fixed using this change.

Let's see if this won't make another ubsan complain!
2020-02-11 19:51:52 +03:30
Ebrahim Byagowi 21e1b1310a [colr] minor style fix 2020-02-11 17:10:34 +03:30
Ebrahim Byagowi cbb45c3ee7 [subset/colr] minor improve to resolve msvc complain
MSVC says,
  hb-ot-color-colr-table.hh(215): warning C4700: uninitialized local variable 'new_record' used [build\harfbuzz-subset.vcxproj]
    harfbuzz-subset.vcxproj -> build\Debug\harfbuzz-subset.lib
2020-02-11 16:46:18 +03:30
Garret Rieger bca9bc6b92 Add hb-set-fuzzer.
It fuzzes all of the hb_set process methods (intersection, subtraction, union, and symmetric difference).
2020-02-11 03:08:39 +03:30
Ebrahim Byagowi 352ac63ef9 Fix an unlikely UAF on the deprecated _set_glyph_func API
Fixes https://github.com/harfbuzz/harfbuzz/issues/2168
2020-02-11 03:05:04 +03:30
Ebrahim Byagowi 6a390df8af [tools] Print unicode links on gen-* tools output
As Behdad's review
2020-02-10 17:20:09 +03:30
Evgeniy Reizner 4dc87365d7 Add links to files used by python scripts.
Closes #2150
2020-02-09 20:52:49 +03:30
Ebrahim Byagowi 40166eb0e5 [var] Fix the just introduced hb_font_set_var_coords_design storing bug
The memcpy call was using the current coords count which is zero initially so no copy at all.

Sad that no test has caught it, should see why, will however with the upcoming style API tests.
2020-02-08 13:22:01 +03:30
Ebrahim Byagowi 5c1a023f67 [tool] Optimize COLR glyph dump
Move palette colors fetching out of gid iteration so not
fetching all the colors of a palette each time.
2020-02-08 11:07:33 +03:30
Ebrahim Byagowi 0b76e8130e Don't use _normalize_variations to avoid twice axis fetch 2020-02-08 11:04:34 +03:30
Ebrahim Byagowi ab2d3ec542 [var] Implement hb_font_get_var_coords_design
Hold design coords and simulate when normalized coords are set directly.
2020-02-08 11:04:34 +03:30
Garret Rieger 5a10f3a055 Use vector instead of map during page compaction in hb-set. 2020-02-08 10:27:44 +03:30
Garret Rieger 2742c81624 Fix page_map corruption in hb_set_t during process().
If a process operation results in less pages then the current set has, it will likely corrupt the page_map since it overwrites page_map entries ahead of where it's processing. This fixes that problem by removing page_map entries that will be dropped. Then dropping orphaned pages and re-indexing retained pages.
2020-02-08 10:27:44 +03:30
Qunxin Liu eb7849a806 [subset] GPOS6 MarkToMark subsetting support 2020-02-06 10:46:05 -08:00
Qunxin Liu 82afc75835 [subset] GPOS4 MarkBase subsetting support 2020-02-06 10:46:05 -08:00
Ebrahim Byagowi 4dc3db7344 Minor, fix warnings raised when built with -std=c++2a
Follow up to c184180,

It was raising,

  src/hb-ot-layout-common.hh:1067:63: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
      | hb_filter ([=] (const OffsetTo<TSubTable> &_) { return (this+_).intersects (glyphset, lookup_type); })
                                                                ^
  src/hb-ot-layout-common.hh:1067:19: note: add an explicit capture of 'this' to capture '*this' by reference
      | hb_filter ([=] (const OffsetTo<TSubTable> &_) { return (this+_).intersects (glyphset, lookup_type); })
                    ^
                     , this

and

  src/hb-ot-layout-common.hh:2626:38: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
                  { r.collect_lookups (this, lookup_indexes); })
                                       ^
  src/hb-ot-layout-common.hh:2625:18: note: add an explicit capture of 'this' to capture '*this' by reference
      | hb_apply ([=] (const FeatureTableSubstitutionRecord& r)
                   ^
                    , this

and

  src/hb-ot-hdmx-table.hh:141:44: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
                          return device_record->widthsZ.as_array (get_num_glyphs ()) [_];
                                                                  ^
  src/hb-ot-hdmx-table.hh:137:17: note: add an explicit capture of 'this' to capture '*this' by reference
              | hb_map ([=] (hb_codepoint_t _)
                         ^
                          , this
2020-02-06 16:25:54 +03:30
Ebrahim Byagowi b4d3bf1d8a [draw] Add hb_draw_funcs_is_immutable and hb_draw_funcs_make_immutable 2020-02-06 11:52:32 +03:30
Ebrahim Byagowi 63b8190db8 [test] minor
Remained from previous naming.
2020-02-06 11:38:35 +03:30
Ebrahim Byagowi 3a98c7fae1 [glyf] Skip empty contours
As https://savannah.nongnu.org/bugs/index.php?57701
2020-02-06 11:35:48 +03:30
Ebrahim Byagowi c31762e9e8
[test] minor
don't test first ten glyph, just testing cp just like other API calls is enough
2020-02-05 23:12:37 +03:30
ckitagawa 03f778cf3c [cmap] remove dead code 2020-02-05 18:00:39 +03:30
Ebrahim Byagowi 43253e404d Merge remote-tracking branch 'upstream/master' 2020-02-05 17:45:19 +03:30
Ebrahim Byagowi 71a2018600 [cbdt] minor, tweak spaces 2020-02-05 17:40:51 +03:30
Ebrahim Byagowi eaa2402a79 [cbdt] Merge hb-ot-color-cbdt-table.cc into its header file
Not needed as far as can be said.
2020-02-05 17:09:12 +03:30
Ebrahim Byagowi a7f694d4b0 Merge branch 'subset_cblc' into master 2020-02-05 16:31:21 +03:30