Commit Graph

7018 Commits

Author SHA1 Message Date
Behdad Esfahbod 16cc313dcd [iter] Use hb_sink() 2019-02-14 10:40:05 -08:00
Behdad Esfahbod b702a0cbf8 [iter] Add hb_sink() 2019-02-14 10:39:58 -08:00
Michiharu Ariza 1cb1d5d7fb Merge branch 'master' into cff-more-arrayof-fixes 2019-02-14 10:09:19 -08:00
Michiharu Ariza 6f1dfd082c Merge branch 'master' into cff-retain-gids 2019-02-14 10:08:16 -08:00
Behdad Esfahbod 7d2376de33 Merge branch 'master' into iter 2019-02-13 22:13:37 -08:00
Ebrahim Byagowi 890d0ee77f
Minor, use a meaningful naming in template parameter (#1582) 2019-02-14 00:27:01 +03:30
Michiharu Ariza 8a568a8858 Merge branch 'master' into cff-more-arrayof-fixes 2019-02-13 11:25:00 -08:00
Michiharu Ariza b1dbc77fa6 Merge branch 'master' into cff-retain-gids 2019-02-13 11:24:38 -08:00
Ebrahim Byagowi 1e1d0e63df
Fix djgpp complains by tweaking templates (#1579)
For some reasons djgpp doesn't understand "unsigned int" can be same
with one of uint*_t anyway so lets do that for it explicitly.

Just to note, our CI's djgpp is based GCC 7.2.0 and isn't old.
2019-02-13 12:58:01 +03:30
Michiharu Ariza bc33c617b8 Merge branch 'master' into cff-retain-gids 2019-02-12 15:10:50 -08:00
Michiharu Ariza c6af846178 tweaked --desubroutinize to remove hintmask only subrs 2019-02-12 15:10:43 -08:00
Michiharu Ariza c83412e4ce Merge branch 'master' into cff-more-arrayof-fixes 2019-02-11 14:16:25 -08:00
Ken fdfa3d29b7 hb-coretext.cc: remove TARGET_OS_MAC from test (#1578)
it is always true when building on APPLE systems
and this file only builds on APPLE systems
2019-02-11 11:16:05 +03:30
Michiharu Ariza e2856c2d85 retain FDSelect & FDArray with --retain-gids
so in sync with fonttools behavior
2019-02-07 15:32:32 -08:00
Michiharu Ariza 1239b6b2b4 Merge branch 'master' into cff-more-arrayof-fixes 2019-02-07 10:29:40 -08:00
Michiharu Ariza a5fa76977b Merge branch 'master' into cff-retain-gids 2019-02-07 10:28:13 -08:00
Michiharu Ariza 214d0b024b minor change 2019-02-07 10:27:43 -08:00
Ken Cunningham 7859decdd0 hb-coretext.cc: clean up macosx test
TARGET_OS_OSX was introduced only in late OS versions
so always returns as "0" on older systems.

if !TARGET_OS_IPHONE can work, as it returns as !0 on older
systems where TARGET_OS_IPHONE is not defined, but is not
specific

if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
is both specific and accurate on all systems.
2019-02-05 20:26:49 -08:00
Michiharu Ariza 30b781f20a Merge branch 'master' into cff-retain-gids 2019-02-01 14:50:34 -08:00
Michiharu Ariza c12862657f added desubroutinize & retain-gids full test cases with CFF fonts
and CFF retain-gids fixes
2019-02-01 14:50:01 -08:00
Michiharu Ariza f2908b4d8f Implement subset --regain-gids option with CFF1/2
along with api tests & expected results
2019-01-31 14:16:37 -08:00
Behdad Esfahbod 1e06282105 Adjust hb_is_signed<>
Fixes https://github.com/harfbuzz/harfbuzz/issues/1535
2019-01-31 13:57:17 -08:00
Behdad Esfahbod 21ea1c9152 Remove stale comment 2019-01-31 13:57:17 -08:00
Michiharu Ariza 9f80eb0177 Merge branch 'master' into cff-more-arrayof-fixes 2019-01-31 12:54:36 -08:00
Behdad Esfahbod 2d940946d5 [iter] Fix mystery crash
Fuzzer caught it:

==14==ERROR: AddressSanitizer: stack-use-after-return on address 0x7fca2ed7a3e0 at pc 0x0000006057aa bp 0x7ffc3290f1d0 sp 0x7ffc3290f1c8
READ of size 4 at 0x7fca2ed7a3e0 thread T0
SCARINESS: 55 (4-byte-read-stack-use-after-return)
    #0 0x6057a9 in OT::SingleSubstFormat2::subset(hb_subset_context_t*) const /src/harfbuzz/src/./hb-ot-layout-gsub-table.hh:194:40
    #1 0x5ff921 in hb_subset_context_t::return_t OT::SingleSubst::dispatch<hb_subset_context_t>(hb_subset_context_t*) const /src/harfbuzz/src/./hb-ot-layout-gsub-table.hh:256:13

I can't reproduce locally, but many of the bots are failing because of this
as well.

It's a pity that operator-> must return pointer.  Ugh.  Why?!
2019-01-30 16:03:16 -08:00
Behdad Esfahbod cbe2118c58 Merge branch 'master' into iter 2019-01-30 15:07:09 -08:00
Behdad Esfahbod 7c292c0853 [iter] Warning fix
Not sure why I don't get it, but this warning:

warning: base class ‘struct hb_iter_fallback_mixin_t<hb_array_t<const OT::UVSMapping>, const OT::UVSMapping&>’ should be explicitly initialized in the copy constructor [-Wextra]
2019-01-30 14:54:23 -08:00
Behdad Esfahbod d983c529b6
Merge pull request #1564 from googlefonts/retain_gids
[subset] Add --retain-gids option to the subsetter.
2019-01-30 17:17:59 -05:00
Behdad Esfahbod 55d1d7c8bc 2.3.1 2019-01-30 13:54:15 -08:00
Behdad Esfahbod e799004e9f [iter] Whitespace 2019-01-29 17:15:12 -08:00
Behdad Esfahbod 849a0f1758 [iter] Add hb_iter_with_fallback_t instead 2019-01-29 17:10:19 -08:00
Behdad Esfahbod 4d40ed9d1a [iter] Add hb_iter_with_mixin_t<> 2019-01-29 13:55:23 -08:00
Behdad Esfahbod 6521d5b201 [iter] Export operator << / >> 2019-01-29 13:44:39 -08:00
Behdad Esfahbod 84a25d79c6 [iter] Rename 2019-01-29 13:39:19 -08:00
Garret Rieger 198859bb37 [subset] For retain gids don't truncate glyphs past the highest requested subset glyph. 2019-01-29 13:19:21 -08:00
Garret Rieger 05e99c86ba [subset] A few small fixes for the new subset plan api. 2019-01-29 13:19:21 -08:00
Garret Rieger bdbe047d6c [subset] Update hb-subset-plan.cc to match hb-subset-plan.hh. 2019-01-29 13:19:21 -08:00
Garret Rieger 74c44ffeba [subset] Update hb-subset-glyf.cc to use new hb-subset-plan API. 2019-01-29 13:19:21 -08:00
Garret Rieger 4842294b86 [subset] Update gsub to use glyphset() method of subset plan. 2019-01-29 13:19:21 -08:00
Garret Rieger 853b1f1aa5 [subset] Correct maxp num glyph's to use new subset plan method. 2019-01-29 13:19:21 -08:00
Garret Rieger 846e05a298 [subset] Re-add glyphs array to subset plan, with new name 'glyphs_deprecated'. Switch CFF subsetting to use it. 2019-01-29 13:19:21 -08:00
Garret Rieger 03e88eab5c Re-implement HMTX/VMTX subsetting. Update it to support glyph renumbering and simplify the implementation. 2019-01-29 13:19:21 -08:00
Garret Rieger 925be29223 Update hb-ot-vorg-table and hb-ot-layout-common to use the updated subset plan api. 2019-01-29 13:19:21 -08:00
Garret Rieger 4af3be6ef8 Remove glyph array from subset plan, make num_glyphs and glyphset private. 2019-01-29 13:19:21 -08:00
Garret Rieger 23f364429d [subset] Fix hdmx subsetting when retain gids is enabled. 2019-01-29 13:19:21 -08:00
Garret Rieger 2da1654aef [subset] Compute num_glyphs during subset plan construction.
Update maxp to use the correct num glyphs.
2019-01-29 13:19:21 -08:00
Garret Rieger 96b038f375 [subset] fix failure to init instruction ranges values for an invalid glyph. 2019-01-29 13:19:21 -08:00
Garret Rieger 4b1ac3a2fa [subset] Do some refactoring in hb-subset-glyf.cc.
- Extract code out into helper methods in several places.
- Bundle loca address, size and is short into a struct.
2019-01-29 13:19:21 -08:00
Garret Rieger b7f971884e Add retain_gids option to subset input. Update glyf and loca handling to respect retain_gids. 2019-01-29 13:19:21 -08:00
Michiharu Ariza b379900755 Merge branch 'master' into cff-more-arrayof-fixes 2019-01-29 12:19:57 -08:00
Behdad Esfahbod e75b22039f Move hb_addressof() to hb-meta.hh 2019-01-28 21:26:23 -05:00
Behdad Esfahbod 71157a4520 [meta] Remove _ft struct names
Using decltype() instead.
2019-01-28 21:20:12 -05:00
Behdad Esfahbod 9103bd056f [pair] Use decltype 2019-01-28 21:16:51 -05:00
Behdad Esfahbod a30e13469e [iter] Add operator << to set / vector 2019-01-28 16:39:01 -05:00
Behdad Esfahbod d438e61042 [iter] Fix operator() impls 2019-01-28 16:34:04 -05:00
Behdad Esfahbod 57795bc8dd [iter] Add operator>> and operator<< 2019-01-28 16:23:12 -05:00
Behdad Esfahbod 8bd96be994 [iter] Use auto c = C.iter() internally 2019-01-28 16:17:36 -05:00
Behdad Esfahbod 073fa4ac5a Merge branch 'master' into iter 2019-01-28 14:35:41 -05:00
Behdad Esfahbod 9a1df82e3f [uniscribe] Whitelist function type cast 2019-01-28 14:15:18 -05:00
Behdad Esfahbod 6e1c3eaf70 Fix sign comparison error 2019-01-28 14:12:41 -05:00
Behdad Esfahbod 9db7a7da63 Fix warning
c:\projects\harfbuzz\src\hb-ot-color-cbdt-table.hh(59): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
2019-01-28 14:09:59 -05:00
Behdad Esfahbod 51b584880e [pragma] Silence MSVC unknown-pragma warning 2019-01-28 14:09:45 -05:00
Behdad Esfahbod d592bd16cd Try fixing MSVC build 2019-01-28 13:41:40 -05:00
Behdad Esfahbod 0363ce650b [iter] Accept C arrays in hb_iter() 2019-01-27 01:06:32 +01:00
Behdad Esfahbod b62e7f9223 [test] Test unary operator+
"Test" as in compiles..
2019-01-27 00:51:57 +01:00
Behdad Esfahbod 778c96b8d7 [iter] Fix hb_iter() 2019-01-27 00:50:54 +01:00
Behdad Esfahbod 2f5b1a9104 [iter] Add unary operator+ that returns a copy 2019-01-27 00:49:37 +01:00
Behdad Esfahbod fbab07f9b3 [iter] Add hb_bool() and make hb_filter default to it for predicate 2019-01-27 00:44:45 +01:00
Behdad Esfahbod 313d63e240 [meta] Back to using _ft suffix for function-object types
Seprate namespace, cleaner, more clear.
2019-01-26 22:58:26 +01:00
Behdad Esfahbod 2aff6d9625 [iter] Test that default-constructed iterators are empty 2019-01-26 22:54:25 +01:00
Behdad Esfahbod f35e7eabf1 pragma GCC diagnostic error "-Winjected-class-name"
See 6b6783e158
2019-01-26 22:50:00 +01:00
Behdad Esfahbod 509353357c [iter] Use hb_declval() instead of Null() to get instance
I had used Null to make one of the bots happy before.  Not going
to bend to such demands anymore..
2019-01-26 22:47:35 +01:00
Behdad Esfahbod 6b6783e158 [iter/meta] Fix build on newer clang
The mystery failure had to do with SFINAE failure because the template
function involved was accessing ::iter_t of a type that was also named iter_t.
In this context, apparently:

warning: ISO C++ specifies that qualified reference to 'iter_t' is a
constructor name rather than a type in this context, despite preceding 'typename' keyword
[-Winjected-class-name]

We use a new macro, also called hb_iter_t(), to get iterator type of
a type.  This uses declval/hb_decltype, and has the added benefit
that it returns correct type for const vs non-const objects, if they
have different iterators.
2019-01-26 22:44:09 +01:00
Behdad Esfahbod 5adb113baf [meta] Mark function-objects as const 2019-01-26 22:15:59 +01:00
Behdad Esfahbod ac90f17c55 Merge branch 'master' into iter 2019-01-26 14:05:39 +01:00
Behdad Esfahbod 60022ecced Fix -Wcast-function-type warnings in util/ with gcc 4.8 2019-01-26 14:04:51 +01:00
Behdad Esfahbod f398097529 More static constexpr 2019-01-25 16:08:25 +01:00
Behdad Esfahbod 090fe56dc6 Merge branch 'master' into iter 2019-01-25 16:06:52 +01:00
Michiharu Ariza c685644386 Merge branch 'master' into cff-more-arrayof-fixes 2019-01-24 13:19:18 -08:00
Behdad Esfahbod e970de48bc [AAT] Minor sign 2019-01-24 18:16:17 +01:00
Behdad Esfahbod a371a28cda [AAT] Use a ring buffer for ligature stack
I think Apple does very similarly, but probably with a stack size of 16.
We do it with a stack size that is currently set to 64.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1531
2019-01-24 18:12:25 +01:00
Behdad Esfahbod 7886b1578f Whitespace 2019-01-24 18:06:17 +01:00
Behdad Esfahbod b976940243 [AAT] Handle transition errors during machine operation
Before we used to give up.  Now, just ignore error and continue processing.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1531
2019-01-24 18:01:07 +01:00
Michiharu Ariza 0bd0a3311c Merge branch 'master' into cff-more-arrayof-fixes 2019-01-24 08:53:28 -08:00
Behdad Esfahbod e234bb6a42 [AAT] Ignore machine errors and continue 2019-01-24 17:23:11 +01:00
Behdad Esfahbod 1ec90514f6 [AAT] Minor 2019-01-24 17:21:41 +01:00
Behdad Esfahbod 299eca0c3b [AAT] Handle out-of-bounds classes 2019-01-24 17:17:00 +01:00
Behdad Esfahbod c4623db4a3 [AAT] Minor 2019-01-24 17:10:12 +01:00
Behdad Esfahbod c4e36f97b6 [AAT] Minor 2019-01-24 17:06:16 +01:00
Behdad Esfahbod f60282c5bf More pragma control
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=924848
2019-01-24 16:29:09 +01:00
Behdad Esfahbod fd0889f903 Comment 2019-01-24 16:12:52 +01:00
Behdad Esfahbod 9f31417733 Form cluster for Emoji sub-region tag sequences
Fixes https://github.com/harfbuzz/harfbuzz/issues/1556
2019-01-24 16:08:33 +01:00
Behdad Esfahbod 3ecda71041 Adjust mark offsets when zeroing from fallback mark positioning code
Adjust tests.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1532
2019-01-24 12:28:24 +01:00
Michiharu Ariza 12cd3171ba Merge branch 'master' into cff-more-arrayof-fixes 2019-01-23 14:05:42 -08:00
Michiharu Ariza 261a742181 more rewriting with ArrayOf<>
CFF1 Encoding0, Encoding1, CFF1SuppEncData
2019-01-23 14:04:29 -08:00
Behdad Esfahbod 36fb2b4da9 [AAT] In InsertionChain, set mark to previous-position if inserting
Fixes MORX-31
2019-01-23 20:53:57 +01:00
Behdad Esfahbod baf4d6a68a [AAT] Remove mark_set from InsertionChain 2019-01-23 20:36:07 +01:00
Behdad Esfahbod 0b2fa342de More of previous 2019-01-22 16:36:00 +01:00
Behdad Esfahbod a5e5dd8b42 Fix sign-compare error resulted from promoting unsigned integers to signed larger ints
Clang and gcc know not to warn in these cases, but not nonmainstream compilers
2019-01-22 16:30:07 +01:00
Behdad Esfahbod 32379bbf10 Cast HB_UNTAG results to uint8_t 2019-01-22 12:55:29 +01:00
Behdad Esfahbod 83d4aa5ca9 More -Wcast-error fix 2019-01-22 12:52:23 +01:00
Behdad Esfahbod 447323b85a Better fix for -Wcast-align errors 2019-01-22 12:50:12 +01:00
Behdad Esfahbod 81ec543d80 More -Wcast-error fixes 2019-01-22 12:43:12 +01:00
Behdad Esfahbod 9077272549 pragma GCC diagnostic error "-Wsign-compare" 2019-01-22 12:40:18 +01:00
Behdad Esfahbod 8d05bf7dc0 Fix cast-align error
If compiler doesn't inline StructAtOffset, this was an error since we
only disable cast-align at call-site.  So, move the cast out.

../src/hb-machinery.hh: In instantiation of 'const Type& StructAtOffset(const void*, unsigned int) [with Type = unsigned int]':
../src/hb-font.cc:146: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:147: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); }
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-22 12:34:05 +01:00
Behdad Esfahbod 70a52d6bd8 Convert all other enum class consts to static constexpr
Fixes https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod 5d4b0377b9 Convert unsigned enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod ef00654962 Convert tag enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod 39e1b6d03f Convert boolean enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod 271cb7c1c0 Make some enum constants unsigned 2019-01-22 12:17:26 +01:00
Behdad Esfahbod 3d9a6e6266 Whitespace 2019-01-22 12:17:26 +01:00
Behdad Esfahbod c81f02fd06 pragma GCC diagnostic error "-Wvla" 2019-01-22 12:17:26 +01:00
Behdad Esfahbod 380c3cffb9 Use enum for class constant 2019-01-22 10:51:20 +01:00
Behdad Esfahbod 6d042a18e7 [CFF] Use enum for tableTag 2019-01-22 10:51:20 +01:00
Behdad Esfahbod c1cbbb9459 Use static constexpr for large class constants 2019-01-22 10:51:20 +01:00
Behdad Esfahbod 21c0713a1c Whitespace 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 934d3fa2a7 Use more iter pipelines 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 420d8ac350 [algs] Add hb_iter()
Makes it nicer in pipelines.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 54ec48ea20 Use iter pipelines more 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 83cecd80d9 [iter] Default projection to identity 2019-01-20 20:12:12 -05:00
Behdad Esfahbod a699c6b17c [algs] Add hb_identity 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 463cfb426f Fix unused-variable warnings
inline variables are not C++11, so mark them unused...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod f4cbb1ee0c WIP 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 471e96e55d [iter] Use forwarding references 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 528ea66f24 [algs] Fix hb_first() / hb_second() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 343f5a4bfc [iter] Misc fixes to get piping almost work 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 7cedf7f64c Change hb_first() and hb_second() to function objects 2019-01-20 20:12:12 -05:00
Behdad Esfahbod f35568d603 [iter] Add hb_filter()
Untested.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 1733e4702c [iter] Add hb_map()
Untested.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod f7fcc47641 [iter] Make hb_zip() take const references 2019-01-20 20:12:12 -05:00
Behdad Esfahbod ede1a71b31 Minor rename 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 93551669c5 Remove unused Coverage::iter_t::get_coverage() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod af2067e87b Use hb_zip() moooore 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 0d1fdf939d Use hb_zip() some mooore 2019-01-20 20:12:12 -05:00
Behdad Esfahbod af6c190235 Use hb_zip() some moore 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 83ad0b6d0f Use hb_zip() some more 2019-01-20 20:12:12 -05:00
Behdad Esfahbod f0dd0656b8 Use hb_zip() some 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 200cdb721b [iter] Rename hb_zip_t to hb_zip_iter_t 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 3290c181c1 [algs] Whitespace 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 014c50292b [iter] Move code 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6e3ad650d1 Rename hb-dsalgs to hb-algs 2019-01-20 20:12:12 -05:00
Behdad Esfahbod f27607580e [algs] Add hb_first() and hb_second() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod a7de144df3 Implement uniform map interface
Coverage, ClassDef, hb_set_t, and hb_map_t implement.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 7987095e64 [meta] Remove hb_enable_if_t
It was only used for C++<11 which does not allow default parameters
in function templates.  Looks like we cannot support <11 anyway, so,
start cleaning up.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 15a6928436 [iter] Implement operator-> unconditionally
The right condition to check for would have been "is_struct", which
we don't have.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8f52a827e7 Allow rvalues in hb_addressof() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod a4ea0d3680 [iter] Change from const_iter_t/iter_t to iter_t/writer_t 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 7798e4fcc3 [iter] Change Coverage iterator to only return glyph-id 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 84e5d00229 [iter] Add hb_zip() 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 636786ecaf [iter] Rename __item_type__ to __item_t__ 2019-01-20 20:12:12 -05:00
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