Commit Graph

7018 Commits

Author SHA1 Message Date
Behdad Esfahbod 6caf76f4a8 Tighten Coverage iteration 2019-01-20 20:12:12 -05:00
Behdad Esfahbod ff3a7ce1e7 [subset] Minor 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 42bf80e578 [iter] More semicolon 2019-01-20 20:12:12 -05:00
Behdad Esfahbod f78f837ef1 [iter] Use aliasing using for types
Fix ambiguity of hb_sorted_array_t::item_t with gcc.  No idea if that's a gcc bug
or what spec requires, but using aliasing using seems to fix it.  It probably breaks
our non-C++11 bots, in which case I have to condition the change.  Testing.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 3fc03e42ce [iter] Use static_assert with hb_is_random_access_iterator()
Both, checks constexpr'ness, and fixes build with cra**y implementations
of assert() macro:

test-iter.cc:108:11: error: too many arguments provided to function-like macro invocation
  assert (hb_is_random_access_iterator (array_iter_t<int>));
          ^
./hb-iter.hh:186:42: note: expanded from macro 'hb_is_random_access_iterator'
  hb_is_random_access_iterator_of (Iter, typename Iter::item_t)
                                         ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:89:9: note: macro '__STRING' defined here
\#define __STRING(x)     #x
        ^
test-iter.cc:108:3: error: use of undeclared identifier '__STRING'
  assert (hb_is_random_access_iterator (array_iter_t<int>));
  ^
/usr/include/assert.h:91:21: note: expanded from macro 'assert'
   : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
                    ^
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6af9c5f18e [iter] Remove stray semicolons 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 74ca7b580c [OT] Implement operator[] for Coverage and ClassDef 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6c548b6657 [iter] Add TODO 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 362d4e7cc3 [iter] Implement for OT::ArrayOf / OT::SortedArrayOf 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 2f837a365c [SortedArrayOf] Fix sub_array() return type 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 54c30e949e [iter] Constrain hb_fill() and hb_copy() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod dc0a98cbe7 [iter] Add TODO 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 2658e40ffb [iter] Add hb_is_random_access_iterator() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 445364d80a [iter] Rename hb_is_[sorted_]iterator() -> hb_is_[sorted_]iterator_of() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod a6c013b1bf [meta] Add hb_declval() macro 2019-01-20 20:12:12 -05:00
Behdad Esfahbod adc5910a63 [iter] Syntax 2019-01-20 20:12:12 -05:00
Behdad Esfahbod ca6adcd1ad [iter] Test hb_is_iterable / hb_is_iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8237809f06 [serialize] Make SortedArrayOf:;serialize() take sorted-iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 47333c8a30 [iter] Fix operator-> 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 177a8af380 [array] SFINAE fun 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8414f16787 [meta] Rename 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8e0a58e1b3 [array] Remove construction that was removing constness 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 85969e357a [iter] Fix test 2019-01-20 20:12:12 -05:00
Behdad Esfahbod da49961836 [iter] Remove comment 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 815cde9fa3 [iter] Use is_sorted_iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod ed4336680d [iter] Handhold hb_is_iterator() type deduction
by partial-instantiating on Iter.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod cb5011d364 Revert "[iter] Add hb_iter_of_t<>"
This reverts commit d6cbe96e2fc7bc8f1c10e631b52b1ef31ff9a6f5.

Isn't useful, as duplicate inheritance of same type results in ambiguity
errors...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod c132cda9d9 [iter] Fix warnings 2019-01-20 20:12:12 -05:00
Behdad Esfahbod c9d8a07e30 [iter] Add hb_iter_of_t<> 2019-01-20 20:12:12 -05:00
Behdad Esfahbod b5d6fe1a45 [iter] Remove hb_sorted_iter_t
Not enforcing it using type hierarchy.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 255085bd59 [iter] Const correctness 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 415f3f4320 Add operator= to IntType, commented out
https://github.com/harfbuzz/harfbuzz/pull/1510
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 183be8f452 [iter] Minor 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6cd96ba1ac [iter] Make is_random_access_iterator a constant
We cannot rely on constexpr functions...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod a685bfe8fc Separate GlyphID from HBUINT16
For stricter enforcement.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8ac64d0090 [iter] Fix sorted_iter iter class 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 93615b9598 [iter/meta] Add hb_is_sorted_iterator() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 92f25db1e8 [iter] Remove stale comment 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 40c24fd4a6 [iter] Port Coverage towards iter_t instead of array_t specifics 2019-01-20 20:12:12 -05:00
Behdad Esfahbod d552b6818c [meta] Move typename around
We'll see if bots like.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod f64ea8fc65 [meta] Move code around 2019-01-20 20:12:12 -05:00
Behdad Esfahbod aa2ab4f061 [iter] WHitespace 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 851fbb23ea [iter] Port Coverage::serialize to hb_is_iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 06a44e2e53 [iter/meta] Match hb_is_iterator<> using SFINAE
By specifying Item type, which is desirable.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod bcb913efb4 Minor 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 859a880b08 [iter] Add back operator +
Too ugly to remove..
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 076faf7c18 [iter] Disable operator +
To see if it makes bots happy... This is frustrating.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod a46874f1ab [iter] Revert back uses of C++11 auto type deduction 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 0828db8444 [iter] Rename 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 037f735efd [iter] Remove friend operator +, hoping to fix some bots 2019-01-20 20:12:12 -05:00
Behdad Esfahbod cb27918d0a Use Null() instead of declval(), hoping to fix some bots 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 3d22900f62 [meta] Don't use template default arguments for functions
That's a C++11 extension apparently...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod b89d20dd9f [meta] Fix unused-function-template warning 2019-01-20 20:12:12 -05:00
Behdad Esfahbod df138da2e6 [iter/meta] Implement is_iterator
Removes use of auto type deduction again, which was not supported on many bots.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8570da1d74 [meta] Minor 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 442f4a5891 [meta] Move more code here 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8c6cbbdfa3 [iter/meta] Add hb_is_iterable 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 576d5e2420 Don't use delegating constructors
Not all C++11 features are created equal when it comes to support...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod e32bf39766 [meta] Add enable_if 2019-01-20 20:12:12 -05:00
Behdad Esfahbod e76a3cae0f Add hb-meta.hh for meta-programming 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 5ec11ce13a [iter] Clarify readonly vs lvalue iterators
lvalue iterators must declare __item_type__ as a reference.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 2cbf5bf3a9 [iter] Test OT::Coverage iter 2019-01-20 20:12:12 -05:00
Behdad Esfahbod fd75d29f0f [iter] Streamline vector iterators 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 570473a345 [iter] Make hb_sorted_array_t work as iter
Ugly, but does the job.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod d6024794fb Change hb_void_t implementation 2019-01-20 20:12:12 -05:00
Behdad Esfahbod cde31988c2 [iter] Mark Coverage iterator sorted 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 49161d411f [subset] Take iterator in ArrayOf serialize
Still not satisfied with how I can enforce iterators only, but
seems to work for now.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod e16884248f [iter] Port Coverage iterator to hb_iter_t 2019-01-20 20:12:12 -05:00
Behdad Esfahbod c68bca0f95 Add hb_pair_t<> and hb_pair() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8303a9b011 [Coverage] Ensure increasing coverage in iteration 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 50cd26d394 [Coverage] Mark iterator methods const 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 9df1a6eba7 [iter] Use operator bool in a few places 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 7788ac14a4 [iter] Remove redundant methods 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 3dea9affda [iter] Test default-constructability 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 743ff09368 [iter] Implement friend opeator + (int, iter) 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6dc4a1c9b1 [iter] Remove const_iter 2019-01-20 20:12:12 -05:00
Behdad Esfahbod f2b56af3ef [iter] Remove hack for older compilers 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 2ea79e0340 [iter] Minor 2019-01-20 20:12:12 -05:00
Behdad Esfahbod fb053b6333 [iter] Rename random_access() to constexpr is_random_access() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 2790aad28c [iter] Add operator -> 2019-01-20 20:12:12 -05:00
Behdad Esfahbod d3976b7e63 [iter] Make them work, mostly 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 959bb58bdd [vector] Add iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod dd7c628ed1 Use enum for class constant 2019-01-20 19:51:08 -05:00
Behdad Esfahbod cf7edf52c3 [CFF] Use enum for tableTag 2019-01-20 19:49:59 -05:00
Behdad Esfahbod bd1318b8cc Use static constexpr for large class constants 2019-01-20 19:47:52 -05:00
Behdad Esfahbod 043b610fa6 Fix sign compare warnings
../../third_party/harfbuzz-ng/src/src/hb-map.hh(56,45):  warning: comparison of integers of different signs: 'const hb_codepoint_t' (aka 'const unsigned int') and 'hb_map_t::(anonymous enum at ../../third_party/harfbuzz-ng/src/src/hb-map.hh:169:3)' [-Wsign-compare]
    bool is_unused () const    { return key == INVALID; }
2019-01-19 09:21:33 -05:00
Behdad Esfahbod ce317d0320 Fix warning
warning: '_WIN64' is not defined, evaluates to 0 [-Wundef]
2019-01-19 09:21:33 -05:00
Ebrahim Byagowi 0c2bd1b160
[dwrite] Fix delete-non-virtual-dtor warning (#1550) 2019-01-19 16:30:07 +03:30
Behdad Esfahbod 89bcfb204c Remove TRACE_COLLECT_GLYPHS 2019-01-18 14:59:18 -05:00
Behdad Esfahbod f13b6786f0 [pragma] Only add if GCC or clang 2019-01-18 14:53:54 -05:00
Behdad Esfahbod c2ea7a9da4 [directwrite] More fix 2019-01-18 14:20:45 -05:00
Ebrahim Byagowi 9714d3ec5c
[dwrite] Try to fix delete-non-virtual-dtor warnings
Fixes #1548 hopefully
2019-01-18 21:55:21 +03:30
Behdad Esfahbod 0772c06f96 Remove tracing from closure 2019-01-18 12:53:47 -05:00
Behdad Esfahbod d9f6be3a61 Fix -Wundef errors with __GNUC__
Fixes https://github.com/harfbuzz/harfbuzz/issues/1549
2019-01-18 12:53:47 -05:00
Michiharu Ariza 28917e58f9 init interp_env_t::hintmask_size
fixes issue #1547
2019-01-18 09:43:51 -08:00
Behdad Esfahbod 9b4e51b2e4 [pragma] Enable error -Wdelete-non-virtual-dtor
Currently fails directwrite backend.
2019-01-18 12:23:02 -05:00
Behdad Esfahbod e65272281c [directwrite] Fix error
hb-directwrite.cc: In constructor 'TextAnalysis::TextAnalysis(const wchar_t*, uint32_t, const wchar_t*, DWRITE_READING_DIRECTION)':
hb-directwrite.cc:489:18: error: 'TextAnalysis::mText' will be initialized after [-Werror=reorder]
   const wchar_t* mText;
                  ^~~~~
hb-directwrite.cc:488:12: error:   'uint32_t TextAnalysis::mTextLength' [-Werror=reorder]
   uint32_t mTextLength;
            ^~~~~~~~~~~
hb-directwrite.cc:282:3: error:   when initialized here [-Werror=reorder]
   TextAnalysis (const wchar_t* text, uint32_t textLength,
   ^~~~~~~~~~~~
hb-directwrite.cc: In function 'hb_bool_t _hb_directwrite_shape_full(hb_shape_plan_t*, hb_font_t*, hb_buffer_t*, const hb_feature_t*, unsigned int, float)':
2019-01-18 12:22:07 -05:00
Behdad Esfahbod b900f78088 [pragma] More cast-align whitelist 2019-01-18 10:08:23 -05:00
Behdad Esfahbod 0d8b931bbe [pragma] Allow cast-align in hb-font.cc
../src/hb-machinery.hh: In instantiation of 'const Type& StructAtOffset(const void*, unsigned int) [with Type = unsigned int]':
../src/hb-font.cc:144:85:   required from here
../src/hb-machinery.hh:63:12: error: cast from 'const char*' to 'const unsigned int*' increases required alignment of target type [-Werror=cast-align]
 { return * reinterpret_cast<const Type*> ((const char *) P + offset); }
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = unsigned int]':
../src/hb-font.cc:145:79:   required from here
../src/hb-machinery.hh:66:12: error: cast from 'char*' to 'unsigned int*' increases required alignment of target type [-Werror=cast-align]
 { return * reinterpret_cast<Type*> ((char *) P + offset); }
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = int]':
2019-01-18 10:03:43 -05:00
Behdad Esfahbod a25174a56b [pragma] GCC diagnostic error "-Wreorder" 2019-01-18 09:59:36 -05:00
Behdad Esfahbod 4660090569 [pragma] GCC diagnostic warning "-Wmaybe-uninitialized" 2019-01-18 09:53:16 -05:00
Behdad Esfahbod 7a634d7d5b [pragma] Massage more 2019-01-18 09:49:14 -05:00
Behdad Esfahbod 16e5ba85b1 [pragma] More 2019-01-18 09:46:17 -05:00
Behdad Esfahbod 2bd530d598 [pragma] Reorg again
https://github.com/harfbuzz/harfbuzz/issues/1546
2019-01-18 09:28:22 -05:00
Behdad Esfahbod c04272fac8 [pragma] GCC diagnostic ignored "-Wunknown-warning-option"
Try at fixing https://github.com/harfbuzz/harfbuzz/issues/1546
2019-01-18 08:49:45 -05:00
Behdad Esfahbod 4d3c8f9685 [uniscribe] More warnings 2019-01-17 19:58:54 -05:00
Behdad Esfahbod 6a5d2b21d8 [uniscribe] Fix warnings 2019-01-17 19:57:17 -05:00
Behdad Esfahbod 5b13e458c3 Fix build 2019-01-17 19:52:32 -05:00
Behdad Esfahbod a77bd6bb89 [pragma] GCC diagnostic ignored "-Wclass-memaccess" 2019-01-17 19:33:41 -05:00
Behdad Esfahbod 436c7b294a [pragma] ignored -Wunsafe-loop-optimizations // TODO fix 2019-01-17 19:03:33 -05:00
Behdad Esfahbod e3b3181e9d [pragma] error -Wclass-memaccess 2019-01-17 19:02:06 -05:00
Behdad Esfahbod 1a6b97a491 [pragma] More 2019-01-17 18:55:03 -05:00
Behdad Esfahbod 06e8091661 [pragma] More 2019-01-17 18:47:32 -05:00
Behdad Esfahbod 1077e40bf1 [pragma] Flesh out more 2019-01-17 18:36:10 -05:00
Behdad Esfahbod 7e6bd510fc Use NNOffsetTo<> in rest of places 2019-01-17 18:24:18 -05:00
Behdad Esfahbod b1152d5e66 Use NNOffsetTo<> 2019-01-17 18:17:04 -05:00
Behdad Esfahbod 205d72a198 Add NNOffsetTo<> 2019-01-17 18:10:38 -05:00
Behdad Esfahbod c99d13d860 [AAT] Comment 2019-01-17 17:56:27 -05:00
Behdad Esfahbod f39b5603ff Comment 2019-01-17 17:50:01 -05:00
Behdad Esfahbod 347ad454b8 [AAT] Remove unused code 2019-01-17 17:47:29 -05:00
Behdad Esfahbod b344d4385a [AAT] Allow null in ankr lookupTable offset 2019-01-17 17:44:39 -05:00
Behdad Esfahbod 14a560a245 [pragma GCC] Ignore -Wtype-limits 2019-01-17 17:42:44 -05:00
Behdad Esfahbod 3f2daae630 More GCC pragmas 2019-01-17 15:27:31 -05:00
Behdad Esfahbod d6c5473e1f Rename macro 2019-01-17 15:22:46 -05:00
Behdad Esfahbod a9946b7cfe Add more GCC warning pragmas 2019-01-17 15:22:28 -05:00
Behdad Esfahbod 868b0c0c2e Move -Wcast-align to hb.hh 2019-01-17 15:18:18 -05:00
Behdad Esfahbod 8874eef8ff Add pragram GCC diagnostic ignored "-Wunused-macros" 2019-01-17 15:04:44 -05:00
Behdad Esfahbod cc8e9a436f [AAT] Fully sanitize ankr table at sanitize time
Third try to fix access. Followup 6879efc2c1

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303
2019-01-17 14:55:05 -05:00
Behdad Esfahbod 6879efc2c1 [AAT] Fix anchor bound checking, again
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12532
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=922303
2019-01-17 14:08:02 -05:00
Behdad Esfahbod a262eb3d0b [aat] Minor 2019-01-17 14:06:32 -05:00
Behdad Esfahbod c986ca15a6 Improve overflow avoidance
Better fix for 480406cd3e
This way we behave the same on 32bit and 64bit archs.
2019-01-15 13:58:19 -05:00
Behdad Esfahbod 0d2727f4fe
fix FDSelect fuzzing bug (#1539)
Rewrote struct FDSelect3_4.ranges as ArrayOf
Updated FDSelect3_4::sanitize () to call ranges.sanitize ()
nRanges now a function to return a reference to ranges.len
2019-01-14 18:23:17 -08:00
Behdad Esfahbod 9f6172d669 Move _POSIX_SOURCE definition
Fixes https://github.com/harfbuzz/harfbuzz/issues/1308
2019-01-14 20:45:31 -05:00
Behdad Esfahbod 480406cd3e Fix assertion on address overflow
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=917031
2019-01-14 15:27:34 -05:00
Behdad Esfahbod 7a6686a589 [AAT] Fix mort ContextualSubtable offset access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12312
2019-01-14 15:09:14 -05:00
Behdad Esfahbod a3fa7d3336 [AAT] Fix ankr table access
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=918340
2019-01-14 14:37:36 -05:00
Michiharu Ariza 760303d411 deleted a duplicate fontdicts_mod.fini() call (#1538) 2019-01-11 15:27:35 -08:00
Michiharu Ariza 7b48641aa8 fix leak in subset_enc_supp_codes (#1537)
oss-fuzz issue 12310
2019-01-08 15:37:48 -05:00
Ebrahim Byagowi 97f67a3c3d
[ci] Enable more of GCC compile warnings (#1533) 2019-01-04 23:10:39 +03:30
cclauss 26c5b54fb0 CircleCI: Test for Python 3 syntax errors and undefined names (#1522)
Catch missing imports and errors like #1520 and #1521

__E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
2018-12-31 07:00:43 +03:30
cclauss f4da28b1f1 Python 3 fixes to gen-os2-unicode-ranges.py (#1521)
In Python 3, __reload()__ was moved and __sys.setdefaultencoding()__ because the default is already utf-8.  Also __Error()__ is an _undefined name_ and __Exception()__ creates a generic exception.
2018-12-30 15:28:34 +03:30
Behdad Esfahbod d092fb2719 Ouch! Fix build on C++<11 2018-12-30 01:53:03 -05:00
Behdad Esfahbod 89949ed28d Fix ubsan with passing nullptr to qsort() 2018-12-30 01:52:19 -05:00
Behdad Esfahbod 357a0a7ad3 Fix build on C++ < 11 2018-12-27 18:29:23 -05:00
Behdad Esfahbod 54c0a17310 [vector] Fix warning 2018-12-27 18:28:07 -05:00
Behdad Esfahbod 1043ddbee8 [aat] Minor 2018-12-27 18:27:11 -05:00
Behdad Esfahbod 71da9ca62f [vector] Remove use of arrayZ() by using casts 2018-12-27 18:01:06 -05:00
Behdad Esfahbod fa333e34d6 [vector] Remove static_array
Was good idea, but with C++ types with constructor/destructor, was getting in
the way as compiler was destructing those items where it was not desired.
Since C++ does not allow zero-sized arrays, just remove it...
2018-12-27 17:56:22 -05:00
Behdad Esfahbod ab2258a419 [vector] Use allocated = -1 to signify failure 2018-12-27 17:45:05 -05:00
Michiharu Ariza 09fa536d89 fix lealk with cff2::accelerator_templ_t::topDict (#1517) 2018-12-27 11:33:09 -05:00
Behdad Esfahbod 3b81442cd5 [vector] Change pre-alloced count from 8 to 2
I'm thinking about dropping it to zero, but that needs slight code changes.
2018-12-24 11:31:04 -05:00
Behdad Esfahbod d25a2f1496 Fix a few warnings 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 85003b594b [iter] Fix warning 2018-12-23 20:34:24 -05:00
Behdad Esfahbod e4355b1ca1 [set] Add iter_t as alias to const_iter_t 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 33f8de6186 [set] Change to const_iter 2018-12-23 20:34:24 -05:00
Behdad Esfahbod f88fed5cd8 [set] Cache length in iterator 2018-12-23 20:34:24 -05:00
Ebrahim Byagowi d0a706c7fd Minor, remove redundant inline 2018-12-22 20:07:57 +03:30
Ebrahim Byagowi ae6e348d64 Minor, tweak spaces 2018-12-22 20:07:57 +03:30
Michiharu Ariza 29f0b6bce7 CFF renaming (#1507)
* reimplement ByteStr as byte_str_t based on hb_ubytes_t

Unuse start_embed<ByteStr>
Also renamed SubByteStr to byte_str_ref_t
More renaming to come

* substr renamed to str_ref in line with its type byte_str_ref_t

* uncamelize non-table struct names

* uncamelized non-struct types OpCode etc

* add byte_str_t copy ctor

* test

* test2

* undo tests

* fix bot failure

* undo the previous change

* fixed tabs, added inline

* Revert "fixed tabs, added inline"

This reverts commit 21163c30e9.

* fix tabs
2018-12-22 10:47:04 -05:00
Behdad Esfahbod 89d04129e2 [set] Actually derive iterator from hb_sorted_iter_t<> 2018-12-21 20:07:52 -05:00
Behdad Esfahbod fc35919d01 [set] Implement unified iterator 2018-12-21 20:06:17 -05:00
Behdad Esfahbod 4911e67d2d [set] Mark some internals protected 2018-12-21 20:00:52 -05:00
Behdad Esfahbod 954b985422 [iter] Add hb_sorted_iter_t<> 2018-12-21 19:55:02 -05:00
Behdad Esfahbod b205105c9e [iter] Change operator[] operand to be signed
To fix older compilers again (this was the case in hb_array_t).

hb-ot-layout-common.hh:1353: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-layout-common.hh:1354: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, Item>::operator[](unsigned int) const [with Iter = hb_array_t<const OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short unsigned int, 2u>]
hb-ot-layout-common.hh:1354: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-layout-common.hh: In member function 'bool OT::ClassDef::serialize(hb_serialize_context_t*, hb_array_t<const OT::IntType<short unsigned int, 2u> >, hb_array_t<const OT::IntType<short unsigned int, 2u> >)':
hb-ot-layout-common.hh:1490: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, Item>::operator[](unsigned int) const [with Iter = hb_array_t<const OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short unsigned int, 2u>]
hb-ot-layout-common.hh:1490: note: candidate 2: operator[](T*, int) <built-in>
2018-12-21 19:48:21 -05:00
Behdad Esfahbod 25786f49c1 [array] Port to hb_iter_t<>
hb_array_t is its own iterator...
2018-12-21 19:29:00 -05:00
Behdad Esfahbod 2a33ab0560 [iter] Change __more__ to fallback to __len__ 2018-12-21 18:53:01 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Behdad Esfahbod 2fc1860a5b [iter] Split hb_iter_t<> into hb_iter_t<> and hb_iter_mixin_t<> 2018-12-21 18:09:45 -05:00
Behdad Esfahbod 865deeb3be Adjust internal header dependencies 2018-12-21 17:46:10 -05:00
Behdad Esfahbod 8e5c2bc60b [Makefile.am] Minor 2018-12-21 17:29:11 -05:00
Behdad Esfahbod f419cef417 [iter] Include from hb.hh 2018-12-21 17:22:09 -05:00
Behdad Esfahbod 7557e34872 [iter] Move hb_fill() and hb_copy() to hb-iter.hh 2018-12-21 17:21:19 -05:00
Behdad Esfahbod 5e1840e031 [iter] Disallow copy-construction or assignment of hb_iter_t<>
Should only be done by subclass.
2018-12-21 16:39:57 -05:00
Behdad Esfahbod 65e8bd56ad [iter] Fix hb_copy() return value 2018-12-21 16:20:30 -05:00
Behdad Esfahbod 40d71211a8 [iter] Add const_iter_t / const_iter() 2018-12-21 16:19:44 -05:00
Behdad Esfahbod aaddfaa57a [iter] Make hb_fill() take collection type, not iter
Starting to get the hang of when take which.
2018-12-21 16:04:38 -05:00
Behdad Esfahbod 7b4eea853c [array] Add more hb_array() / hb_sorted_array() variants 2018-12-21 16:02:16 -05:00
Behdad Esfahbod 09740148e3 [serialize] Use component_list by reference, as a supplier 2018-12-21 15:56:01 -05:00
Behdad Esfahbod 3dbe1e364c [iter] Add .random_access() 2018-12-21 15:53:09 -05:00
Behdad Esfahbod 20f14b4aa6 [iter] Fix __end__() 2018-12-21 15:19:22 -05:00
Behdad Esfahbod 95265aeab7 [array] Remove copy constructor
Fixes https://github.com/harfbuzz/harfbuzz/issues/1502
2018-12-21 15:12:55 -05:00
Behdad Esfahbod 69d232eaea Fix bot
C:\projects\harfbuzz\src\hb-uniscribe.cc(709): error C2666: 'hb_vector_t<OPENTYPE_FEATURE_RECORD,8>::operator +': 3 overloads have similar conversions [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
2018-12-21 15:08:06 -05:00
Behdad Esfahbod b9a51f5310 Minor 2018-12-21 15:05:00 -05:00
Behdad Esfahbod bdb6da7226 [iter] Fix test again 2018-12-21 11:20:27 -05:00
Behdad Esfahbod e952075248 Minor 2018-12-21 11:15:16 -05:00
Behdad Esfahbod 35503d7d73 [iter] More prototyping 2018-12-21 03:03:46 -05:00
Behdad Esfahbod 73c7a896d1 [iter] Make hb_fill() and hb_copy() take iterators
I'm still going back and force...
2018-12-21 02:48:28 -05:00
Behdad Esfahbod 12e506fda4 [iter] Add hb_fill() 2018-12-21 02:47:04 -05:00
Behdad Esfahbod ad3ed58de5 [iter] Start prototyping hb_copy() 2018-12-21 02:25:58 -05:00
Behdad Esfahbod 44af738d19 [iter] Showcase implicit casts 2018-12-21 01:59:37 -05:00
Behdad Esfahbod 879faa2aee Rename 2018-12-21 01:57:40 -05:00
Behdad Esfahbod aeb696a91c [iter] Rename 2018-12-21 01:57:02 -05:00
Behdad Esfahbod 8001e00a47 [iter] First sample use 2018-12-21 01:53:27 -05:00
Behdad Esfahbod 19d2b5013d [iter] Add bidirectionality 2018-12-21 01:20:04 -05:00
Behdad Esfahbod 314d8698d0 [iter] Sketch new iterator design 2018-12-21 01:15:49 -05:00
Behdad Esfahbod f6d5f1e91c [iter] Add empty test 2018-12-21 00:23:46 -05:00
Behdad Esfahbod b80b97b549 Revert "Remove unused hb-iter.hh"
This reverts commit 969ff3c7aa.
2018-12-21 00:08:05 -05:00
Behdad Esfahbod a728c63a98 [vector] Add operator bool 2018-12-20 23:15:49 -05:00
Behdad Esfahbod bd36977392 Rename 2018-12-20 23:14:24 -05:00
Behdad Esfahbod e6ebc9b6f8 Remove unused typedef 2018-12-20 23:13:36 -05:00
Behdad Esfahbod 4941e95f10 2.3.0 2018-12-20 21:48:57 -05:00
Behdad Esfahbod 87f7c83fff [serializer] Add operator <<
Not sure if we are going to use it.  But might incentivize us to.
2018-12-20 15:54:17 -05:00
Behdad Esfahbod 5b70074edf Add hb_assign(obj, value) 2018-12-20 15:38:59 -05:00
Behdad Esfahbod 6124123393 [serialize] Adjust ClassDef
[skip ci]
2018-12-20 12:26:44 -05:00
Behdad Esfahbod 4220b7bdd7 Fix code on big-endian gcc / clang
Ouch!  We need a bigendian bot...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1498
2018-12-20 11:48:45 -05:00
Behdad Esfahbod c87ee72232 Minor [skip ci] 2018-12-19 22:28:16 -05:00
Behdad Esfahbod 5000a59a63 [saitnize] Minor 2018-12-19 22:27:09 -05:00
fanc999 3ee4ea9456 Fix build on older Visual Studio versions (#1499)
* src/hb-cff-interp-dict-common.hh: Use ull for unsigned int64_t

The llu suffix does not work for older Visual Studio versions
(pre-2013), but ull works for all the compilers that we attempt to
support.

* test/api: Fix build on pre-C99 compilers

Ensure variables are declared at the top of the block.

* src/hb-dsalgs.hh: Add specialization for hb_is_signed<> for __int8

Pre-Visual Studio 2010 does not consider __int8 (which is typedef'ed to
int8_t) to be equivilant to signed char, so the compiler cannot find the
corresponding hb_is_signed<> specialization that is needed.

The interesting thing is unsigned __int8 is considered to be equivilant
to unsigned char, so as the other types (short, int, long) that we look
for here, so only the specialization for __int8 is added here.

This will fix builds on Visual Studio 2008 at least.
2018-12-19 22:26:54 -05:00
Behdad Esfahbod a62870506d [sanitize] Use hb_static_size instead of ::static_size
https://github.com/harfbuzz/harfbuzz/issues/1496#issuecomment-448818112
2018-12-19 21:05:00 -05:00
Ebrahim Byagowi 0c9cd5d5f4
[test] Fix test-name-table.cc leak issue
Spotted it accidentally but wanted to see if is anything serious so went for fixing it
2018-12-19 21:18:30 +03:30
Behdad Esfahbod 3d9d7dc4dd [arrays] Add hb_ubytes_t for unsigned char 2018-12-18 22:11:23 -05:00
Behdad Esfahbod f1e95e40ed [arrays] Remove hb_supplier_t<> 2018-12-18 16:49:08 -05:00
Behdad Esfahbod f9417af29b [serialize] Propagate error from hb-face 2018-12-18 13:23:32 -05:00
Behdad Esfahbod 9aebfb4182 [serialize] Streamline error propagation 2018-12-18 13:22:17 -05:00
Behdad Esfahbod 969ff3c7aa Remove unused hb-iter.hh
The ideas there are all part of hb-array.hh now.  To be determined how we
want to use generic iterator patterns.
2018-12-17 22:43:00 -05:00
Behdad Esfahbod b1094fc2d2 [arrays] Minor tweaks to hb_supplier_t
I think I like to keep this hb_supplier_t thing separately from hb_array_t.
2018-12-17 22:41:04 -05:00
Behdad Esfahbod cf39c24205 [arrays] Rename Supplier to hb_supplier_t 2018-12-17 22:36:23 -05:00
Behdad Esfahbod 6b5eaa7530 Hide hb_addressof() 2018-12-17 21:55:33 -05:00
Behdad Esfahbod 6befa75cdf Enable __builtin_* on clang
We'll see which old clang versions this breaks...
2018-12-17 20:35:45 -05:00
Behdad Esfahbod 8d2d410256 Add hb_addressof() and use it to fix bug after hb_bytes_t merge
We cannot take address hb_bytes_t direction.  We need to use the
newly added hb_addressof(), ala std::addressof().
2018-12-17 20:23:26 -05:00
Behdad Esfahbod 49334f9b50 Enable system extensions in hb.hh
Fixes https://github.com/harfbuzz/harfbuzz/issues/1491
2018-12-17 18:27:36 -05:00
prrace 37c14bc745 Fix Solaris use after free (#1495) 2018-12-17 17:59:37 -05:00
Behdad Esfahbod 483f2491e4 Remove define GNU_SOURCE
Not needed.  We get it in our config.h automatically thanks to
AC_USE_SYSTEM_EXTENSIONS.  Let's see whose build it breaks...
If we end up putting it back, we should add other things from
that macro and remove the macro.
2018-12-17 17:56:10 -05:00
Behdad Esfahbod 87ff65aea1 Fix more warnings 2018-12-17 17:19:54 -05:00
prrace f9d219a174 Fix Solaris Trailing comma in enum warnings (#1490) 2018-12-17 17:18:47 -05:00
Ebrahim Byagowi 244a8627f7 Lower coretext_aat shaper priority (#1488)
Related to https://github.com/harfbuzz/harfbuzz/issues/1478
2018-12-17 13:01:43 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi 7ace10078c
Minor, fix two more ArrayOf incorrect operator logic 2018-12-17 20:07:04 +03:30
Behdad Esfahbod a1240383aa [arrays] Minor fix 2018-12-17 10:44:14 -05:00
Behdad Esfahbod 381c3548e9 [array] Add cast operator to add const to Type
In lieu of constructor removed in previous commit.
2018-12-17 00:39:30 -05:00
Behdad Esfahbod 15acf33c22 [array] Remove problematic constructor 2018-12-17 00:38:13 -05:00
Behdad Esfahbod 470369a871 [array] Add arithmetic operators 2018-12-17 00:21:38 -05:00
Behdad Esfahbod 6cd60c2f2a [array] Return Crap instead of Null if Type is not const
Ouch!
2018-12-17 00:09:06 -05:00
Behdad Esfahbod 94e72cf1c9 [array] Add operator * 2018-12-17 00:06:40 -05:00
Behdad Esfahbod 68d4a5eee0 [array] Add constructor from fixed-size array 2018-12-17 00:02:42 -05:00
Behdad Esfahbod a4354d2fd3 [array] Organize 2018-12-16 23:57:27 -05:00
Behdad Esfahbod 84c1865821 [arrays] Reduce Supplier<> even further 2018-12-16 23:52:17 -05:00
Behdad Esfahbod 1bcc4fc9f3 Whitespace 2018-12-16 23:47:56 -05:00
Behdad Esfahbod f85f6e815f [array] Add operator += 2018-12-16 23:45:07 -05:00
Behdad Esfahbod 7c0e3e9b2b [array] Add constructor from hb_array_t<const Type> 2018-12-16 23:43:17 -05:00
Behdad Esfahbod 92680361ec [arrays] Move Supplier<> to hb-array.hh 2018-12-16 23:38:51 -05:00
Behdad Esfahbod 2a3fa3f82f [arrays] Remove unnecessary constructor from Supplier<>
Looks like operator hb_array_t<> from vector works here. :)
2018-12-16 23:33:03 -05:00
Behdad Esfahbod 507cac4943 [arrays] Start moving Supplier<> to hb_array_t<> 2018-12-16 23:31:19 -05:00
Behdad Esfahbod 1e2c98126e [arrays] Remove unused stride from Supplier 2018-12-16 22:31:16 -05:00
Behdad Esfahbod 0d0fe9df46 [arrays] Remove need of stride in Supplier<> 2018-12-16 22:31:13 -05:00
Behdad Esfahbod dcfa4a8d71 [array] Remove custom hb_bytes_t implementation 2018-12-16 22:31:13 -05:00
Behdad Esfahbod 3656f56d47 [arrays] Minor 2018-12-16 22:31:13 -05:00
Behdad Esfahbod aa8f94714e [array] Minor 2018-12-16 22:31:13 -05:00
Behdad Esfahbod 5a552f7546 [array] Move hb_array_t and related types to hb-array.hh 2018-12-16 22:31:10 -05:00
Behdad Esfahbod 01d06e34ff Minor change to explicit_operator aesthetics 2018-12-16 14:27:43 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod 7251c77290 Whitespace 2018-12-15 21:00:55 -05:00
Behdad Esfahbod 829b56b1a2 Whitespace 2018-12-15 16:20:13 -05:00
Behdad Esfahbod 42a1012562 [subset] Actually subset GDEF 2018-12-13 19:39:59 -05:00
Behdad Esfahbod c9c746c7f6 [subset] Fix up ClassDef some more 2018-12-13 18:39:30 -05:00
Behdad Esfahbod 7ee6128902 [subset] Fix ClassDefFormat1 subsetting 2018-12-13 18:32:04 -05:00
Behdad Esfahbod 1b6d0c44b3 [subset] Sketch GDEF subsetting 2018-12-13 18:10:48 -05:00
Behdad Esfahbod 705e2f5056 [subset] Implement for ClassDef 2018-12-13 17:48:42 -05:00
Behdad Esfahbod 6e33a3955d Minor 2018-12-13 16:40:01 -05:00
Behdad Esfahbod cc65901ca7 [serialize] Implement for ClassDef 2018-12-13 16:01:45 -05:00
Behdad Esfahbod e5309e4fd8 [serialize] Implement for ClassDefFormat2 2018-12-13 15:57:12 -05:00
Behdad Esfahbod c8b43cbe31 [serialize] Implement for ClassDefFormat1 2018-12-13 15:53:00 -05:00
Behdad Esfahbod 5761031329 [subset] Minor 2018-12-12 21:21:26 -05:00
Michiharu Ariza 798e98c47b [CFF] bad offset in Index (#1476)
* Update hb-ot-cff-common.hh

* fix bug

* bummer fix wasn't hit. refix

* additional sanity check

* Added test cases for oss-fuzz issues 11805, 11806
2018-12-12 21:08:15 -05:00
Michiharu Ariza bcb4ecaf68 [CFF] check out of range FD index (#1477)
* add fd index checks to subr subsetter

also added oss-fuzz test case

* undid SubrSubsetParam::is_valid

because already validated by SubrClosures.valid
2018-12-12 20:36:01 -05:00
Behdad Esfahbod 2cc993e035 [dispatch] Minor 2018-12-12 10:07:38 -05:00
Behdad Esfahbod 602fbfe3c9 [sanitize] Fix sanitizing sublookup array 2018-12-12 09:56:47 -05:00
Behdad Esfahbod c78e4784fb [dispatch] Minor 2018-12-12 09:50:18 -05:00
Behdad Esfahbod f9d211af1d Revert "Minor fix re sanitize of Lookup subtables"
This reverts commit 7146718bef.

Fixing differently.
2018-12-12 09:44:30 -05:00
Ebrahim Byagowi 7ee5c52345
minor style fix, use void in methods on no argument 2018-12-12 15:14:37 +03:30
Behdad Esfahbod 7146718bef Minor fix re sanitize of Lookup subtables
We were dereferencing Null pointers and trying to sanitize them,
which is not necessary...
2018-12-11 23:44:29 -05:00
Behdad Esfahbod ce069d1932 Minor 2018-12-11 23:07:48 -05:00
Behdad Esfahbod 1aea869446 [subset] Map glyphs during SingleSubst subsetting
Ha!
2018-12-11 22:53:58 -05:00
Behdad Esfahbod 41d1a1c10f [subset] Minor 2018-12-11 22:48:27 -05:00
Behdad Esfahbod 2aba2c6c73 [serialize] Break down assert 2018-12-11 21:21:13 -05:00
Michiharu Ariza 2941208f1e [CFF] oss-fuzz issue 11690 ASSERT: substr.offset >= opStart (#1461)
* fix oss-fuzz 11690: substr.offset >= opStart

detect recursive subroutine call & handle as error

* fix build failure

* add minimized test case for oss-fuzz 11690

* removed asserts
2018-12-11 15:21:24 -05:00
Michiharu Ariza 333586245c minimize use of assert: removed or changed to error handling (#1467) 2018-12-11 15:20:20 -05:00
👻 9f3a51ddb9 [ucdn] Fix header
Fixes https://github.com/harfbuzz/harfbuzz/issues/1470
2018-12-11 13:38:05 -05:00
Ebrahim Byagowi 1683bb2c93
[glyf] minor 2018-12-08 13:57:39 +03:30
Ebrahim Byagowi f7cfe99815
[os2] Move typometrics detection logic to the table (#1465) 2018-12-08 13:40:44 +03:30
Ebrahim Byagowi 47cf9a9633
Apply non-controversial parts of ot-style (#1464)
Things to be used in https://github.com/harfbuzz/harfbuzz/pull/1459
2018-12-08 10:20:25 +03:30
Michiharu Ariza 4d809696ef fix for issue #1447 (#1462)
Added case for OpCode_BaseFontName. This opcode in spec but practically unused.
Added a comment for default case which can't be hit
2018-12-07 20:49:39 -08:00
Ebrahim Byagowi 1abd4fcaec
[fdsc] minor 2018-12-07 22:34:12 +03:30
Michiharu Ariza 59345cdef3 [CFF] Refix oss-fuzz 11714: set_blends (PR #1458) (#1460)
* pass subarray of stack to set_blends

* get_subarray to return a value, not ref

* restored error check (with tweak)
2018-12-06 13:36:26 -08:00
Behdad Esfahbod 20245f0000 Fix likely check
Ouch!
2018-12-06 10:27:37 -08:00
Behdad Esfahbod d866e905fd Add default value to first argument of sub_array() 2018-12-06 10:26:32 -08:00
Behdad Esfahbod f1352f7486 Add sub_array to hb_vector_t 2018-12-06 10:21:17 -08:00
Behdad Esfahbod ca23b71935 Add default-value for second arg of sub_array() 2018-12-06 10:21:17 -08:00
Michiharu Ariza 1ccbdcf73b Merge branch 'master' into cff-check-blends 2018-12-05 21:37:38 -08:00
Michiharu Ariza 14d29a1043 check number of blends against args on stack 2018-12-05 21:33:29 -08:00
Ebrahim Byagowi f95324a335
Merge pull request #1457 from harfbuzz/cff-varstore-sanitize
[CFF] oss-fuzz issue 11713 (CFF2VariationStore::serialize)
2018-12-06 08:33:44 +03:30
Michiharu Ariza c31092ab34 sanitize variationStore in CFF2 against its size 2018-12-05 17:04:55 -08:00
Michiharu Ariza 34e3ef8ff3 Merge branch 'master' into cff-subr-sanitize 2018-12-05 15:50:05 -08:00
Behdad Esfahbod d9dabc00e9
Merge pull request #1454 from harfbuzz/cff-fixbcd
[CFF] fix oss-fuzz issue 11674: parse_bcd
2018-12-05 15:39:34 -08:00
Michiharu Ariza 6dcfda92c1 sanitize CFF1 & CFF2 global subrs 2018-12-05 15:07:46 -08:00
Michiharu Ariza 6708c5595f fix oss-fuzz issue 11675 (ASSERT: count <= str.len)
Also added an additional error check to avail ()
2018-12-05 12:51:18 -08:00
Michiharu Ariza 2cb9d4c183 Merge branch 'master' into cff-fixbcd 2018-12-05 11:25:29 -08:00
Michiharu Ariza a5fa843c74 fixed a bug with fractional part in a negative value 2018-12-05 11:18:16 -08:00
Ebrahim Byagowi 8394a6cb25
[os2] Make newer table fields accessible (#1452) 2018-12-05 15:23:41 +03:30
Ebrahim Byagowi 5ab086ebb1 [fdsc] Implement the table parsing
Related to https://github.com/harfbuzz/harfbuzz/issues/1337

May used in addition to an API related to STAT.

Lots of Apple fonts have it.
2018-12-05 14:48:31 +03:30
Ebrahim Byagowi 8f80e53341 [gasp] Implement the table parsing
May or may not be used in https://github.com/harfbuzz/harfbuzz/pull/1432
2018-12-05 14:48:31 +03:30
Ebrahim Byagowi 79e7e3445e
Merge pull request #1449 from harfbuzz/cff-fixcharset
[CFF] fix for oss-fuzz 11657: Charset overrun
2018-12-05 13:25:18 +03:30
Ebrahim Byagowi cf4b7db6b1
Merge pull request #1448 from harfbuzz/cff-leak
[CFF] fix leak: oss-fuzz 11662
2018-12-05 13:23:23 +03:30
Michiharu Ariza 620d1ef588 fix unsigned long const 2018-12-05 00:36:11 -08:00
Michiharu Ariza 28dfb4c142 fix signed/unsigned comparison 2018-12-05 00:26:03 -08:00
Michiharu Ariza f9cee08edd use sized int types in parse_bcd 2018-12-04 23:58:26 -08:00
Michiharu Ariza c01a5f32a3 refix 2018-12-04 23:23:23 -08:00
Michiharu Ariza 755fefc921 fix bug 2018-12-04 23:18:28 -08:00
Michiharu Ariza 0e81b153af fix typo 2018-12-04 22:40:07 -08:00
Michiharu Ariza 85d4b15cd8 include float.h 2018-12-04 22:30:33 -08:00
Michiharu Ariza 5a7c371e4c check overflow & clamp 2018-12-04 22:24:38 -08:00
Michiharu Ariza 32cc46c75a [CFF] fix oss-fuzz issue 11670: NULL dereference (#1450)
* guard against no subr access

* code tweak

* add minimized testcase for oss-fuzz 11670 (Null deference)
2018-12-05 09:02:34 +03:30
Michiharu Ariza d3d2f32c6e fix oss-fuzz 11657: buffer overrun
Check overrun in Charset1_2::get_glyph
2018-12-04 13:51:26 -08:00
Ebrahim Byagowi d0a250a7b1
Reuse hb_aat_layout_has_* logic in coretext-aat detection logic (#1442) 2018-12-04 23:42:13 +03:30
Michiharu Ariza 803d2f92dc Merge branch 'master' into cff-leak 2018-12-04 11:01:26 -08:00
Michiharu Ariza 6ce8d10b45 add unlikely to error handling 2018-12-04 10:39:17 -08:00
Michiharu Ariza 0b952e6026 more leak fixes 2018-12-04 10:22:35 -08:00
Michiharu Ariza 9473463f5c fix attempt for oss-fuzz 11662 leak 2018-12-04 09:58:48 -08:00
Michiharu Ariza 04f2ca9421 removed assert 2018-12-04 09:24:07 -08:00
Behdad Esfahbod c968869f21
Merge pull request #1441 from harfbuzz/cff-doublenum
use double as CFF Number implementation
2018-12-04 04:14:13 -05:00
Michiharu Ariza c48f53d309 more double changes 2018-12-03 16:59:41 -08:00
Michiharu Ariza 5fff6ab002 additional precision made a difference in extents test 2018-12-03 16:06:58 -08:00
Michiharu Ariza 9e5180cd44 more double changes 2018-12-03 15:32:42 -08:00
Michiharu Ariza 9af33d7a2a Number to use double for all types 2018-12-03 14:48:46 -08:00
Ebrahim Byagowi 01f628cf55 [aat] Expose hb_aat_layout_has_tracking API 2018-12-03 22:27:26 +03:30
Behdad Esfahbod d19b1680b5 [aat] Expose a couple APIs
New API:
+hb_aat_layout_has_substitution()
+hb_aat_layout_has_positioning()
2018-12-03 10:41:37 -05:00
Behdad Esfahbod 84efe0438e [aat] Fix division sign fallout
Happened after 11d2f49af8
since now nClasses is unsigned int...
2018-12-02 12:39:14 -05:00
Behdad Esfahbod 2087f5a2a7 Add casts to hb_array_t<> 2018-12-01 20:04:45 -05:00
Behdad Esfahbod 58d4d19947 Simplify build source list 2018-12-01 19:34:18 -05:00
Behdad Esfahbod 11d2f49af8 New approach to change BigEndian casts to be int-sized
Fixes spurious warnings like:
Fixes https://github.com/harfbuzz/harfbuzz/issues/1436
2018-12-01 13:12:21 -05:00
Behdad Esfahbod 50e0273ab1 Change hb_assert_unsigned_t<> to hb_is_signed<> 2018-12-01 13:07:49 -05:00
Behdad Esfahbod c3a8b047aa Revert "Change BigEndian casts to be int-sized"
This reverts commit eb5ddd32bf.

Broke tests, badly.  To be investigated and reenabled.
2018-12-01 00:26:39 -05:00
Behdad Esfahbod be45677ab6 Minor 2018-12-01 00:04:29 -05:00
Behdad Esfahbod eb5ddd32bf Change BigEndian casts to be int-sized
Fixes spurious warnings like:
Fixes https://github.com/harfbuzz/harfbuzz/issues/1436
2018-12-01 00:03:01 -05:00
Behdad Esfahbod e8860fdcaa Fix more warning 2018-11-30 23:38:24 -05:00
Behdad Esfahbod af349ee348 Fix warning 2018-11-30 23:20:50 -05:00
Behdad Esfahbod 825df6dbc7 [CFF] Change spaces to tabs 2018-11-30 23:04:59 -05:00
Behdad Esfahbod 592f39b3c4 [CFF] Whitespace 2018-11-30 22:54:57 -05:00
Behdad Esfahbod a2e8d1d455 Minor 2018-11-30 22:54:20 -05:00
Behdad Esfahbod 5e64e0f532
Merge pull request #1113 from harfbuzz/cff-subset
CFF/CFF2 subsetter
2018-11-30 22:40:54 -05:00
Bruce Mitchener 09096aa89f Use nullptr instead of 0/NULL. (#1435)
* Use nullptr instead of 0/NULL.

* Update test-name-table.cc
2018-11-30 22:22:49 -05:00
Michiharu Ariza d8c6913765 undo 0u 2018-11-30 18:58:14 -08:00
Michiharu Ariza 2c859b3880 Merge branch 'master' into cff-subset 2018-11-30 18:47:34 -08:00
Behdad Esfahbod fb05908213 Revert ugly fixes
Now that we have 6daf45e0, revert cryptic hacks...

This reverts commit abd81ed4f5.
This reverts commit 9c6921c08c.
This reverts commit d39760cabf.
This reverts commit fedd8e6c17.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:15 -05:00
Behdad Esfahbod dfad19ad5a Make operator [] take signed int
The built-in operator takes signed int.  So, match it, such that
the built-in is never a better or equally-good match to our operator.
Fixes "ambiguous overload" errors from gcc 4.2 and VS 2008.

See https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:14 -05:00
Michiharu Ariza 9483da145d redo fixes 2018-11-30 16:59:41 -08:00
Michiharu Ariza 291da44823 yet another 2018-11-30 16:50:46 -08:00
Michiharu Ariza b1821b9d09 some more 2018-11-30 16:31:01 -08:00
Michiharu Ariza 9784cff556 fix another pesky gcc error 2018-11-30 16:07:08 -08:00
Michiharu Ariza 23a797b443 silence picky gcc errors 2018-11-30 15:15:31 -08:00
Michiharu Ariza 9ae954f43a Merge branch 'master' into cff-subset 2018-11-30 15:00:52 -08:00
Behdad Esfahbod fedd8e6c17 One more.........
I wonder if there's something better to do about these :(.

In file included from hb-ot-color.cc:31:
hb-ot-color-cpal-table.hh: In member function 'unsigned int OT::CPAL::get_size() const':
hb-ot-color-cpal-table.hh:118: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
2018-11-30 16:50:30 -05:00
Behdad Esfahbod bc5db9b080 One more....
hb-ot-vorg-table.hh:96: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:87: note: candidate 1: const Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) const [with Type = OT::VertOriginMetric, unsigned int PreallocedCount = 8u]
hb-ot-vorg-table.hh:96: note: candidate 2: operator[](const T*, int) <built-in>
2018-11-30 16:04:52 -05:00
Behdad Esfahbod d39760cabf One more...
Sigh.

hb-ot-kern-table.hh: In member function 'int OT::KernSubTableFormat3<KernSubTableHeader>::get_kerning(hb_codepoint_t, hb_codepoint_t) const':
hb-ot-kern-table.hh:59: error: ambiguous overload for 'operator[]' in 'kernValue[kernIndex[i]]'
hb-ot-kern-table.hh:59: note: candidates are: operator[](T*, int) <built-in>
hb-dsalgs.hh:574: note:                 Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::IntType<short int, 2u>]
2018-11-30 15:55:30 -05:00
Behdad Esfahbod 9c6921c08c More...
hb-ot-layout-gsubgpos.hh:1707: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
...
2018-11-30 15:16:57 -05:00
Behdad Esfahbod f998bb2086 More weird fixes
In file included from hb-ot-name.cc:29:
hb-ot-name-table.hh: In member function 'unsigned int OT::name::get_size() const':
hb-ot-name-table.hh:157: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::NameRecord]
hb-ot-name-table.hh:157: note: candidate 2: operator[](const T*, int) <built-in>
hb-ot-name-table.hh: In member function 'void OT::name::accelerator_t::init(hb_face_t*)':
hb-ot-name-table.hh:196: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:196: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-name-table.hh:197: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:197: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-name-table.hh:198: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-dsalgs.hh:574: note: candidate 1: Type& hb_array_t<Type>::operator[](unsigned int) const [with Type = const OT::NameRecord]
hb-ot-name-table.hh:198: note: candidate 2: operator[](T*, int) <built-in>
make[4]: *** [libharfbuzz_la-hb-ot-name.lo] Error 1
make[3]: *** [all-recursive] Error 1
2018-11-30 12:52:21 -05:00
Behdad Esfahbod abd81ed4f5 Umm. Cryptic, yes
In file included from hb-face.cc:35:
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_compiles_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_instance_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc: In function 'hb_blob_t* _hb_face_builder_data_reference_blob(hb_face_builder_data_t*)':
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](const T*, int) <built-in>
2018-11-30 11:52:41 -05:00
Behdad Esfahbod 0f32c95e14 Fix a few more sizeof(vector[0]) errors with weird compilers 2018-11-30 11:31:39 -05:00
Behdad Esfahbod 88630a458b Fix build for realz 2018-11-30 01:11:04 -05:00
Behdad Esfahbod 346286d04e Fix build 2018-11-30 00:44:40 -05:00
Behdad Esfahbod 31f39cb41e [post] Rename v2 to v2X 2018-11-30 00:38:08 -05:00
Behdad Esfahbod e3dd47e602 Move things 2018-11-30 00:32:12 -05:00
Behdad Esfahbod 27a6b0a2f7 Fix build for realz 2018-11-29 16:29:30 -05:00
Behdad Esfahbod e2af4dd1ec [uniscribe] Fix build 2018-11-29 16:03:24 -05:00
Ebrahim Byagowi e7bd29ea11
Limit __builtin_bswap16 to GCC >= 5 as it was implemented on 4.8 2018-11-29 23:47:20 +03:30
Behdad Esfahbod ac0264717b [coretext] Fix compile
Fingers crossed.
2018-11-29 15:07:44 -05:00
Behdad Esfahbod 5c4fead734 Convert "static const hb_tag_t" constants to enum 2018-11-29 15:05:47 -05:00
Behdad Esfahbod 9e4138c825 Convert misc "static const" constants to enum 2018-11-29 15:01:10 -05:00
Behdad Esfahbod 44cbd2ea3d Convert "static const bool" constants to anonymous enum 2018-11-29 14:56:27 -05:00
Behdad Esfahbod 861bc75349 [vector] Make pointer cast explicit
Too bad this doesn't help MSVC 2008 build, as explicit operators are
C++11.
2018-11-29 14:34:44 -05:00
Behdad Esfahbod 72955e6825 Hand-hold older compilers 2018-11-29 14:28:44 -05:00
Behdad Esfahbod 000d4b128e Make shaper's override_features() override user features as well
The override_features is used to override features that are normally
discretionary features, but in a specific shaper are for various
reasons desired to be bolted on or off, because they've been used
for inherent shaping.  As such, it makes sense that they also
override user features.  Ie. if user turned 'liga' on, we don't
want Khmer shaping to become broken...  Or turn 'clig' off...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1310
2018-11-29 12:32:47 -05:00
Behdad Esfahbod a95d9d8c84 [khmer] Move 'clig' to overrides
Prerequisite for https://github.com/harfbuzz/harfbuzz/issues/1310
2018-11-29 12:32:04 -05:00
Behdad Esfahbod 282ce7230b Fix "typename outside template" issues
Nothing an extra template class wouldn't fix...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1419
2018-11-29 12:18:14 -05:00
Behdad Esfahbod dc41ecef85 2.2.0 2018-11-29 11:53:53 -05:00
Behdad Esfahbod 7b85081be4 [icu] Minor 2018-11-29 11:34:22 -05:00
Behdad Esfahbod 0bcb1de126
Merge pull request #1418 from gvictor/replace_icu_deprecated
Replace @Deprecated ICU API - USCRIPT_CODE_LIMIT
2018-11-29 10:39:18 -05:00
Michiharu Ariza 471db3aa6f workaround for issue #1417 2018-11-28 17:06:11 -08:00
Michiharu Ariza 32d291ae89 Merge branch 'master' into cff-subset 2018-11-28 16:27:45 -08:00
Behdad Esfahbod 42a2b496e4 [kerx] Fix Format2 index calc again 2018-11-28 15:24:30 -05:00
Behdad Esfahbod a3267cf803 [kern] Fix kern table Format2 offsetToIndex
Fixes https://github.com/harfbuzz/harfbuzz/issues/1421
2018-11-28 15:06:01 -05:00
Behdad Esfahbod f9a9c0fd1e [kerx] Fix ClassTable implementation for 'kern' table Format 2 2018-11-28 14:51:56 -05:00
Behdad Esfahbod 5b4a789ca8 [aat] Towards adding two ClassTable's 2018-11-28 14:49:45 -05:00
Behdad Esfahbod 987f418772
Merge pull request #1398 from Adenilson/bigInt01
Optimize harfbuzz big integer conversions
2018-11-27 17:40:32 -05:00
Behdad Esfahbod 4e2a03b6b6
Comment 2018-11-27 17:40:09 -05:00
Adenilson Cavalcanti 4a719a7f4c Optimize harfbuzz big integer conversions
Profiling showed that type conversions were adding considerable cycles in time
spent doing text shaping.

The idea is to optimize it using native processor instructions to help Blink
layout performance.

Doing further investigation revelead that compilers may not use the
proper instruction on ARM 32bits builds (i.e. REV16).

One way to insure that the generated ASM was ideal for both gcc/clang
was using __builtin_bswap16.

Added bonus is that we no longer need to test for CPU architecture.
2018-11-27 13:43:05 -08:00
Victor Chang a85886fc77 Replace @Deprecated ICU API - USCRIPT_CODE_LIMIT
Use of the deprecated API USCRIPT_CODE_LIMIT prevents harfbuzz
using the ICU4C as a shared library.

The API has been replaced by u_getIntPropertyMaxValue(UCHAR_SCRIPT)
2018-11-27 11:51:45 +00:00
Behdad Esfahbod 574d888c8a [aat] Ignore GSUB table of Muthu Foundry if they have morx table
Fixes https://github.com/harfbuzz/harfbuzz/issues/1410
2018-11-25 16:51:22 -05:00
Behdad Esfahbod 4151c2848d [GDEF] Move more code 2018-11-25 16:38:36 -05:00
Behdad Esfahbod 4f21703f22 [GDEF] Move code around 2018-11-25 15:59:18 -05:00
Behdad Esfahbod 4ed9fb1a00 [GDEF] Minor 2018-11-25 15:53:20 -05:00
Behdad Esfahbod 926f512f35 [aat.feat] Rework API and implementation
Fixes https://github.com/harfbuzz/harfbuzz/pull/1346
2018-11-25 01:16:02 -05:00
Behdad Esfahbod 84dacbca7e [aat.feat] Add _MAX_VALUE to enums 2018-11-25 01:16:02 -05:00
Behdad Esfahbod 3922aae162 [aat.feat] Minor 2018-11-25 01:16:02 -05:00
Behdad Esfahbod 0f8e98eca2 [aat.feat] Whitespace 2018-11-25 01:16:02 -05:00
Behdad Esfahbod c225606833 [aat.feat] Port to SortedUnsizedArrayOf.bsearch() 2018-11-25 01:16:02 -05:00
Behdad Esfahbod 52ae9867ef [AAT.feat] Use lsearch for looking up SettingName's
They are not sorted.
2018-11-25 01:16:02 -05:00
Behdad Esfahbod 44b9331f66 [aat] Fix include issues 2018-11-25 01:16:02 -05:00
Behdad Esfahbod b206133d1f [aat] Move contents of hb-aat.h to hb-aat-layout.h
Since it was pages and pages...
2018-11-25 01:16:02 -05:00
Behdad Esfahbod 2cb235d021 [aat.feat] Fix enum namespace 2018-11-25 01:16:02 -05:00