Commit Graph

8286 Commits

Author SHA1 Message Date
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
blueshade7
51e7728521 minor 2019-11-26 18:34:06 +00:00
blueshade7
6d9eb9c040 fixed failure with language-tags.tests 2019-11-26 18:34:06 +00:00
blueshade7
59fe379797 fixed hb-shape-fuzzer failures in get_sid 2019-11-26 18:34:06 +00:00
blueshade7
e26df436bc fix test-ot-face crash 2019-11-26 18:34:06 +00:00
blueshade7
7b49042ef4 add cff1::get_glyph_name 2019-11-26 18:34:06 +00:00
blueshade7
ea8fdfa079 Merge branch 'master' into var-subset 2019-11-22 15:59:09 -08:00
Behdad Esfahbod
d5338ba189 [ft] Add locking FT_Face API
Now that we mutex our internal FT_Face, share it with clients.

New API:
- hb_ft_font_lock_face()
- hb_ft_font_unlock_face()
2019-11-22 16:22:27 -05:00
Behdad Esfahbod
e5c7ee9f75 [set] Fix undefined-behavior shift in _previous()
harfbuzz/src/hb-set.hh:138:43: runtime error: shift exponent 64 is too large for 64-bit type 'hb_set_t::page_t::elt_t' (aka 'unsigned long long')
2019-11-20 14:22:01 -05:00
Behdad Esfahbod
5fddc5f169 Use foreach_cluster 2019-11-20 13:07:26 -05:00
Behdad Esfahbod
e4a101ed38 [ft] Fix for HB_NO_VAR build 2019-11-19 20:04:00 -05:00
David Corbett
76c27462c2 Don’t modify a ccc to 6
ccc=6 will be used in Unicode 13.0.
2019-11-19 17:16:27 -05:00
Michiharu Ariza
8fdafee2a6 undef HB_STRING_ARRAY_LENG_NAME 2019-11-19 01:13:00 -05:00
blueshade7
5e9863f3c6 ARRAY_LENGTH fails with -Wglobal-constructors 2019-11-19 01:13:00 -05:00
blueshade7
a75983690d calculate hb_string_array length automatically 2019-11-19 01:13:00 -05:00
Khaled Hosny
57da16bc59 [cff] Check rcurveline and rlinecurve arguments
Make sure the number of arguments is not too many or too few, otherwise
skip the command.
2019-11-18 20:46:05 +02:00
Khaled Hosny
9f1524ce83 [cff] Fix a typo in processing rlinecurve
We want to process all pairs of arguments except the last 6 as lines, so
should have been subtracting 6 here, otherwise if the number of
arguments happens to be multiples of 6 they will be all treated as
curves.

See https://github.com/harfbuzz/harfbuzz/pull/2016#issuecomment-554640098
2019-11-18 20:46:05 +02:00
Behdad Esfahbod
78d5eca813 [set] Fix range-based-loop condition
Alternative to https://github.com/harfbuzz/harfbuzz/pull/2046
2019-11-18 13:09:29 -05:00
Hal Canary
4dae7cee4b [minor] Fix common typos: substition, the the.
s/substition/substitution/
s/the the/the/
2019-11-13 18:38:35 +03:30
David Corbett
e6351d9b2c Add ms-use/IndicShapingInvalidCluster.txt 2019-11-11 14:51:34 -08:00
David Corbett
b372c3e956 Insert a dotted circle within <U+0B85, U+0BC2> 2019-11-11 14:51:34 -08:00
Ebrahim Byagowi
64a45be519
[ubsan] Don't decrease pointer if match_glyph_data is null (#2048)
Similar to fix on https://github.com/harfbuzz/harfbuzz/pull/2022

Fixes https://crbug.com/1023070
2019-11-09 12:25:33 +03:30
Ebrahim Byagowi
486754a888 [serialize] Extract iterable copy, copy_all 2019-10-31 13:31:11 -07:00
Behdad Esfahbod
35218c488c Minor
Allow empty HB_VAR_ARRAY definition.  Though, doesn't compile with any
compiler I know of.
2019-10-31 13:19:44 -07:00
Behdad Esfahbod
1a1d64bc6f If applying morx, apply kern table even if GPOS is present and has kern
Since we won't be applying GPOS if morx...

To be adjusted as I receive more information from Ned.  But for now
fixes this:

$ ./hb-shape GillSans.ttc Ty
[T=0+1109|y=1@-128,0+769]

Fixes https://github.com/harfbuzz/harfbuzz/issues/1982 for now.
2019-10-31 12:51:40 -07:00
Behdad Esfahbod
3a74ee5282 2.6.4 2019-10-29 12:49:28 -07:00
Ebrahim Byagowi
3958f6fb23 Add in_range in hb_bytes_t to merge range_checker_t with it 2019-10-29 23:16:05 +03:30