Commit Graph

8617 Commits

Author SHA1 Message Date
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
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
Ebrahim Byagowi aa3831e295 [glyf] Use contour_bounds_t::empty to simplify get_extents logic 2019-10-29 22:34:14 +03:30
Ebrahim Byagowi d59ae5836d [glyf] Refactor contour_bounds_t use to make its fields protected 2019-10-29 22:34:14 +03:30
Behdad Esfahbod 773ee8041e
Merge pull request #2038 from ebraminio/glyf-contour
Remove contour_point_t so we won't need to zero its unused var
2019-10-29 10:58:56 -07:00
Ebrahim Byagowi 0efbda7a40 Remove contour_point_t so we won't need to zero its unused var 2019-10-29 21:03:26 +03:30
Behdad Esfahbod 47b4074d5f
Merge pull request #2034 from khaledhosny/cmap-notdef
[cmap] Check GID before adding ranges in format 4 & 12
2019-10-29 03:16:34 -07:00
jfkthame dd8a846037
Use proper y-scale factor for height value 2019-10-29 09:20:41 +00:00
Behdad Esfahbod 7152ac3fcf Fix build
$ make CPPFLAGS="-DHB_TINY -DHB_NO_OT_FONT" libharfbuzz-subset.la
2019-10-28 17:12:55 -07:00
Khaled Hosny dd288840d6 [cmap] Check GID before adding ranges in format 4 & 12
Fixes https://github.com/harfbuzz/harfbuzz/issues/2031
2019-10-29 02:09:13 +02:00
Behdad Esfahbod fd71c045b4 Hopefully fix up previous commit and bots 2019-10-28 17:06:53 -07:00
Behdad Esfahbod e832dc4c64 [config] Make HB_NO_ERRNO work with systems defining errno as a macro 2019-10-28 17:02:40 -07:00
Behdad Esfahbod ce11df1b5b 2.6.3 2019-10-28 14:46:59 -07:00
Behdad Esfahbod 5a59de2b98 Actually add +hb_font_get_nominal_glyphs()
New API:
+hb_font_get_nominal_glyphs()
2019-10-28 14:46:59 -07:00
Behdad Esfahbod 03028a5fe5 Revert "Don't include codepoint 0 in the results of collect_unicodes."
This reverts commit 14ad96ffbf.

This was wrong.  My bad!

https://github.com/harfbuzz/harfbuzz/issues/2031
2019-10-28 13:46:56 -07:00
Garret Rieger 14ad96ffbf Don't include codepoint 0 in the results of collect_unicodes.
It is always assumed to be the notdef glyph.
2019-10-28 12:56:04 -07:00
Ebrahim Byagowi aca6390281 [gpos] Don't move pointer when match_glyph_data is not set 2019-10-28 22:17:48 +03:30
Qunxin Liu defe9b6da0 crash fix : Heap-buffer-overflow READ 2
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18513
2019-10-25 13:09:47 -07:00
Qunxin Liu b2fcca6e14 fuzzer crash fix
https://oss-fuzz.com/testcase-detail/5643107869917184
2019-10-24 16:11:30 -07:00
Behdad Esfahbod 5e489670e1 Remove hb-warning.cc
Fixes https://github.com/harfbuzz/harfbuzz/issues/2005
2019-10-22 15:03:47 -07:00
Garret Rieger 05bcdb39d8 Add a specialization of array_t:hash for hb_bytes_t and hb_ubytes_t. 2019-10-22 13:33:50 -07:00
Garret Rieger 95ab110cd9 Optimize intersects_array to fix fuzzer timeout. 2019-10-22 13:33:50 -07:00
Garret Rieger be5cdcdfa2 Store the hash value of a key in item_t in hb_map to reduce the number of hash computations. 2019-10-22 13:33:41 -07:00
Qunxin Liu b33a0d628e fuzzer crash fix: Null-dereference WRITE
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18363
2019-10-22 01:01:08 +03:30
Qunxin Liu 1f0a9d9be9 [subset] GPOS Lookup Type 2: PairPos 2019-10-21 12:35:28 -07:00
Qunxin Liu b66094ada0 [subset] GSUB Lookup Type 6: ChainContextSubst 2019-10-18 16:52:55 -07:00
Garret Rieger eff91bbb4b Add missing pop() for the failure case of script subsetting. 2019-10-18 15:10:30 -07:00
Garret Rieger eab191fd9c Rewrite hash and == function for hb_array_t as a plain loop.
Profling showed that the current implementation were accounting for nearly all processing time in some cases. These implementations look to be about 10x faster.
2019-10-18 15:10:30 -07:00
Garret Rieger 831daf4c76 Enforce HB_MAX_LANGSYS limit during layout subsetting. 2019-10-18 15:10:30 -07:00
Garret Rieger 9871461bce Enforce HB_MAX_SCRIPTS during subsetting of the script table. 2019-10-18 15:10:30 -07:00
Behdad Esfahbod 029775bcbd [buffer] Minor; improve HB_NO_BUFFER_MESSAGE 2019-10-17 10:00:40 -07:00
Ebrahim Byagowi 9a68e6b901
[doc] minor
Addresses https://github.com/harfbuzz/harfbuzz/pull/2013/files#r335196908
2019-10-16 13:28:15 +03:30
Ebrahim Byagowi 453050ad30 Merge remote-tracking branch 'upstream/master' into var-subset 2019-10-13 08:45:29 +03:30
Ebrahim Byagowi b0b8551afc [glyf] Use range_checker_t in composite_iter_t 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 06e35ce052 [glyf] minor 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi d13bb4bd94 [glyf] other cleanups 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi e7aa8c5d22 [glyf] Introduce glyf::Glyph, a hb_bytes_t/GlyphHeader pair 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 546ffc9faf [glyf] minor 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 4299ea266e [glyf] Move get_contour_points to GlyphHeader 2019-10-13 07:17:03 +03:30
Ben Wagner b918cd8c76 Document hb_feature_t.
This documents hb_feature_t. This is motivated mostly by the ambiguity
of the units for 'start' and 'end' (clusters) and whether they are
inclusive or exclusive. This also documents that for lookup type 3 the
value is the one based index into the alternates and that in a list of
features later feature values override previous feature values with the
same tag.
2019-10-11 20:54:06 +03:30
Behdad Esfahbod e637a4b3de
Merge pull request #2012 from harfbuzz/lepcha-oo
Reorder U+1C29 LEPCHA VOWEL SIGN OO
2019-10-11 10:28:58 +07:00
Ebrahim Byagowi 670fec231d Minor, add a zero length tolerant memset, hb_memset 2019-10-10 09:21:08 +03:30
David Corbett e4464f4484 Reorder U+1C29 LEPCHA VOWEL SIGN OO 2019-10-09 20:55:52 -04:00
Garret Rieger e17e744300 Convert existing uses of serialize_append in gsub subsetting to use subset_offset_array. 2019-10-09 13:52:04 -07:00
Garret Rieger 36f18cecbb Add subset_offset_array helper function which simplifies subsetting offset arrays during stream operations. 2019-10-09 13:52:04 -07:00
Ebrahim Byagowi dc45f22521 [ot-metrics] Don't use mixed scaled and not scaled for generating extents 2019-10-08 23:27:39 +03:30
Ebrahim Byagowi b068e25f8f [glyf] Address Behdad's reviews
Addresses https://github.com/harfbuzz/harfbuzz/pull/1999#issuecomment-539298559
* Don't check against Null pool
* Remove cryptic _tt suffix
2019-10-08 16:29:19 +03:30
Ebrahim Byagowi 6961766db2 [glyf] fix scaling direction 2019-10-08 16:26:48 +03:30
Ebrahim Byagowi 0527fda4c7 minor 2019-10-08 16:19:39 +03:30
Ebrahim Byagowi b2628f1a3e [glyf] Move glyph bytes drop hints logic to GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 1fb9c3b646 [glyf] Implement depth limit for add_gid_and_children 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi be0eddd418 [glyf] Move add_gid_and_children to glyf table 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi c7621cf211 Minor, replace hb_set_add with private API 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi ad86806dcb [glyf] Move subset related methods inside GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 7839e23558 [glyf] minor 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi cbefbb2439 [glyf] Move padding removal logic to GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 1ab8f9aa7a [glyf] minor 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 13fb5612ad [glyf] Aggregate get_offsets uses 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 5179b96958 [cff] minor on number_t 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi d73cdcf361 [ot-font] Apply font scaling before turning to int 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi d7df7db160 Merge remote-tracking branch 'upstream/master' into var-subset 2019-10-06 17:18:59 +03:30
Ebrahim Byagowi 74a2dbbced minor 2019-10-06 17:18:55 +03:30
Ebrahim Byagowi f2339964b7 [glyf] minor, remove GlyphHeader::simple_* helpers 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 2d7ca6a76a [glyf] Move get_instruction_length inside GlyphHeader struct 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 50aef4d7f8 [glyf] cleanup 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi ee3f4630d7 [glyf] Remove get_composite_iter and refactor bytes_for_glyph for shape uses 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 8378ab96e2
[glyf] Rewrite composite iterator to new iterators convention 2019-10-06 13:49:45 +03:30
Ebrahim Byagowi 100dbccaa5 Merge remote-tracking branch 'upstream/master' into var-subset 2019-10-06 09:18:22 +03:30
Ebrahim Byagowi 21c80d955f [gvar] minor 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi 5752863640 [glyf][gvar] Make HB_NO_VAR buildable 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi 8e33510343 [gvar] minor 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi b3afa81644 [glyf] Use common convention of other tables access, format 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi 88bd342c0f [glyf] minor 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi ee7610181c [hmtx] Use more conventional internal API style 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi c9577a630f [hmtx] Use more optimal way to access glyf table 2019-10-06 08:59:12 +03:30
Michiharu Ariza b9ff43c162 Implement gvar table and variable glyf
Split from Ariza's "[subset] TrueType/CFF2 variable font" work on #1594
2019-10-06 08:58:40 +03:30
Ebrahim Byagowi 79ec65ae10 [ot-font] Use var vmtx side bearing in calculating v-origin 2019-10-03 14:27:51 +03:30
Ebrahim Byagowi 19d45dcab7 Merge remote-tracking branch 'upstream/master' into var-subset 2019-10-03 13:39:17 +03:30
Ebrahim Byagowi 3fd555be54 [hmtx] Prepare to fix and minor fixes 2019-10-03 13:34:43 +03:30
Michiharu Ariza 6d09b5a8a0 Implement hmtx/vmtx metrics read from hvar/vvar 2019-10-03 13:34:43 +03:30
Ebrahim Byagowi 2d7221a0e3
[cff] minor 2019-10-01 15:05:02 +03:30
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Ebrahim Byagowi 51b720f686 Fix -Wsizeof-array-div clang warning 2019-10-01 12:40:41 +03:30
Behdad Esfahbod faace9437e
Merge pull request #1807 from harfbuzz/subset-varstore
VariationStore serializer
2019-09-30 13:34:05 -07:00
Behdad Esfahbod e48ef0804a 2.6.2 2019-09-30 12:39:06 -07:00
Behdad Esfahbod d6ad613159 [docs] Misc fixes 2019-09-30 10:40:25 -07:00
Ebrahim Byagowi 2dce85ed06 [icu] Remove HB_ICU_STMT (#1993)
And ignore extra semicolon error to ICU versions < 65
2019-09-26 10:45:59 -07:00
Iceflower d6a83abd6a Define HB_UNUSED for clang 2019-09-26 14:12:20 +03:30
Iceflower c4567968cd [dwrite] Fix extra semicolon issue 2019-09-26 13:05:27 +03:30
Qunxin Liu b0c3eb06b6 [subset] GPOS Lookup Type 3: CursivePos 2019-09-25 05:43:25 +09:00
Ebrahim Byagowi 68d39ea486 Revert previous change and fix -Wrange-loop-analysis complains 2019-09-24 13:52:46 +03:30
Ebrahim Byagowi cbc0646a6c Minor, normalize for each calls 2019-09-24 12:09:20 +03:30
Ebrahim Byagowi 22b6c6a5c7
[serialize] use for each as #resolve_links, format 2019-09-24 12:06:28 +03:30
Qunxin Liu 512551f276 memory leak fix in serializer (#1988) 2019-09-23 17:28:16 -07:00
Ebrahim Byagowi f0a7677993
[gpos] minor 2019-09-23 21:09:39 +03:30
Ebrahim Byagowi 035ec3d1b4
[cmap] remove has_format14, minor format
fixes #1986
2019-09-23 20:51:43 +03:30
Ebrahim Byagowi c1a585fab0 [gpos] minor 2019-09-21 23:36:29 +04:30
Ebrahim Byagowi d87d38998a Fix clang -Wrange-loop-analysis complains
./hb-ot-layout-gpos-table.hh:674:43: error: loop variable '_' is always a copy because the range of type 'hb_zip_iter_t<hb_iter_type<hb_array_t<const OT::IntType<unsigned short, 2> > &>, hb_iter_type<hb_array_t<const OT::IntType<unsigned short, 2> > &> >' (aka 'hb_zip_iter_t<hb_array_t<const OT::IntType<unsigned short, 2> >, hb_array_t<const OT::IntType<unsigned short, 2> > >') does not return a reference [-Werror,-Wrange-loop-analysis]
      for (const hb_pair_t<Value, Value>& _ : hb_zip (val_iter, first_val_iter))
                                          ^
./hb-ot-layout-gpos-table.hh:674:12: note: use non-reference type 'hb_pair_t<OT::Value, OT::Value>' (aka 'hb_pair_t<IntType<unsigned short, 2>, IntType<unsigned short, 2> >')
      for (const hb_pair_t<Value, Value>& _ : hb_zip (val_iter, first_val_iter))

and

In file included from hb-subset.cc:44:
./hb-ot-vorg-table.hh:87:34: error: loop variable '_' is always a copy because the range of type 'hb_map_iter_t<hb_filter_iter_t<hb_sorted_array_t<const OT::VertOriginMetric>, const hb_set_t *, OT::HBGlyphID OT::VertOriginMetric::*, nullptr>, (lambda at ./hb-ot-vorg-table.hh💯15), hb_function_sortedness_t::NOT_SORTED, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const VertOriginMetric& _ : it)
                                 ^
./hb-ot-vorg-table.hh:113:17: note: in instantiation of function template specialization 'OT::VORG::serialize<hb_map_iter_t<hb_filter_iter_t<hb_sorted_array_t<const OT::VertOriginMetric>, const hb_set_t *, OT::HBGlyphID OT::VertOriginMetric::*, nullptr>, (lambda at ./hb-ot-vorg-table.hh💯15), hb_function_sortedness_t::NOT_SORTED, nullptr>, nullptr>' requested here
    vorg_prime->serialize (c->serializer, it, defaultVertOriginY);
                ^
./hb-ot-vorg-table.hh:87:10: note: use non-reference type 'OT::VertOriginMetric'
    for (const VertOriginMetric& _ : it)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-21 17:52:01 +04:30
Ebrahim Byagowi 6e42a418c8 Minor, turn more of hb_apply to for each 2019-09-21 17:52:01 +04:30
Ebrahim Byagowi 385741d565 [cmap] Turn hb_apply into foreach where possible 2019-09-21 15:33:02 +04:30
Ebrahim Byagowi 1023c2cc6d [cmap] minor 2019-09-21 15:33:02 +04:30
Ebrahim Byagowi ead46eefe3 minor, use internal API instead public hb_set_has 2019-09-21 15:33:02 +04:30
Ebrahim Byagowi d8af4e7701 [cmap] minor, turn 8 spaces to tab 2019-09-21 15:33:02 +04:30
Qunxin Liu 4315666283 [subset] updates according to review comments 2019-09-20 07:55:11 +09:00
Qunxin Liu 2583afa0eb [subset] subsetting cmap14 2019-09-20 07:55:11 +09:00
Qunxin Liu 078ddbd0f6 [subset] glyph closure for CMAP14 2019-09-20 07:55:11 +09:00
Ebrahim Byagowi bbe878006d Avoid bitwise negate of enum value
Fixes this -fno-sanitize-recover=undefined fail,

hb-ot-map.hh:188:1: runtime error: load of value 4294967294, which is not a valid value for type 'hb_ot_map_feature_flags_t'
    #0 0x7f62bfa9b227 in operator&=(hb_ot_map_feature_flags_t&, hb_ot_map_feature_flags_t) /home/ebrahim/Desktop/harfbuzz/src/./hb-ot-map.hh:188:1
    #1 0x7f62bfa9b227 in hb_ot_map_builder_t::compile(hb_ot_map_t&, hb_ot_shape_plan_key_t const&) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-map.cc:194
    #2 0x7f62bface650 in hb_ot_shape_planner_t::compile(hb_ot_shape_plan_t&, hb_ot_shape_plan_key_t const&) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-shape.cc:108:7
    #3 0x7f62bfacec1e in hb_ot_shape_plan_t::init0(hb_face_t*, hb_shape_plan_key_t const*) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-shape.cc:225:11
    #4 0x7f62bfae1318 in hb_shape_plan_create2 /home/ebrahim/Desktop/harfbuzz/src/hb-shape-plan.cc:232:7
    #5 0x7f62bfae1d2a in hb_shape_plan_create_cached2 /home/ebrahim/Desktop/harfbuzz/src/hb-shape-plan.cc:489:33
    #6 0x7f62bfae2527 in hb_shape_full /home/ebrahim/Desktop/harfbuzz/src/hb-shape.cc:135:33
    #7 0x55ed360b6588 in shape_options_t::shape(hb_font_t*, hb_buffer_t*, char const**) /home/ebrahim/Desktop/harfbuzz/util/./options.hh:242:10
    #8 0x55ed360b5d9c in shape_consumer_t<output_buffer_t>::consume_line(char const*, unsigned int, char const*, char const*) /home/ebrahim/Desktop/harfbuzz/util/./shape-consumer.hh:67:19
    #9 0x55ed360b549f in main_font_text_t<shape_consumer_t<output_buffer_t>, 2147483647, 0>::main(int, char**) /home/ebrahim/Desktop/harfbuzz/util/./main-font-text.hh:81:16
    #10 0x55ed360b4e23 in main /home/ebrahim/Desktop/harfbuzz/util/hb-shape.cc:189:17
    #11 0x7f62bf104ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
    #12 0x55ed3608f7ad in _start (/home/ebrahim/Desktop/harfbuzz/util/.libs/lt-hb-shape+0xd7ad)
2019-09-18 23:16:52 +04:30
Ebrahim Byagowi e6909ee58d minor 2019-09-18 23:16:52 +04:30
Ebrahim Byagowi bb41b74fd1 Don't rely on undefined left shift of negative value behavior
Fixes this -fno-sanitize-recover=undefined check,

hb-ft.cc:869:27: runtime error: left shift of negative value -16384
    #0 0x7ff8f47da843 in hb_ft_font_set_funcs /home/ebrahim/Desktop/harfbuzz/src/hb-ft.cc:869:27
    #1 0x55f20a66c7d6 in font_options_t::get_font() const /home/ebrahim/Desktop/harfbuzz/util/options.cc:731:3
    #2 0x55f20a668c1f in shape_consumer_t<output_buffer_t>::init(hb_buffer_t*, font_options_t const*) /home/ebrahim/Desktop/harfbuzz/util/./shape-consumer.hh:47:42
    #3 0x55f20a668441 in main_font_text_t<shape_consumer_t<output_buffer_t>, 2147483647, 0>::main(int, char**) /home/ebrahim/Desktop/harfbuzz/util/./main-font-text.hh:75:14
    #4 0x55f20a667f91 in main /home/ebrahim/Desktop/harfbuzz/util/hb-shape.cc:180:21
    #5 0x7ff8f3df7ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
    #6 0x55f20a6427ad in _start (/home/ebrahim/Desktop/harfbuzz/util/.libs/lt-hb-shape+0xd7ad)
2019-09-18 23:16:52 +04:30
Ebrahim Byagowi b73313ade7 Don't seek of out-of-bound value even if the result is not used
Fixes this -fno-sanitize-recover=undefined fail,

/set/iter: hb-algs.hh:1016:60: runtime error: index 4294967295 out of bounds for type 'unsigned long long const[8]'
    #0 0x4d1e09 in hb_vector_size_t<unsigned long long, 64u>::operator[](unsigned int) const /home/user/code/harfbuzz/src/./hb-algs.hh:1016:60
    #1 0x4d8b5f in hb_set_t::page_t::previous(unsigned int*) const /home/user/code/harfbuzz/src/./hb-set.hh:139:53
    #2 0x4d0ada in hb_set_t::previous(unsigned int*) const /home/user/code/harfbuzz/src/./hb-set.hh:602:36
    #3 0x4cd76f in hb_set_previous /home/user/code/harfbuzz/src/hb-set.cc:494:15
    #4 0x4ca8af in test_set_iter /home/user/code/harfbuzz/test/api/test-set.c:310:3
    #5 0x7f3a4f3e0f49  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72f49)
    #6 0x7f3a4f3e0e7a  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a)
    #7 0x7f3a4f3e1121 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73121)
    #8 0x7f3a4f3e1140 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73140)
    #9 0x4c8894 in hb_test_run /home/user/code/harfbuzz/test/api/./hb-test.h:88:10
    #10 0x4c8894 in main /home/user/code/harfbuzz/test/api/test-set.c:408:10
    #11 0x7f3a4e3d2b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #12 0x41e7d9 in _start (/home/user/code/harfbuzz/test/api/test-set+0x41e7d9)
2019-09-18 23:16:52 +04:30
Ebrahim Byagowi d8af9ee017 Don't rely on nullptr deref recovery
Fixes this -fno-sanitize-recover=undefined fail,

/types/language: hb-common.cc:385:20: runtime error: member access within null pointer of type 'const struct hb_language_impl_t'
    #0 0x4caa34 in hb_language_to_string /home/user/code/harfbuzz/src/hb-common.cc:385:20
    #1 0x4c9be8 in test_types_language /home/user/code/harfbuzz/test/api/test-common.c:205:3
    #2 0x7f9557e72f49  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72f49)
    #3 0x7f9557e72e7a  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a)
    #4 0x7f9557e73121 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73121)
    #5 0x7f9557e73140 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73140)
    #6 0x4c88a3 in hb_test_run /home/user/code/harfbuzz/test/api/./hb-test.h:88:10
    #7 0x4c88a3 in main /home/user/code/harfbuzz/test/api/test-common.c:224:10
    #8 0x7f9556e64b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #9 0x41e7d9 in _start (/home/user/code/harfbuzz/test/api/test-common+0x41e7d9)
2019-09-18 23:16:52 +04:30
Ebrahim Byagowi bfb155a5f1 Don't call memset when length is zero
Fixes this -fno-sanitize-recover=undefined check,

/buffer/positions/empty: hb-buffer.cc:327:11: runtime error: null pointer passed as argument 1, which is declared to never be null

/usr/include/string.h:60:62: note: nonnull attribute specified here
    #0 0x4cf31c in hb_buffer_t::clear_positions() /home/user/code/harfbuzz/src/hb-buffer.cc:327:3
    #1 0x4d4dd4 in hb_buffer_get_glyph_positions /home/user/code/harfbuzz/src/hb-buffer.cc:1418:13
    #2 0x4cb553 in test_buffer_positions /home/user/code/harfbuzz/test/api/test-buffer.c:305:3
    #3 0x7f324187bf49  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72f49)
    #4 0x7f324187be7a  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a)
    #5 0x7f324187be7a  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72e7a)
    #6 0x7f324187c121 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73121)
    #7 0x7f324187c140 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x73140)
    #8 0x4c8bd3 in hb_test_run /home/user/code/harfbuzz/test/api/./hb-test.h:88:10
    #9 0x4c8bd3 in main /home/user/code/harfbuzz/test/api/test-buffer.c:884:10
    #10 0x7f324086db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #11 0x41e919 in _start (/home/user/code/harfbuzz/test/api/test-buffer+0x41e919)
2019-09-18 23:16:52 +04:30
Ebrahim Byagowi c930ae2bd8 Avoid stdint.h in Kernel module compiles 2019-09-17 20:58:32 +04:30
Ebrahim Byagowi 412d6cac3a Extract an avoid errno compile flag 2019-09-17 20:58:13 +04:30
Ebrahim Byagowi 8a16d6f1c1
[doc] fix minor typo 2019-09-15 20:43:33 +04:30
Ebrahim Byagowi f3214df6f6 [coretext] Fix double promotion warnings by making casts explicit 2019-09-14 11:55:53 +04:30
Ebrahim Byagowi 6e4736a3c5 [name] Undef entry_{index,score} to avoid collision in amalgam builds 2019-09-14 11:55:53 +04:30
Ebrahim Byagowi d512087e4d Rename GlyphID to HBGlyphID
Avoid collision with macOS's ATSUnicodeTypes.h GlyphID
2019-09-14 11:55:53 +04:30
Behdad Esfahbod 229ef1d29d Rename Fixed to HBFixed
Fixes(!!) https://github.com/harfbuzz/harfbuzz/issues/1966
2019-09-10 10:31:07 -07:00
Behdad Esfahbod 170b5dd856 [aat] Minor 2019-09-09 10:52:54 -04:00
Behdad Esfahbod a0695687eb [aat] Minor 2019-09-09 10:52:54 -04:00
Ebrahim Byagowi 4905a2198b [number] Add static to hb-number-parser.hh functions 2019-09-09 13:14:42 +04:30
Ebrahim Byagowi 30e5cdfbf1
[number] Optimize _pow10 constants (#1963) 2019-09-09 00:28:16 +04:30
Behdad Esfahbod 3f2cdf07a4 Change HB_VAR_ARRAY to 1 again
To fix MSVC bots, while I work on changing this to 0 permanently.
2019-09-08 15:08:02 -04:00
Ebrahim Byagowi 39cf8e21be
[number] Add overflow checks used to be done in parse_bcd
Which were removed in 1083df8
2019-09-07 15:27:30 +04:30
Ebrahim Byagowi 47d82713a1 Replace strtod with a ragel implementation
Use a ragel based number parser when strtod_l couldn't be found
as libc's strtod may is locale sensetivity which we need to not.
2019-09-07 15:02:52 +04:30
Ebrahim Byagowi 80613e5b9e
Minor, remove unused header 2019-09-07 14:25:54 +04:30
Behdad Esfahbod 5902198cee [kerx] Fix offset issue in kern format 2
Fixes tests with HB_VAR_ARRAY != 1, as done in previous commit.
2019-09-06 21:36:31 -04:00
Behdad Esfahbod 861547d531 Change HB_VAR_ARRAY from 1 to 0
Going to see which compilers it breaks and special-case those...
2019-09-06 16:55:00 -04:00
Behdad Esfahbod 0e294c455e Rename VAR to HB_VAR_ARRAY 2019-09-06 16:54:27 -04:00
Behdad Esfahbod c379faed2b Fix a few struct size declarations
Was wrong.  As excercised by defining VAR to other than 1 in hb.hh.
2019-09-06 16:41:12 -04:00
Behdad Esfahbod 3aceee2527 Revert "[null] Silence undefined-behavior complaints with too-small null bytes"
This reverts commit 911c76abcd.

Broke tests.  I'm not sure I understand why.  At any rate, this was a
bad way to fix.  I'll look into understanding as well as better fix.
2019-09-06 12:17:18 -04:00
Behdad Esfahbod 911c76abcd [null] Silence undefined-behavior complaints with too-small null bytes
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1577584
2019-09-06 11:53:11 -04:00
Behdad Esfahbod 3c81246f66 [subset] Use newer iter tools in SinglePosFormat1 2019-09-04 11:28:40 -04:00
Behdad Esfahbod 9510e918f7 [iter] Partialize hb_zip() 2019-09-04 11:28:40 -04:00
Ebrahim Byagowi cad698568a Use roundf to fix cast to int difference of msys2 w64 2019-09-04 11:18:37 +04:30
Ebrahim Byagowi 1083df8b80 Use hb_parse_double in CFF::dict_opset_t::parse_bcd 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 57f88e11d4 [number] Turn hb_parse_float into hb_parse_double 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 65690b5a4b [number] Add whole buffer check and test it 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 3661eb6105 Don't check null terminaion of source in hb_codepoint_parse
This isn't what intended originally, just checking if consumed
all the buffer is enough.
2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 3a16272750 [test] resolve msvc complain on signedness comparing 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 005389beb5 Use hb_parse_uint in deserializer token parser 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 3d5b1df7ab [number] Add test 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi b5e6805ee7 [number] Minor tweak on parser related codes 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi e2cecf1f34 [number] Remove parsing code duplication of the calls using lambda 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi a77bb7eb41 Move hb_codepoint_parse to hb_parse_uint 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi 43372fbb5a Merge and aggregate number parsing logics to form hb-number 2019-09-04 02:04:09 +04:30
Ebrahim Byagowi d50d2fcbc7 Fallback if roundf didn't exist, like in dietlibc (#1953) 2019-09-02 19:32:05 -05:00
Ebrahim Byagowi d3b984d379 Revert in-house pow10 (d80a3ea) and fix oss-fuzz/16922
Probably can be fixed but merging it was wrong so let's revert.
2019-09-02 18:28:03 +04:30
Ebrahim Byagowi 41d6e95b0d [subset] Use internal API of hb_set_t 2019-09-02 01:58:37 +04:30
Ebrahim Byagowi 8ccf328d54 [subset] Run once for a tag 2019-09-02 01:09:41 +04:30
Khaled Hosny 0954c8f7a0 [ft] Prefer symbol cmap subtable if found (#1948)
Similar to commit d304d60e4d for ot-font.
2019-09-01 10:09:07 -05:00
Ebrahim Byagowi d80a3ea983
[cff] Implement in-house power of 10
A minimal power only for natural numbers exponents of ten, for portability.

Found the idea in Tcl/Tk but wrote it myself after weeks and it turned out
being a different implementation, reverse direction, constexpr, etc.
2019-09-01 14:05:16 +04:30
Ebrahim Byagowi f441a7c008 Don't allow reference blob be accessed using empty tag in hb_face_reference_table (#1947) 2019-08-31 16:48:09 -05:00
Behdad Esfahbod c9eb913f4c [iter] Simplify hb_chop() 2019-08-31 15:21:02 -05:00
Behdad Esfahbod 67ec9fa9e4 [iter] Add hb_chop() 2019-08-31 14:51:49 -05:00
Behdad Esfahbod 5828d8e83c [iter] Add hb_take() specialization for arrays 2019-08-31 14:36:44 -05:00
Behdad Esfahbod 398b296f3b [iter] Add hb_len() 2019-08-31 12:44:24 -05:00
Behdad Esfahbod 875131d478 [iter] Add hb_take() 2019-08-31 12:42:52 -05:00
Behdad Esfahbod 1f88dae9f5 [iter] Make iota() accept invokable for increasing to next item 2019-08-31 12:24:56 -05:00
Behdad Esfahbod 3bc86fb237 [algs] Fix hb_inc/dec signature 2019-08-31 12:24:56 -05:00
Behdad Esfahbod b1378d8a21 [iter] Add hb_repeat() 2019-08-31 12:24:56 -05:00
Behdad Esfahbod 966a18b92a [iter] Remove some && 2019-08-31 12:24:56 -05:00
Behdad Esfahbod de45775c37 [iter] Use hb_ridentity instead of lazy + 2019-08-31 12:24:56 -05:00
Behdad Esfahbod ce4d63beec [iter] Separate hb_iota implementation from hb_range 2019-08-31 12:24:56 -05:00
Behdad Esfahbod 814dc3cbe5 [iter] Rename
Moving towards making iota useful for non-integers.
2019-08-31 12:24:56 -05:00
Behdad Esfahbod 2d5643aed4 [algs] Add hb_inc() and hb_dec()) 2019-08-31 12:24:56 -05:00
Behdad Esfahbod 7eafe94705 Revert "[array] Add chop()"
This reverts commit 545fe9d9f0.

Breaks gcc 4.8 and MSVC all versions.

Will add hb_chop() that works on all iterators instead.
2019-08-31 12:24:56 -05:00
Ebrahim Byagowi 28c8dcb53f
[subset] minor 2019-08-31 12:27:14 +04:30
Behdad Esfahbod 545fe9d9f0 [array] Add chop()
Takes n, and returns iterator of iterators that contain up to
n items each.  Basically cuts the array into subarrays of size n.
The last sub-array might contain fewer.

Ideally this should become a generic iter tool, not array-specific,
so we can use it in GPOS to chop a value matrix into rows and elements.
2019-08-29 15:48:21 -07:00
Behdad Esfahbod c72589f13f [iter] Change item_size to get_item_size()
By moving access to hb_static_size(Type) into a function instead of
a class-const, we can refer to iter types of incomplete types, which
come handy when a method of hb_array_t wants to return iterator
of hb_array_t.  That kind of stuff.   Next commit needs this to
build on clang...
2019-08-29 15:45:21 -07:00
Behdad Esfahbod d58e248df6 [array] Add truncate() method 2019-08-29 15:23:48 -07:00
Behdad Esfahbod a06edf1430 [array] Use injected class name more 2019-08-29 15:21:18 -07:00
Behdad Esfahbod e0e0c8c109 Minor 2019-08-29 14:58:16 -07:00
qxliu76 0313ef86e3 bug fix in optimizing coverage table format (#1942)
We are comparing number of shorts, NOT number of bytes.
2019-08-29 14:09:05 -07:00
Behdad Esfahbod 38f95baf6b [subset] in SingleSubst subsetting, check for substitute in glyphset
That matches what fonttools does and allows for specifying exact
glyphset for subset.
2019-08-29 13:40:46 -07:00
Ebrahim Byagowi 8106ba7f88 [glyf] Reapply use of hb_bytes_t.as<GlyphHeader> () 2019-08-29 20:33:38 +04:30