Commit Graph

8512 Commits

Author SHA1 Message Date
ariza 1aed6d223c fix whence=Head; position as 28 bits 2020-02-21 10:17:25 -08:00
ariza 4ca8e0d989 re-implement Tail; rewrote name table with it 2020-02-21 10:17:25 -08:00
ariza c1313e4be2 minor: undid unintended change 2020-02-21 10:17:25 -08:00
ariza 9c65680b48 rename enums to avoid conflict on win 2020-02-21 10:17:25 -08:00
ariza 555f6f1daa merge add_link_abs() into add_link() 2020-02-21 10:17:25 -08:00
ariza 017cd945bf added add_link_abs() 2020-02-21 10:17:25 -08:00
Ebrahim Byagowi 07504569d5 [gsub] minor format 2020-02-21 13:05:44 +03:30
Garret Rieger 411225426f Fix glyph closure for alternate substitution.
It was not filtering on the glyphs to be retained.
2020-02-21 13:01:23 +03:30
Ebrahim Byagowi da37880e17 [draw] Add a private bit field instead null-checking quad-to callback
This doesn't imply the the design is good or stable just is better
to not fail due to null quad-to callback so as our quad-cubic curves
translation is currently table limited which can be revisited anytime.
2020-02-20 19:04:20 +03:30
Ebrahim Byagowi 8c652f72fc Minor, switch to https links where possible 2020-02-19 16:32:44 +03:30
Ebrahim Byagowi bbcbcafc25 [tool] Minor, move input files link 2020-02-19 16:21:47 +03:30
Ebrahim Byagowi 8d19907704 Remove python2 support from tests/utils scripts 2020-02-19 16:17:45 +03:30
Rico Tzschichholz 2c9fbf5561 Improve GIR build 2020-02-19 14:12:29 +03:30
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
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 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
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 3a98c7fae1 [glyf] Skip empty contours
As https://savannah.nongnu.org/bugs/index.php?57701
2020-02-06 11:35:48 +03:30
ckitagawa 03f778cf3c [cmap] remove dead code 2020-02-05 18:00:39 +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
Ebrahim Byagowi 43016715e1 [subset] minor on _subset 2020-02-05 15:02:20 +03:30
Ebrahim Byagowi dcb5dfc970 [subset] minor on tables iteration 2020-02-05 15:01:25 +03:30
Ebrahim Byagowi a8593339e2 [subset] minor on switch statements 2020-02-05 15:00:25 +03:30
Ebrahim Byagowi b1f63109c6 [subset] Optimize _is_table_present
One call for most of the fonts and no malloc
2020-02-05 00:30:40 +03:30
Ebrahim Byagowi 25707e37e3 [cff] minor 2020-02-05 00:27:28 +03:30
ckitagawa 0d61926ca7 [subset] Keep head when no glyf table 2020-02-04 23:31:33 +03:30
Ebrahim Byagowi 7f9b2228a6 [glyf] minor
Improve using https://developer.blender.org/diffusion/B/browse/master/source/blender/blenlib/intern/freetypefont.c$572
2020-02-04 23:05:49 +03:30
Ebrahim Byagowi 5b43603385 [subset] Rename _subset2 to _subset 2020-02-04 21:29:24 +03:30
ariza 2792fb8ba1 first rewrite of cff/cff2 _subset with _subset2 2020-02-04 21:20:43 +03:30
ckitagawa b114b26a56 Add guard to copy_glyph_at_idx 2020-02-04 09:49:24 -05:00
Ebrahim Byagowi b2a68ed587 [name] Minor, use subtraction instead ternary operator
Guess ternary was a bit more legible, apparently however we agreed to use subtraction,
https://github.com/harfbuzz/harfbuzz/pull/2139#discussion_r372582005
2020-02-01 23:16:45 +03:30
Qunxin Liu 490ef1cc23 [subset] Fix namerecord ordering
This will fix inconsistency with fontTools.
Also according to the spec, namerecords must be sorted
first by platform ID, then by platform-specific ID,
then by language ID, and then by name ID.
2020-02-01 23:07:47 +03:30
ckitagawa e128f80278 parent 777ba47b50
author ckitagawa <ckitagawa@chromium.org> 1579631743 -0500
committer ckitagawa <ckitagawa@chromium.org> 1580506176 -0500

[subset] Add CBLC support
2020-01-31 16:37:30 -05:00
Evgeniy Reizner b4377afd28 Minor hb_ot_layout documentation fixes. 2020-01-31 22:57:38 +03:30
Qunxin Liu 0216a96b0f [subset] Fix simple glyph trim_padding in glyf table
Detail: when numOfContours = 1 and flag = 0x31
xCoordinates and yCoordinates would be empty
2020-01-31 10:49:44 -08:00
Qunxin Liu b6a8f5e63c [subset] CMAP table subsetting fix
Not all codepoints smaller than 0xFFFF go to cmap4 table.
Only subset codepoints existing in each table.
This will also make harfbuzz consistent with fontTools' behavior
2020-01-31 10:49:44 -08:00
Ebrahim Byagowi 777ba47b50
Merge pull request #2132 from ckitagawa-work/subset_colr
[subset] Add COLR support
2020-01-30 22:38:43 +03:30
Ebrahim Byagowi 5b069c3612
[draw][docs] update to new terminology 2020-01-30 18:05:01 +03:30
Ebrahim Byagowi 920dca4550
[draw][docs] update to new terminlogy 2020-01-30 18:03:06 +03:30
Ebrahim Byagowi 1632726c1f
[draw] minor 2020-01-30 16:48:34 +03:30
ckitagawa 92f43a99c6 [subset] COLR, simplify logic and use add_array 2020-01-29 16:06:55 -05:00
ckitagawa fba5128a9e Fix build 2020-01-29 10:24:55 -05:00
ckitagawa 7d542a5274 Refactor to two iterators 2020-01-29 10:21:00 -05:00
ckitagawa 0aed54dca6 Use one-liner methods 2020-01-28 15:35:53 -05:00
ckitagawa 81c469eb62 Try to fix Wrange-loop-analysis 2020-01-28 15:35:53 -05:00
ckitagawa 0d1ba94ac7 Minor style fixes 2020-01-28 15:35:53 -05:00
ckitagawa ed857c4680 [subset] Add COLR support 2020-01-28 15:35:53 -05:00
Ebrahim Byagowi d106900bfd [draw][glyf] Implement quadratic to cubic call translation 2020-01-28 15:27:27 +03:30
Ebrahim Byagowi 74fdcdcac8 [draw] Rename conic_to to quadratic_to 2020-01-28 13:45:22 +03:30
Ebrahim Byagowi ac81e94016 Rename hb_outline_decompose to hb_font_draw_glyph and hb_outline_decompose_funcs_t to hb_draw_funcs_t 2020-01-28 13:24:49 +03:30
Ebrahim Byagowi cf5f946756 [outline] use hb_object_is_immutable instead comparing to Null 2020-01-27 23:43:54 +03:30
Ebrahim Byagowi 981125aa2a Rename hb_ot_glyph_* to hb_outline_* 2020-01-27 23:43:54 +03:30
Evgeniy Reizner cd7b46ca15 Use correct return type in _unsafe_to_break_find_min_cluster. 2020-01-26 23:59:36 +03:30
Ebrahim Byagowi cd266e4f3d
minor 2020-01-25 21:33:38 +03:30
Ebrahim Byagowi f9070cfef8 Run morx if run is horizontal or GSUB doesn't exist 2020-01-25 00:36:36 +03:30
Ebrahim Byagowi 8e0898080f [sbix] minor style fixes 2020-01-24 23:42:53 +03:30
Qunxin Liu 36a5c042d7 [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-24 23:17:04 +03:30
Ebrahim Byagowi b7762c7068 Disable hb_ot_glyph_decompose in HB_TINY 2020-01-24 21:20:07 +03:30
ckitagawa-work 0e4b2676bd [subset] sbix fix missed offset is_null() check 2020-01-24 20:46:07 +03:30
Ebrahim Byagowi 2d14735588 [src/main] separate the places use private API, minor 2020-01-24 19:56:06 +03:30
Ebrahim Byagowi 23277beef9 Fold src/test-ot-glyph and src/test-ot-color into src/main 2020-01-24 19:56:06 +03:30
Ebrahim Byagowi b72337e57e [test] Adopt test-ot-color with ot-glyph and remove freetype/cairo dependecy 2020-01-24 19:56:06 +03:30
Ebrahim Byagowi e171beeb5f Revert "[subset] Add "--name-languages" and "--name-legacy" options"
Causes tests failures, please reapply when tests are fixed, thanks.

This reverts commit fd85818b5b.
2020-01-24 19:51:32 +03:30
Dominik Röttsches 298c46afbf Only prefer AAT morx for horizontal layout
Fixes #2124.
2020-01-24 19:48:36 +03:30
Qunxin Liu fd85818b5b [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-23 17:24:05 -08:00
Qunxin Liu c370da45ff [subset] Cmap table: remove encodingRecord entry for empty cmap4 subtable 2020-01-23 17:23:55 -08:00
ckitagawa d3fff622b3 Move push call to caller 2020-01-23 23:46:22 +03:30
ckitagawa 7dc341fe74 [subset] Fix UBSAN issue in sbix 2020-01-23 23:46:22 +03:30
ariza 1ab3924b31 refix PR #2087 subset PairPos1
also added oss-fuzz 20211 data fixed by this
2020-01-23 10:50:52 -08:00
Ebrahim Byagowi 7633b7695e
Merge pull request #2016 from ebraminio/glyf
Implement glyph outline path API
2020-01-23 18:51:40 +03:30
Ebrahim Byagowi 02f324c949 [ot-glyph] remove open callback
Apparently it wasn't requested actually and can be detected easily
as paths are opened usually when move command is issued anyway.
2020-01-23 15:12:15 +03:30
Ebrahim Byagowi 684ff3e0cd [ot-glyph] noop->nil, fix close path 2020-01-23 14:48:59 +03:30
ckitagawa 3747b329b2 Address garretrieger@'s comments 2020-01-22 10:11:15 -08:00
ckitagawa af62c1c3b0 Fix style issue 2020-01-22 10:11:15 -08:00
ckitagawa 8614a30bc9 [subset] Fix sbix fuzz problem 2020-01-22 10:11:15 -08:00
ariza 72cbfb9059 remove empty lookup subtables
Added a variant of subset_offset_array which takes an extra arg passed to serialize_subset for this impl.
Added a new api test "test-subset-gpos" for this.
2020-01-21 16:53:19 -08:00
Michiharu Ariza 8f49aaa16f
minor: un-include glyf.hh in gvar.hh 2020-01-16 15:15:15 -08:00
Michiharu Ariza c828d7bf76
[subset] fixed GPOS device table sanitize & serialize (#2087) 2020-01-15 15:32:44 -08:00
Qunxin Liu e565d1f9bc [subset] subset lookup/feature/script lists for GSUB/GPOS 2020-01-15 14:04:33 -08:00
ckitagawa 93376a6436 Add unittests 2020-01-15 13:36:01 -08:00
ckitagawa 6bcf57eaa3 Simplify copy and add fuzzing coverage 2020-01-15 13:36:01 -08:00
ckitagawa 78b50a67be Address initial comments 2020-01-15 13:36:01 -08:00
ckitagawa 43b6c865ae [subset] Support sbix subsetting 2020-01-15 13:36:01 -08:00
Ebrahim Byagowi 79fed9a1e4 [ot-glyph] Add open/close callbacks 2020-01-14 17:34:59 +03:30
Ebrahim Byagowi ec1fba1388 [ot-glyph] make hb_ot_glyph_decompose_funcs_t struct opaque 2020-01-14 15:55:23 +03:30
Qunxin Liu 8ffc9add22 [subset] layout closure_features and store them in subset-plan 2020-01-14 07:24:48 +03:30
Dominik Röttsches 66dfd605b5 Fix duplicate check in hb_ot_rotate chars
Fixes #2099. Fix indentation in mirroring section as well.
2020-01-13 18:20:12 +03:30
Ebrahim Byagowi d7c3cb18ee [ot-glyph] minor on tests 2020-01-13 18:17:21 +03:30
Ebrahim Byagowi dc03a993d0
Fix collect lookups logic of FeatureTableSubstitution (#2097)
https://crbug.com/oss-fuzz/20036
2020-01-12 14:21:29 +03:30
Ebrahim Byagowi a32ecc15ae
Fix collect lookups logic of FeatureVariationRecord
As "Offset to a feature table substitution table, from beginning of the FeatureVariations table."
from https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2 the record should
match its sanitize logic not the reverse way.

Fixes https://crbug.com/oss-fuzz/20021 and https://crbug.com/oss-fuzz/20022
2020-01-11 15:37:24 +03:30
Ebrahim Byagowi 1a4c658b43
Use REPLACEME tag
So we can use the version we like when we decide what it should be while the next release
and can review the API before the release one other time.
2020-01-11 01:30:05 +03:30
Qunxin Liu 0b39c48064 [subset] closure lookups for GSUB/GPOS 2020-01-10 13:11:06 -08:00
Ebrahim Byagowi 42f4f1ea50 [ot-glyph] Add tests for hb_ot_glyph_decompose 2020-01-11 00:33:31 +03:30
Ebrahim Byagowi 06a1fcb3b4 [ot-glyphs] fix the tests 2020-01-10 23:12:30 +03:30
Ebrahim Byagowi 084a8182fb [ot-glyphs] Move CFF glyph decompose logic to their tables
Thus making path decompose zero alloc on CFF/CFF2
2020-01-10 22:56:43 +03:30
Ebrahim Byagowi 6118523502 [ot-glyph] move glyph decompose logic of glyf to itself
One less vector allocation yet isn't zero alloc yet
which needs more work.
2020-01-10 21:08:26 +03:30
Ebrahim Byagowi 017f606c83 [ot-glyph] rewrite the API 2020-01-10 20:44:15 +03:30
Ebrahim Byagowi 05443e55bc [ot-glyph] Return empty path for empty faces 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 6e7602c104 [ot-glyph] Fix leaks 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 5b08596d60 [gvar] Don't apply anything when no coords is given 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 742aaa1363 [ot-glyf] Fix leak issue 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi fddf79fc37 [glyf] minor 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 0b559d750f [ot-glyph] Improve API names 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi af08f388ab [ot-glyph] Support CFF1's seac 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 04ac7fb1c9 [ot-glyph] Add cff2 support 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 5cc09c462b [ot-glyph] Initial cff1 support 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 3dcba9f215 [ot-glyph] Redesign the API 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi b8b3ff1a02 [glyph] Don't copy, write directly into result 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi f883c31cce Implement glyph outline path API
Got help from https://github.com/opentypejs/opentype.js/blob/4e0bb99/src/tables/glyf.js#L222
2020-01-10 14:25:06 +03:30
Michiharu Ariza d2ab1ec65b fixes oss-fuzz 19978: Null-dereference READ (#2091) 2020-01-10 07:54:16 +03:30
Ebrahim Byagowi 5e55a6d691
[subset/hvar] minor
not super excited about state of the code around, assuming was needed
so let's add this may unlikely check also.
2020-01-09 23:40:40 +03:30
Ebrahim Byagowi 257a197ae7
Fail serialize when map has incorrect value
fixes https://crbug.com/oss-fuzz/19956

am not super happy with the fix, guess we should do some check
before the memcpy anyway as @blueshade7 thinks also,
so let's have it or revert it when we have a better approach for the case.
2020-01-09 22:55:45 +03:30
Qunxin Liu 1db2c1d0da fix for cmap4 and OS_2 subsetting: maximum character code allowed is 0xFFFF 2020-01-09 10:00:32 -08:00
Ebrahim Byagowi 7950beecfc
[subset] Fix null pointer dereference in hvar/vvar subset (#2085)
Rest of the code assumes there is at least one subtable, lets return here if not.

* https://crbug.com/oss-fuzz/19827
* https://crbug.com/oss-fuzz/19847
2020-01-06 21:25:00 +03:30
Ebrahim Byagowi 8ed27757b1
Remove _POSIX_C_SOURCE definition from the project
Added fpr suncc support but apparently is causing more issues
even on suncc so let's see if we can go without it.

Fixes #2084
2020-01-06 19:01:13 +03:30
Ebrahim Byagowi e7d1aeb610
[hvar] minor, fix unlikely statement 2020-01-06 12:48:22 +03:30
Ebrahim Byagowi 57b1534198
[glyf] minor, fix unlikely statements 2020-01-06 12:46:50 +03:30
Ebrahim Byagowi 9e48c6e9ef minor, use private API of hb_set_t where possible 2019-12-31 15:57:39 +03:30
Ebrahim Byagowi ce114d6b27 minor, tweak spaces 2019-12-31 15:53:02 +03:30
Ebrahim Byagowi 33c3d63a0a
Merge pull request #1594 from harfbuzz/var-subset
Issue 1558: [subset] TrueType/CFF2 variable font
2019-12-31 13:52:50 +03:30
Khaled Hosny 68c1798a67 [coretext] Use kCTFontOpenTypeFeatureTag
Instead of trying to map OpenType features to AAT feature selectors
which only works for a small subset of OpenType features, use the
simpler kCTFontOpenTypeFeatureTag with OpenType feature tags directly.

With this change, features like cvXX can be enabled in coretext shaper,
while they were previously ignored due to missing mapping.

This seems to work even with AAT fonts that don’t have OpenType layout
tables, which suggests that CoreText is doing the mapping itself in this
case.

kCTFontOpenTypeFeatureTag seems to have been introduced in macOS 10.10
and iOS 8.0, though, so its use is conditional on version check for now.
Not sure how to check iOS version, so I left this out.
2019-12-22 06:27:48 -08:00
Marcel Fabian Krüger b28c282585 Check to avoid overflows 2019-12-16 18:08:22 -08:00
Marcel Fabian Krüger d70afb1e5a Clamp max_ops to upper bound in hb-sanitize.hh 2019-12-16 18:08:22 -08:00
Evgeniy Reizner b79ceac3c6 Prefer UINT_MAX instead of uint overflow.
Also, prefer HB_FEATURE_GLOBAL_START and HB_FEATURE_GLOBAL_END.
2019-12-15 11:46:05 -08:00
Evgeniy Reizner b618e0ae13 Remove non-breaking spaces from comments.
`0xC2A0` was used, for some reasons. It's not really a problem, but Qt Creator
constatly trying to replace them with regular spaces, so I have to edit those
files separately.
2019-12-15 10:12:22 -08:00
Evgeniy Reizner 780d640c02 Remove unnecessary check in hb_buffer_t::set_masks.
Bounds are already checked by the caller.

Closes #2073
2019-12-15 10:08:38 -08:00
Evgeniy Reizner 34ed8e7218 Prefer _hb_glyph_info_is_unicode_mark where possible. 2019-12-13 08:55:34 +03:30
Ebrahim Byagowi 3e1a2632dc
[unscribe] fix leak issue
with no user_data provided, `free` will be called with `(0)` thus silently having a leak
2019-12-12 15:48:27 +03:30
Daeren 4ef597e170 Fix unary minus operator applied to unsigned int
Applying unary minus operator to unsigned int causes the following error on MSVS: error C4146
This patch fixes the error.
2019-12-11 09:19:28 -06:00
Daeren 1770493cf5 Fix unary minus operator applied to unsigned int
Applying unary minus operator to unsigned int causes the following error on MSVS: error C4146
This patch fixes the error.
2019-12-11 09:19:19 -06:00
Behdad Esfahbod a061e47fcc Change a few HB_INTERNAL static methods to static inline 2019-12-10 13:31:50 -06:00
Behdad Esfahbod dd3972a364 [GSUB] Simplify Extension is_reverse()
We don't allow extension lookups to chain to another extension lookup.
Simplify code for that.
2019-12-10 13:28:39 -06:00
Behdad Esfahbod 858b627984 [machinery] Remove CastR<>() 2019-12-10 13:18:32 -06:00
Behdad Esfahbod b84ceb2fcf [machinery] Remove CastP 2019-12-10 13:02:48 -06:00
Behdad Esfahbod 85574ec287 [machinery] Minor 2019-12-10 12:52:32 -06:00
Behdad Esfahbod 6a60ca117c [algs] Fold last other bsearch() in
Now truly have only one bsearch implementation.
2019-12-10 12:32:59 -06:00
Behdad Esfahbod 39afe608b4 [algs] Fold one more custom bsearch() in
One more to go.
2019-12-10 12:13:40 -06:00
Behdad Esfahbod b1dc676eaa [algs] Reduce one more bsearch() impl
Ouch, there were three more left.  Down one.  Two to go.
2019-12-10 12:13:40 -06:00
Behdad Esfahbod f47cbade18 [aat] Adjust fallback positioning logic
Fixes https://github.com/harfbuzz/harfbuzz/issues/1528

Wish could add a test...

$ ./hb-view --font-file Thonburi.ttc --unicodes U+0E17,U+0E35,U+0E48,U+0E4A --shaper ot

                   ▃

         ▂▃▃▄▃▂▁▊        ▃  ▃       ▎
      ▗   ▅▆▆▅          ▌ ▆▆▅▆▙ ▌▗
     ▗                  ▙ ▂  ▎▗   ▟
     ▅▆▆▆▇▇▇▇▇▇▇▆▆▅▄     ▇▅▅▅ ▙▆▇
    ▁▁▂▁       ▁▁
         ▖                    ▖ ▂▂
  ▉   ▁        ▆▆        ▌   ▆  ▙▄ ▁▁
   ▙            ▉      ▃▖           ▟
      ▊         ▉      ▅▟           ▗▄
      ▊         ▉     ▗ ▏           ▇▆
      ▊    ▟    ▉      ▆             ▖
      ▊         ▉        ▌        ▂
      ▊   ▏     ▉           ▌ ▗   ▄▟
      ▊                        ▆
2019-12-09 18:11:04 -06:00
Behdad Esfahbod fa7edf87c9 [bsearch] Massage API some more 2019-12-09 17:51:41 -06:00
Behdad Esfahbod 70aa5071d8 [algs] Adjust return value of hb_ctz(0) to be 32 instead of 0 2019-12-09 17:48:10 -06:00
Behdad Esfahbod eefb78f674 Minor 2019-12-09 17:46:56 -06:00
Behdad Esfahbod 9fb030585a Rename start/end to first/last in RangeRecord
Because that's what they are.
2019-12-09 17:46:08 -06:00
Ebrahim Byagowi 9b1d5c4a59
[number] fix where strtod_l not available 2019-12-09 12:29:28 +03:30
Ebrahim Byagowi 5c8f960289
[number] minor, include the renamed header 2019-12-09 10:48:43 +03:30
Behdad Esfahbod 48eef2724c [algs/array] Consolidate the last two bsearch implementations!
Yay!  Seems to work.
2019-12-06 05:04:11 +00:00
Behdad Esfahbod ed35dea8c0 Fourth try... sighs 2019-12-06 04:37:11 +00:00
Behdad Esfahbod 9168310bb4 Fix build, third times... 2019-12-06 04:28:06 +00:00
Behdad Esfahbod 34f5cc2cc8 Second try at fixing build 2019-12-06 04:09:33 +00:00
Behdad Esfahbod 14ce5ab0b7 First try at fixing build errors 2019-12-06 03:54:46 +00:00
Behdad Esfahbod 2274270c6a [algs] Streamline bsearch some more 2019-12-06 03:42:21 +00:00
Behdad Esfahbod bd55d4b49f [algs] Streamline bsearch() API more towards hb_array_t::bsearch_impl()
Preparing to merge the two finally!
2019-12-06 03:35:24 +00:00
Behdad Esfahbod fd6df520a1 [array] Isolate bsearch implementation more 2019-12-06 03:01:34 +00:00
Behdad Esfahbod 06d3c2019f [array] Simplify bfind() positioning
I had copied the old scheme from fontconfig's fccharset.c.  I just
convinced myself that this change is correct and produces exact
same results.  But I also am skeptical.  Anyone else feel like
convincing themselves as well please?
2019-12-06 02:52:54 +00:00
Ebrahim Byagowi d67ba649a3 Rename hb_array_t::in_range to hb_array_t::check_range 2019-12-06 02:27:23 +00:00
Ebrahim Byagowi 72d83a0280 Make hb_array_t::in_range similar to hb_sanitize_context_t::check_range 2019-12-06 02:27:23 +00:00
Behdad Esfahbod 2dc20e632e Implement fallback vertical shaping from Firefox
Fixes https://github.com/harfbuzz/harfbuzz/issues/355
2019-12-05 15:28:42 +00:00
Behdad Esfahbod b6d0f1529d [indic] Fix old-spec base-finding logic w vatu feature
Fixes https://github.com/harfbuzz/harfbuzz/issues/1587
2019-12-05 12:19:52 +00:00
Behdad Esfahbod 0414341ac5 Prefer AAT shaping over OT if both available
Fixes https://github.com/harfbuzz/harfbuzz/issues/1529
2019-12-05 11:26:39 +00:00
blueshade7 82545c5e2b more coding style fixes 2019-11-26 18:34:06 +00:00
blueshade7 2e7c1239c8 minor: coding style 2019-11-26 18:34:06 +00:00
blueshade7 ab525ac66d fix HB_TINY buid 2019-11-26 18:34:06 +00:00
blueshade7 ff64652cf6 fix shape-fuzzer failure 2019-11-26 18:34:06 +00:00
blueshade7 a333b0f717 add hb-ot-cff1-std-str.hh to Makefile.sources 2019-11-26 18:34:06 +00:00
blueshade7 61707266a3 fix get_sid crash 2019-11-26 18:34:06 +00:00
blueshade7 4c4e08a1ef add cff1::accelerator_t::fini 2019-11-26 18:34:06 +00:00
blueshade7 ff87465b40 add get_glyph_from_name & test. use hb_string_array 2019-11-26 18:34:06 +00:00