Commit Graph

9396 Commits

Author SHA1 Message Date
Behdad Esfahbod a5b8e7db4d [hangul] Improve error handling
I did a review; changed some "return"s to "break"s, which should be identical.
Removed one check just before "continue" because not necessary.
The added error check is the actual fix.

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31755
2021-03-15 12:46:58 -06:00
Behdad Esfahbod 99767f9386 [hangul] Whitespace 2021-03-15 12:36:59 -06:00
Behdad Esfahbod 3622120fab [subset] Make ClassDef format2 .intersects() return false if range value 0
We treat Class0 as "doesn't intersect".  That's the only meaningful
interpretation. If one allos Class0 to mean "intersects", then the
intersects() result should be true iff glyphset is non-empty.

Related to https://github.com/harfbuzz/harfbuzz/issues/2703
2021-03-10 12:21:43 -07:00
David Corbett e19de65eae
Update hb-ot-tag-table.hh (#2890) 2021-03-08 10:12:47 -08:00
Khaled Hosny 7686ff854b
[ot] Keep substituted Default_Ignorables (#2886)
Don’t replace Default_Ignorables with zero-width space if they are
substituted or multiplied, not just when ligated.

After this change, HarfBuzz output matches that of Uniscribe and
CoreText for the new tests.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2883
2021-03-04 13:09:32 -08:00
Behdad Esfahbod 5efa04c890 [Makefile] Rebuild .def files if config changed
I was getting check-symbols failure because my previous build was
without CoreText, and after reconfiguring with CoreText, the old
harfbuzz.defs file was not being regenerated.
2021-03-02 16:30:13 -07:00
Behdad Esfahbod d351bbf0fb [Makefile] Remove unused variable HBNODISTHEADERS
Not sure what it was used for before.
2021-03-02 16:30:13 -07:00
Behdad Esfahbod fd489433a8 [indic] Fix cluster-merging logic with cluster-level=1
Was producing non-monotonic cluster numbers because our faulty logic
was not merging clusters if something from before base and after base
had switched positions.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2272
2021-03-02 16:30:09 -07:00
Behdad Esfahbod 2902529b92 [subset] Fix HB_TINY build
Fixes https://github.com/harfbuzz/harfbuzzjs/issues/34#issuecomment-789247723
2021-03-02 15:05:39 -07:00
Behdad Esfahbod 7cb22ba7eb
Include C headers with their C++ names (#2882)
Remove unnecessary includes.

Fixes build with some known broken SDKs (Nintendo Switch?)

https://en.cppreference.com/w/cpp/header

Fixes https://github.com/harfbuzz/harfbuzz/pull/2881
2021-03-01 11:44:06 -08:00
Behdad Esfahbod 486da35cc0 m Add comments to IntType cast out operator
Okay, bots seem to be happy. Merging.
2021-02-23 13:58:35 -07:00
Behdad Esfahbod 83b66bfb66 Another try to fix narrowing error
../src/hb-ot-layout-gsubgpos.hh: In instantiation of ‘void OT::ChainRule::serialize_array(hb_serialize_context_t*, OT::HBUINT16, Iterator) const [with Iterator = hb_map_iter_t<hb_array_t<const OT::IntType<short unsigned int> >, const hb_map_t*&, (hb_function_sortedness_t)0, 0>; typename hb_enable_if<hb_is_iterator_of<Lhs, typename Lhs::item_t>::value>::type* <anonymous> = 0; OT::HBUINT16 = OT::IntType<short unsigned int>]’:
../src/hb-ot-layout-gsubgpos.hh:2341:30:   required from here
../src/hb-ot-layout-gsubgpos.hh:2326:15: error: narrowing conversion of ‘(unsigned int)g’ from ‘unsigned int’ to ‘short unsigned int’ inside { } [-Werror=narrowing]
       c->copy (HBUINT16 {g});
       ~~~~~~~~^~~~~~~~~~~~~~

https://github.com/harfbuzz/harfbuzz/pull/2875
2021-02-23 13:04:38 -07:00
Behdad Esfahbod 6c4bb60829 Fix narrowing errors with recent changes 2021-02-22 23:05:55 -07:00
Behdad Esfahbod d6bd00a488 Revert back IntType out cast to signed/unsigned
Previous commit didn't fix the bots. Putting it back now that I
understand why I initially did the "Wide" casts.  But only doing
it for out-cast this time.  This causes "narrowing" warnings
whenever we are converting signed/unsigned to smaller HBUINT16
etc.  But those are valuable warnings.  We should address those
separately instead of ignoring.

Maybe we should start using uint16_t more liberally in the
internal subsetter function signatures then.
2021-02-22 22:42:50 -07:00
Behdad Esfahbod 0983601399 Add back wider cast to IntType
My local clang12 is fine, but many bots are not:

../src/hb-ot-cff1-table.hh: In instantiation of ‘bool CFF::Charset1_2<TYPE>::sanitize(hb_sanitize_context_t*, unsigned int) const [with TYPE = OT::IntType<unsigned char>]’:
../src/hb-ot-cff1-table.hh:554:13:   required from here
../src/hb-ot-cff1-table.hh:377:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
       if (unlikely (!ranges[i].sanitize (c) || (num_glyphs < ranges[i].nLeft + 1)))
                                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Enabling the extra cast operator mentioned in previous commit to see if
that fixes this case.

Again, I'd be happy to say "use 1u instead of 1" if this was universally
erred on.  But since some compilers happily compile this while others
err, it would be a huge headache. Let's see...

https://github.com/harfbuzz/harfbuzz/pull/2875
2021-02-22 22:33:17 -07:00
Behdad Esfahbod 567cedcc5f Narrow down cast operators on IntType
Say for USHORT, we were implementing casts from and to unsigned.
With this change, we cast from and to uint16_t only.  This allows
compiler more opportunities to catch possible narrowing issues in
the code.

It needed a couple of fixes in the codebase though, because
previously, if a USHORT was participating in arithmetic with signed
numbers, eg. "u + 1", the result would have been unsigned.  With
this change, it would be signed.  The correct fix is to update the
code to read "u + 1u".

That said, I think about conditionally adding back the cast
out to signed/unsigned, to facilitate better type deduction.
But I couldn't think of a real situation where that would help
with anything.  So I didn't add.  Here's what it was:

  template <typename Type2 = hb_conditional<hb_is_signed (Type), signed, unsigned>,
           hb_enable_if (sizeof (Type) < sizeof (Type2))>
  operator hb_type_identity_t<Type2> () const { return v; }

https://github.com/harfbuzz/harfbuzz/pull/2875
2021-02-22 22:32:42 -07:00
Behdad Esfahbod f4f35a4d5f [constexpr] Use initializer instead of assignment 2021-02-22 22:32:42 -07:00
Behdad Esfahbod cc16b26ef4 [constexpr] IntType
See https://github.com/harfbuzz/harfbuzz/pull/2875
2021-02-22 21:59:56 -07:00
Behdad Esfahbod 8b2f9adf29 m Simplify Tag operator char* 2021-02-22 17:42:24 -07:00
Behdad Esfahbod 021a1725ed
Merge pull request #2874 from harfbuzz/constexpr2
Some more cleanup towards using constexpr to simplify our internal datastrcutures.

https://github.com/harfbuzz/harfbuzz/pull/2874
2021-02-22 17:40:22 -07:00
Behdad Esfahbod b368a0736b [atomic] Remove IBM/AIX implementation
The C++11 implementation shall be enough for everyone.
2021-02-22 17:24:09 -07:00
Behdad Esfahbod 52f9126960 [atomic] Remove Windows implementation
Since we require C++11 now, there's no point to do a macro version check.
Which means we don't hit the MSVC issue defining __cplusplus wrongly.
2021-02-22 17:22:09 -07:00
Behdad Esfahbod a666fe64a9 [atomic] Comment 2021-02-22 17:21:27 -07:00
Behdad Esfahbod 3528a21e8d [atomic] Remove Apple implementation
Continuation of https://github.com/harfbuzz/harfbuzz/pull/676
2021-02-22 17:19:43 -07:00
Behdad Esfahbod 140797d4a2 [constexpr] hb_atomic_int_t 2021-02-22 17:19:26 -07:00
Behdad Esfahbod 2ec802b42a [object] Simplify reference_count_t 2021-02-22 17:18:47 -07:00
Behdad Esfahbod 12a283d513 m[ft] No need to use atomic ops for cached_x_scale
We have added a mutex since, so no need for atomicity.
2021-02-22 12:51:09 -07:00
Behdad Esfahbod a3c35aee30 m Move HB_SCRIPT_MYANMAR_ZAWGYI 2021-02-20 15:45:34 -07:00
Behdad Esfahbod c55bf55154 Remove HB_CONST_FUNC and HB_PURE_FUNC
They are not necessary for inline functions.
2021-02-20 15:45:12 -07:00
Behdad Esfahbod cba9893ac5 m[algs] Move roundf() here 2021-02-20 15:44:47 -07:00
Behdad Esfahbod f0947717ff m[machinery] Move HB_VAR_ARRAY here 2021-02-20 15:44:25 -07:00
Behdad Esfahbod 69464e9da0 [algs] Another try at fixing BEInt constexpr
../src/hb-algs.hh:120:3: error: body of constexpr function ‘constexpr BEInt<Type, 2>::operator Type() const [with Type = short unsigned int]’ not a return-statement
2021-02-20 15:42:44 -07:00
Behdad Esfahbod ff7bf88192 m[algs] Fix BEInt -Wnarrowing errors 2021-02-20 15:39:29 -07:00
Behdad Esfahbod a89d9f25b4 m Err on -Wnarrowing instead of -Wc++11-narrowing
On clang, -Wnarrowing is synonym for -Wc++11-narrowing.
On gcc it isn't. So, use the widely-available one
2021-02-20 15:38:05 -07:00
Behdad Esfahbod e208f80449 Make constexpr BEInt<Type, 2>::operator Type() C++11-compatible
Multiple return values not permitted until C++14
2021-02-20 15:31:43 -07:00
Behdad Esfahbod c2fc2aa44c [atomic] Remove Solaris intrinsics 2021-02-20 15:20:33 -07:00
Behdad Esfahbod 7099a6dca1 [atomic] Remove old Intel primitives implementation 2021-02-20 15:20:06 -07:00
Behdad Esfahbod 711c241f6c m[mutex] Remove busyloop mutex implemenation
Don't know why I ever added this. :)
2021-02-20 15:16:59 -07:00
Behdad Esfahbod 47f01c0726 m[algs] Move BEInt here 2021-02-20 15:14:50 -07:00
Behdad Esfahbod e5b7bc424d m Add default value to BEInt<> Size template parameter 2021-02-20 15:14:15 -07:00
Behdad Esfahbod 2caae4a59a m Move class traits 2021-02-20 15:13:52 -07:00
Behdad Esfahbod c2dbd6cc0f Remove static_assert of sizeof basic sized int types 2021-02-20 15:11:47 -07:00
Behdad Esfahbod e1706ffecd m [algs] Move flags here 2021-02-20 15:11:26 -07:00
Behdad Esfahbod 017f6b0d24 m Move static_assert_expr<> 2021-02-20 15:11:14 -07:00
Behdad Esfahbod 61f8d0e57d m Rename ASSERT_STATIC_EXPR_ZERO to static_assert_expr 2021-02-20 15:08:19 -07:00
Behdad Esfahbod 59cfffb1af m Change ASSERT_STATIC_EXPR_ZERO template arg type to bool 2021-02-20 15:07:28 -07:00
Behdad Esfahbod 1981d83d7f [constexpr] HB_MARK_AS_FLAG_T 2021-02-20 15:07:14 -07:00
Behdad Esfahbod a4a99de0eb [constexpr] bswap 2021-02-20 15:07:07 -07:00
Behdad Esfahbod f8ebe1dacd [constexpr] BEInt 2021-02-20 15:06:12 -07:00
Behdad Esfahbod 2fbd34f89a m[set/map] Add operator bool()
Probably should use in places..
2021-02-19 18:40:48 -07:00
Behdad Esfahbod bf75a0a03a m[dispatch] Use inline class member initialization
Let's see how bots like this...
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 82928d9cf6 m[blob] Move immutable check to C API boundary
Similarly to 08ed9e3f77
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 4020c6b286 m[blob] An empty blob can always be made writable 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 2d39031f7b [buffer/set/map] Move immutable check only to C API boundary
The immutable objects are a concept only enforced by the C API.
So move checks only to that region.

This does assume that the rest of the code is careful not getting
into these internal methods on immutable objects, which something
we do, but have no way of enforcing (currently).

.
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 6d83d44052 m[set] Recover set from error in .reset() 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 445efe8d04 m[vector] Recover vector from error in .reset() 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 21433fa563 m[buffer] In hb_buffer_append() don't change until allocation success 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 0f61a6213a m[vowels] Simplify
If we didn't "process" anything, swap_buffers() becomes a no-op.
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 3b91e0b592 m[buffer] Rename internal variable 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 9fcba109bf [buffer] Make swap_buffers() copy rest 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 86993c09a1 Ignore -Wrange-loop-analysis
Fixes https://github.com/harfbuzz/harfbuzz/issues/2834
2021-02-19 17:10:06 -07:00
Behdad Esfahbod 6d94194497 Use auto in range-for-loop more 2021-02-19 17:10:06 -07:00
justvanrossum 79e4f436e7 Apply rounding correctly when calculating glyph extents for CFF and CFF2; adjust expected test results 2021-02-19 16:53:21 -07:00
justvanrossum d01ebeae21 calculate extents based on scaled then rounded values; undo two of the earlier test result adjustments 2021-02-19 16:53:21 -07:00
justvanrossum 1d8a89504b do not round added deltas; fixes #2866 2021-02-19 16:53:21 -07:00
Behdad Esfahbod 103ed7da83 [subset] Use dagger
Better fix for https://github.com/harfbuzz/harfbuzz/pull/2858
2021-02-19 16:48:30 -07:00
Behdad Esfahbod d8ea552d10 [aat] Improve unsafe-to-break logic
Reduces false-positives.  See comments for new logic.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2860

Adjusts run-tests.sh to allow unhashed absolute filenames.
2021-02-19 16:23:22 -07:00
Behdad Esfahbod cf203936d7 [aat] Unbreak builds
Some compilers don't like this:

../src/hb-aat-layout-common.hh:732:9: error: declaration of 'using StateTable = struct AAT::StateTable<Types, EntryData>' changes meaning of 'StateTable' [-fpermissive]
732 |   using StateTable = StateTable<Types, EntryData>;
2021-02-18 12:03:26 -07:00
Behdad Esfahbod b6fdaa6948 [minor:aat] Use injected class name 2021-02-18 11:16:37 -07:00
Behdad Esfahbod e27420bb18 [minor:aat] Simplify template reference 2021-02-18 11:15:46 -07:00
Behdad Esfahbod 7b8a8adb7d [aat] Fix unsafe-to-break marking when end-of-text action kicks in
The state we are dealing with here is the previous state; so it should
cause unsafe_to_break before current glyph.

I'm surprised this wasn't caught by any tests. Guess we don't have any
fonts with fancy end-of-text forms.
2021-02-18 09:47:24 -07:00
Behdad Esfahbod aa80c7c8b4 [aat] Add buffer->successful check before buffer->next_glyph() 2021-02-18 09:31:46 -07:00
Behdad Esfahbod bcd10bf274 [normalize] Add buffer success check before ->next_glyph()
Speculative fix for:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27843
2021-02-17 13:58:56 -07:00
Behdad Esfahbod 505b3fc6cf [harfbuzz.cc] Fix OffsetTable name clash with Mac headers
There's no easy way to undo a "using namespace" in our sources, so by the time
we get to include hb-coretext.cc from harfbuzz.cc, we already have "using namespace OT"
active, which clashes with Mac headers.

Error was:
$ gcc -O3 -Wall -arch i386 -DHAVE_CORETEXT=1 -c harfbuzz.cc -o harfbuzz.o -std=c++11
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/TextUtils.h:288:3: error:
      reference to 'OffsetTable' is ambiguous
  OffsetTable     offsets,
  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h:115:41: note:
      candidate found by name lookup is 'OffsetTable'
typedef OffPair                         OffsetTable[3];
                                        ^
./hb-open-file.hh:81:16: note: candidate found by name lookup is 'OT::OffsetTable'
typedef struct OffsetTable
               ^
1 error generated.
2021-02-17 11:34:47 -07:00
Behdad Esfahbod 6a9f576fd4 [coretext] Silence CoreText deprecation warning
As suggested by Ned, just ignoring it.

warning: 'CTGetCoreTextVersion' is deprecated: first deprecated in macOS 11.0 - Use
      -[NSProcessInfo operatingSystemVersion] [-Wdeprecated-declarations]
2021-02-17 11:31:32 -07:00
Behdad Esfahbod 8e53c7c125 [coretext] Fix more CGFloat double-promotion warnings
The warning is:
warning: implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to
      'double' [-Wdouble-promotion]
2021-02-17 11:12:56 -07:00
Garret Rieger 5ca353a2d0 [subset] fix heap buffer overflow found by fuzzer. 2021-02-16 12:43:02 -07:00
David Corbett 751ed68fee [indic] Fix shaping of U+0B55 ORIYA SIGN OVERLINE
Fixes https://github.com/harfbuzz/harfbuzz/issues/2849
2021-02-14 12:47:34 -05:00
Behdad Esfahbod 7a60f4e3a4 [subset] Remove debug burden
Fixes https://github.com/harfbuzz/harfbuzz/issues/2360
2021-02-12 14:14:17 -07:00
Garret Rieger 08a4997fde [subset] Add subset support for Extension lookups (GPOS 9, GSUB 7). 2021-02-11 13:41:31 -07:00
Behdad Esfahbod bbbea3dbd8 [minor] Rewrite set operation in OS/2 subsetting
This patch could be nicer:
https://github.com/harfbuzz/harfbuzz/pull/2572/files

Just tiny touchup now.
2021-02-11 12:23:33 -07:00
Behdad Esfahbod cdb9197b41 [khmer] Remove more unused code
Prodded by https://github.com/harfbuzz/harfbuzz/pull/2583

These are leftovers from when we forked Khmer shaper from the Indic shaper.
2021-02-11 11:33:47 -07:00
Behdad Esfahbod dfa9d7acdc [minor] Use serializer->propagate_error() to simplify code 2021-02-11 11:19:51 -07:00
Behdad Esfahbod 5faae8260a [post] Remove unneeded error check 2021-02-11 10:58:02 -07:00
Behdad Esfahbod d7e2a51de2 [minor] Add unlikely() when checking for error 2021-02-11 10:55:03 -07:00
Behdad Esfahbod c7d232ce4e
Merge pull request #2701 from googlefonts/Mark-To-Ligature_grieger
[subset] GPOS 5 MarkToLigature subsetting support
2021-02-10 18:13:38 -07:00
Khaled Hosny 7b9e23f28b [introspection] Fix g-ir-scanner syntax errors
Fixes https://github.com/harfbuzz/harfbuzz/issues/2851
2021-02-10 23:37:43 +02:00
Behdad Esfahbod 1da75afbe8 [minor] Add unlikely() 2021-02-10 00:03:41 -07:00
Behdad Esfahbod 6e1afac64b [minor] Rename internal variable
To address review comment:
https://github.com/harfbuzz/harfbuzz/pull/2699#discussion_r573370781
2021-02-09 18:48:46 -07:00
Behdad Esfahbod 836814a571 [array] Swap order of args to hb_equal()
Prioritizes Key::cmp() over table's cmp.
2021-02-09 18:48:05 -07:00
Behdad Esfahbod 98374cebe1 Conditionalize IntType::cmp() so it never fails to compile
Useful with lfind() since that calls hb_equal() which SFINAEs which
cmp() to use.
2021-02-09 18:48:05 -07:00
Behdad Esfahbod ed04174a64 Whitespace 2021-02-09 18:48:05 -07:00
Behdad Esfahbod 6a3fd94f3b
Merge pull request #2699 from googlefonts/gpos_8
[subset] Add a more complex layout subsetting test case and fix the issues it exposed.
2021-02-09 20:49:04 -05:00
Garret Rieger 8f47dd5779 [subset] don't set lookup visited in closure_lookups_context_t::recurse.
- Lookup::closure_lookups also checks if the lookups visited and sets the lookup to visited. If we set visited in 'recurse' then Lookup::closure_lookups will fail to recurse into the children of the lookup.
- Also when copying ChainRule's skip LookupRecord's that point to lookups which aren't retained. This matches FontTool's behaviour.
2021-02-09 20:34:52 -05:00
josephshen d9e0244cdf remove duplicate file names 2021-02-02 09:23:41 -08:00
Behdad Esfahbod dad41c07e4 [use] Typo 2021-02-01 11:30:39 -08:00
Behdad Esfahbod 63a716c540 [indic] Use lfind() 2021-02-01 11:30:39 -08:00
Behdad Esfahbod 921b4e46b0 [algs] Add hb_equal()
Use in hb_array_t::lfind()
2021-02-01 11:30:39 -08:00
Behdad Esfahbod f4ed3bf20b [indic] Remove categorization of Khmer Ra
Khmer goes through its own shaper these days.
2021-02-01 11:30:39 -08:00
Behdad Esfahbod 676d1e6adf [indic] Spell out INDIC_TABLE_ELEMENT_TYPE 2021-02-01 11:30:39 -08:00
Behdad Esfahbod 769c2b19a3 [indic/khmer/myanmar/use] Minor shuffling of found_syllable() macros 2021-02-01 11:30:39 -08:00
Behdad Esfahbod 59721c2f37 [use] Move data table into same compilation unit 2021-02-01 11:30:39 -08:00
Behdad Esfahbod d9b167da3d [use] Remove hb-ot-shape-complex-use.hh
Inline into ragel machine.
2021-02-01 11:30:39 -08:00
Behdad Esfahbod 3bb2653a5e [use] Reuse category numbers exported from ragel machine
Part of https://github.com/harfbuzz/harfbuzz/pull/2726
2021-02-01 11:30:39 -08:00
Behdad Esfahbod c417e0d2f9 [indic/khmer/myanmar/use] Move enum category around
Such that the generated -machine.hh headers are independent.
2021-02-01 11:30:39 -08:00
Behdad Esfahbod 675b6c2994 [indic/khmer/myanmar/use] Remove unused dump-*-data programs
In prep for streamlining tables.
2021-02-01 11:30:39 -08:00
Behdad Esfahbod 0a5c631140 [use] Rename internal enum joinint_form_t members
To ease upcoming change.
2021-02-01 11:30:39 -08:00
Behdad Esfahbod 880fdb7460 [indic/khmer/myanmar/use] Export categories from Ragel source
Not hooked up yet.

Part of alternative approach to
https://github.com/harfbuzz/harfbuzz/pull/2726
2021-02-01 11:30:39 -08:00
ckitagawa b198d94489 use {} rather than {0} 2021-01-25 14:07:52 -08:00
ckitagawa 2e50b517e1 Nicer more idiomatic fix 2021-01-25 14:07:52 -08:00
ckitagawa 8f6559a373 [subet/COLR] Default initialize firstLayerIdx 2021-01-25 14:07:52 -08:00
Behdad Esfahbod a650243d39 [sanitize] Fix typo 2021-01-24 13:30:06 -07:00
Behdad Esfahbod 881ad720fe [algs] Remove passthru declaration
Let compiler figure it out.
2021-01-21 14:27:45 -07:00
Behdad Esfahbod ca0b7afee9 [set] Use hb_fill() 2021-01-21 12:22:00 -07:00
Behdad Esfahbod 5fce8898e0 [iter] Allow passing rvalue iters to hb_fill() 2021-01-21 12:15:10 -07:00
Behdad Esfahbod 6463ee02d6 Speed up ClassDef/Coverage intersect methods
Just avoiding overhead as measured by Garret.
Should rewrite as dagger in the future and confirm that it has the
same benefits. Later on, rewrite as lfind() maybe.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2826
2021-01-21 11:16:04 -08:00
Garret Rieger 33368a12b7 uint32_t to unsigned in hb-set.hh 2021-01-21 12:12:05 -07:00
Garret Rieger 2a0d0b901f Make set clear work even when set is in failed state. 2021-01-21 12:12:05 -07:00
Garret Rieger 0ba73e980c [ENOMEM] handle allocation failures during page compaction. 2021-01-21 12:12:05 -07:00
Garret Rieger a4c3732f59 [ENOMEM] fix set clear() causing corruption if the set is in_error(). 2021-01-21 12:12:05 -07:00
Khaled Hosny 9b8be9643c [docs] Ignore hb-gobject headers
Fixes https://github.com/harfbuzz/harfbuzz/issues/2797
2021-01-20 14:23:37 -08:00
Khaled Hosny 051a3c7b9a [docs] Fix typo 2021-01-20 14:22:15 -08:00
Khaled Hosny a44dd339f9 [docs] Missing param docs 2021-01-20 14:22:15 -08:00
Khaled Hosny 478d169c0f [docs] Document more deprecated symbols 2021-01-20 14:22:15 -08:00
Khaled Hosny ca0a7a8384 [docs] Document hb_ot_math_constant_t somehow 2021-01-20 14:22:15 -08:00
Khaled Hosny 3ba1e7e783 [docs] Document HB_OT_TAG_DEFAULT_LANGUAGE/SCRIPT 2021-01-20 14:22:15 -08:00
Khaled Hosny 4bfa0b3c02 [docs] Fix hb_color_get_* docs 2021-01-20 14:22:15 -08:00
David Corbett 2cdc92c0c2 [use] Move most joining scripts to USE 2021-01-18 12:06:23 -08:00
Behdad Esfahbod 5c73c9082b [syllabic] Fix signed/unsigned comparision errors 2021-01-18 12:00:58 -08:00
Behdad Esfahbod e3d4c29727 [indic/khmer/myanmar] Minor: Fix mask
Seems like a typo. No behavior change.
2021-01-18 12:00:58 -08:00
Behdad Esfahbod 0ddade44cf [syllabic] Merge various insert_dotted_circles implementations
Fixes https://github.com/harfbuzz/harfbuzz/issues/1810
2021-01-18 12:00:58 -08:00
Behdad Esfahbod e8e9fd9556 [syllabic] Add hb-ot-shape-complex-syllabic.cc/hh
Empty for now.

Part of https://github.com/harfbuzz/harfbuzz/issues/1810
2021-01-18 12:00:58 -08:00
Behdad Esfahbod 8af85c4e86 Remove hb-ot-shape-complex-machine-index.hh file
Inline code into USE header.
2021-01-18 12:00:58 -08:00
Behdad Esfahbod 9dd61c5b78 Rename internal buffer var use
Part of https://github.com/harfbuzz/harfbuzz/issues/1810
2021-01-18 12:00:58 -08:00
Behdad Esfahbod 3c5b7886eb Revert "Avoid category duplication between C++ and Ragel"
This reverts commit 67ea8133d3.

Merged accidentally on https://github.com/harfbuzz/harfbuzz/pull/2726
2021-01-15 19:26:04 -07:00
David Corbett 67ea8133d3 Avoid category duplication between C++ and Ragel 2021-01-15 18:24:52 -08:00
David Corbett c8c5e52aba [use] Update overrides to 2021-01-04
This uses the data files from
<ed7b825ddb/USE>.
2021-01-06 05:45:01 +02:00
Khaled Hosny 1fb7f3bda6 [docs] Document various HB_SCRIPT_*
Need to have something for all of them to keep GTK-Doc happy.
2020-12-30 19:21:49 -08:00
Khaled Hosny ea0907abf9 [docs] Document version macros 2020-12-30 19:21:49 -08:00
Khaled Hosny 5e9f05ff3f [docs] Expand memory modes docs
Per Behdad suggestions.
2020-12-30 19:21:49 -08:00
Khaled Hosny 5151c2b668 [introspection] Replace deprecated allow-none
Use optional or nullable as appropriate.
2020-12-30 19:21:49 -08:00
Khaled Hosny a64d56a3e5 [introspection] nullable is for pointers 2020-12-30 19:21:49 -08:00
Khaled Hosny 9936490c04 [docs] Invalid use of "optional" annotation
It is valid only for out and inout parameters.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1787
2020-12-30 19:21:49 -08:00
Khaled Hosny bf5b4b71c5 [docs] Duplicated documentation 2020-12-30 19:21:49 -08:00
Khaled Hosny 3d7a361648 [docs] Miscellaneous missing docs 2020-12-30 19:21:49 -08:00
Khaled Hosny a31a51cdec [docs] Complete hb-ft docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 8c492d5c32 [docs] Complete hb-ot-math docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 3f7ffd1b3d [docs] Complete hb-unicode docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 2fdab788ad [docs] Complete hb-buffer docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 492a5a9096 [docs] Complete hb-aat docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 3a012cc469 [docs] Complete hb-metrics docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 5a55b31a38 [docs] Complete hb-shape-plan docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 8e8c3e5878 [docs] Complete hb-ot-layout docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 5b7b730d4b [docs] Complete hb-color docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny aa107e657b [docs] Complete hb-font docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny 9b602e8e22 [docs] Complete hb-common docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny c9c3b3c94c [docs] Use correct syntax 2020-12-30 23:28:26 +02:00
Khaled Hosny a8e72ee784 [docs] Use %true and %false consistently 2020-12-30 23:28:26 +02:00
Khaled Hosny a3fe43a410 [docs] Hide private enum values
"/*< skip >*/" does not seem to hide them.
2020-12-30 23:06:18 +02:00
Khaled Hosny e93de6362b [docs] Document unused language in get_baseline
Document that language_tag in hb_ot_layout_get_baseline() is currently
unused.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2662
2020-12-30 11:53:46 -08:00
Khaled Hosny c7b2e64c6d [docs] make it clear that FT_Face must have size
Fixes https://github.com/harfbuzz/harfbuzz/issues/2590
2020-12-30 11:50:49 -08:00
Khaled Hosny 7236c7e29c 2.7.4 2020-12-27 01:59:00 +02:00
Khaled Hosny 010bd54040
Merge pull request #2777 from harfbuzz/docs-unicode
[docs] Improve hb-unicode docs a bit
2020-12-26 01:17:27 +02:00
Khaled Hosny 22468c8a90 [docs] Give destroy callbacks have (optional) annotation 2020-12-24 22:38:06 +02:00
Khaled Hosny 35c4a15a67 [docs] Update hb-font documentation 2020-12-24 22:34:26 +02:00
Khaled Hosny 8586f15957 [docs] Update hb-common documentation 2020-12-24 22:23:47 +02:00
Khaled Hosny e8c21e003d [docs] Remove comments the duplicate docs 2020-12-24 21:56:31 +02:00
Khaled Hosny cb319f0d80 [docs] Add some missing annotations to hb-buffer.cc 2020-12-24 21:47:05 +02:00
Khaled Hosny 9af0edd951 [docs] Document return value of hb_blob_get_data() 2020-12-24 21:41:14 +02:00
Khaled Hosny f88e845fc7 [docs] Minor fixes 2020-12-24 21:34:14 +02:00
Nathan Willis 82092d4005 [docs] Update gtk-doc comments in hb-font 2020-12-24 21:34:14 +02:00
Nathan Willis e8de26e1ef [docs] Add gtkdoc comments to hb-buffer 2020-12-24 21:34:14 +02:00
Nathan Willis d13b7eaaf1 [docs] Add gtkdoc comments to hb-blob 2020-12-24 21:34:14 +02:00
Nathan Willis 4cdb12a3fa [docs] Add gtkdoc comments to hb-common 2020-12-24 21:34:14 +02:00
Nathan Willis 922c32eb2d [docs] Add gtkdoc comments to hb-map 2020-12-24 21:30:03 +02:00
Nathan Willis 71af2c6d9b [docs] Add gtkdoc comments to hb-set 2020-12-24 21:29:56 +02:00
Nathan Willis ec98730ff6 [docs] regularize whitespace in function params 2020-12-24 21:29:47 +02:00
Khaled Hosny fdf3e448fd [docs] Improve hb-unicode docs a bit
Down to only one warning.
2020-12-24 00:52:02 +02:00
Khaled Hosny 0fd6144a5f [docs] Fix warnings about unknown annotations
Use square brackets so that gtk-doc does not consider these to be
annotations.
2020-12-24 00:20:24 +02:00
Khaled Hosny 71a3b54f3c 2.7.3 2020-12-23 15:33:15 +02:00
Behdad Esfahbod 8560c3e355
Merge pull request #2774 from harfbuzz/misc-doc
Doc fixes
2020-12-23 00:25:10 -08:00
Ryan 769a21aab6 meson: avoid regenerating hb-version.h unnecessarily
The file is a dependency for the library as a whole, so previously editing the Meson build files at all would force a full rebuild. This will only rebuild it if the version has changed.
2020-12-23 00:22:06 -08:00
Khaled Hosny c2e2c40bac [docs] Fix gtk-doc comment syntax
The documentation was not picked otherwise.
2020-12-23 00:58:49 +02:00
Khaled Hosny 0826940821 [docs] Add messing sections
Docs for these sections were not generated at all.
2020-12-23 00:58:49 +02:00
Khaled Hosny b8b13018ed [docs] Make gtk-doc find these typedef’s 2020-12-23 00:58:43 +02:00
Khaled Hosny 8c3a530fd7 [docs] Some formatting fixes 2020-12-22 23:52:46 +02:00
Behdad Esfahbod 25c0a792e3 Remove unused+wrong UnsizedArrayOf<> operators
Said compiler is wrong to err since they are unused. But yeah, they
didn't make sense and were copy/paste leftover.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2763
2020-12-10 14:29:47 -07:00
Khaled Hosny 07e304b2a4
Merge pull request #2755 from Myaamori/master
meson: use meson.current_source_dir() instead of @CURRENT_SOURCE_DIR@
2020-12-01 22:32:19 +02:00
Behdad Esfahbod 7c241651ac [algs] Don't forward rvalue twice
Part of https://github.com/harfbuzz/harfbuzz/issues/2293
2020-11-30 16:38:53 -07:00
Behdad Esfahbod 53806e5b83 Tiny improvement on previous commit
Functionally the same.
2020-11-25 11:51:37 -07:00
Dominik Röttsches a5f6f869e8 Drop layout table if layout lookup accelerator allocation failed
If the table is kept, when the table is present but only the accelerator
allocation failed, then we run into nullptr dereferences downstream in
hb_ot_map_t::apply when trying to access proxy.accels[i].

To fix this, instead of only setting lookup_count of accelerator_t
itself, drop the whole table to avoid hb-ot-map construction assuming
that the lookups will work correctly despite accelerator allocation
having failed.

Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24490
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24490
2020-11-25 10:18:04 -08:00
Myaamori 5f32fdff11 meson: use meson.current_source_dir() instead of @CURRENT_SOURCE_DIR@
@CURRENT_SOURCE_DIR@ is not listed as a valid string substitution
for custom targets in the Meson reference, and in practice
it does not get substituted when using the vs2019 backend.
2020-11-24 01:29:24 +00:00
David Corbett b2e7bb2a7c Don’t map BCP 47 to coincidentally similar OT tag 2020-11-22 19:35:47 -08:00
David Corbett e1df2c5277 Map ISO 639 code qul to language system tag 'QUH ' 2020-11-22 11:52:23 -07:00
Khaled Hosny f579c66108 Mark variable unused
Hopefully fixes build with newer ragel.

https://github.com/adrian-thurston/ragel/issues/56

Fixes https://github.com/harfbuzz/harfbuzz/issues/2752
2020-11-21 08:41:06 -07:00
David Corbett f83496a910 [use] Remove workaround for reserved code points
See <https://github.com/microsoft/font-tools/issues/12>.
2020-11-20 15:37:37 -07:00
David Corbett 17da41bd06 Update language system tag registry to OT 1.8.4 2020-11-18 11:13:35 -08:00
Simon Cozens fd8f4ffcc6 Trace reorder, not normalize 2020-11-17 09:05:40 +00:00
Simon Cozens 2e0193d741 Add more cast spaces 2020-11-17 09:05:40 +00:00
Simon Cozens 4bb6d54e3b Missing cast 2020-11-17 09:05:40 +00:00
Simon Cozens 8e1bedc50b Keep phase names 2020-11-17 09:05:40 +00:00
Simon Cozens 428c111f13 Fix spacing around casts 2020-11-17 09:05:40 +00:00
Simon Cozens f19018da41 Smaller issues from review 2020-11-17 09:05:40 +00:00
Simon Cozens 8b3b835a0a Trace normalization and preprocessing stages 2020-11-17 09:05:40 +00:00
Simon Cozens b50099bff2 Trace reordering in pause functions 2020-11-17 09:05:40 +00:00
Fabrice Fontaine 0c3dcfae19 Merge remote-tracking branch 'upstream/master' 2020-11-17 07:31:07 +01:00
David Corbett 3bd43bd023 Map more ISO 15924 variants to `hb_script_t`s 2020-11-16 22:18:15 -08:00
David Corbett 27170e058d Fix names for language tag in gen-tag-table.py
A BCP 47 language tag with both a script subtag and a region subtag
would be printed as a human-readable name in hb-ot-tag-table.hh as if it
only had its language subtag.
2020-11-16 10:59:07 -08:00
David Corbett 49ebb9ebdd [use] Remove redundant O entries from the table 2020-10-17 22:07:34 +02:00
David Corbett 79fd5ce22e [use] Merge IND and Rsv classes into O 2020-10-17 22:07:34 +02:00
Behdad Esfahbod cde2cf84c0 [use] Minor clean-up of unused categories 2020-10-17 11:22:19 -04:00
David Corbett 0792690b73 [use] Skip WJ and ZWJ when clustering 2020-10-16 22:39:46 -07:00
Laurenz 3fcf466b7b [hb-shape-fallback] Use signed int for correction 2020-10-16 17:57:38 -07:00
Behdad Esfahbod 77e704d1db [buffer] Add assert_unicode()/assert_glyphs() and use internally 2020-10-15 02:02:04 -06:00
Behdad Esfahbod 5ef0613909 [buffer] Add ensure_glyphs()/ensure_unicode()
Use in deserialize. To be used more.
2020-10-15 01:54:28 -06:00
Behdad Esfahbod 3232e6f2a9 [buffer] Add hb_buffer_has_positions()
Fixes https://github.com/harfbuzz/harfbuzz/issues/2716
2020-10-15 00:20:17 -06:00
David Corbett dec52006d9 Map BCP 47 tags to all macrolanguages
The general rule is that if a BCP 47 macrolanguage maps to an OpenType
language system tag, all its individual languages map to it too.
Previously, a tag like "prs" (Dari) would not map to the language system
tag ('FAR ') of its macrolanguage ("fa") because "prs" already has its
own language system tag ('DRI '). That exception has been removed: now
"prs" maps to 'DRI ' and falls back to 'FAR '.
2020-10-11 11:38:40 -07:00
David Corbett 1d53268dfe Fix two-way mapping of "man" and 'MNK ' 2020-10-11 11:38:40 -07:00
David Corbett ab38cf6746 Map hy-arevmda to 'HYE ' instead of HYE0 2020-10-11 11:38:40 -07:00
David Corbett 916c5a9007 Consistently emit BCP 47 subtag scope suffixes 2020-10-11 11:38:40 -07:00
Behdad Esfahbod 1c05f6789b [buffer] Increase work limits
Our previous limits of 64 per input character was already hit
by David Corbett's under-development Duployan font.

Increase work limits by factor of 16, and number of glyphs by factor of 2.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2707
2020-10-11 12:28:25 -06:00
Behdad Esfahbod b37edebfcb [buffer/deserialize] Do not clear() buffer upon content type mismatch
We return false. I don't see reason to clear buffer.
2020-10-09 22:27:56 -06:00
Behdad Esfahbod c396e1600f [buffer/deserialize] Accept arbitrary glyph names
Accepts escapes. Added TODO items for matching escaping in serialize().
2020-10-09 22:27:56 -06:00
Behdad Esfahbod 4a4eebcf86 [buffer/serialize] Minor renames in Ragel machines
As per my previous review on:
https://github.com/harfbuzz/harfbuzz/pull/2687
2020-10-09 22:27:56 -06:00
Behdad Esfahbod 78fb6a11af Whitespace 2020-10-09 22:27:55 -06:00
Behdad Esfahbod 140552cec9 [buffer/serialize] Only serialize empty buffers of CONTENT_TYPE_INVALID 2020-10-09 22:27:55 -06:00
Behdad Esfahbod 8f5d8b155c [buffer] Buffer start <= end <= len requirement in (de-)serialize 2020-10-09 22:27:55 -06:00
Behdad Esfahbod 3b64122a7f [buffer] Fix immutable case with end_ptr==nullptr 2020-10-09 22:27:55 -06:00
Simon Cozens 7c0bc0bb92 Serialize invalid buffer to !! (text) or [] (json)
There is no generic deserialize - you have to choose glyphs or unicode - so there is no way to deserialize this buffer.
2020-10-09 22:27:55 -06:00
Simon Cozens 5bb88c4f45 Oops debug print 2020-10-09 22:27:55 -06:00
Simon Cozens f56eb402f0 Immutable buffer fix 2020-10-09 22:27:55 -06:00
Simon Cozens 150f391438 Prohibit mixed glyphs/unicode buffers in deserialization 2020-10-09 22:27:55 -06:00
Simon Cozens 6b1726b6ef Typos 2020-10-09 22:27:55 -06:00
Simon Cozens 3d3c87e7e7 Put the flags back in and serialize clusters.
Note that now JSON glyph buffers and Unicode buffers look very similar, except for the g/u property difference.
2020-10-09 22:27:55 -06:00
Simon Cozens c03a2001b2 Deserialization routines for Unicode buffers 2020-10-09 22:27:55 -06:00
Simon Cozens c0716bb5dc Move delimiter addition into hb-buffer-serialize 2020-10-09 22:27:55 -06:00
Simon Cozens 36ede56962 Fix docs
Note the delimiters stuff isn’t true yet, will be working on that
2020-10-09 22:27:55 -06:00
Simon Cozens bb7b634cd0 Simplify JSON unicode serialization
It’s just an array of codepoints; no need to turn them into objects
2020-10-09 22:27:55 -06:00
Simon Cozens 57a528ab2c Convert tabs to spaces 2020-10-09 22:27:55 -06:00
Simon Cozens aff6a36266 Use auxbuffer for serialize_unicode_text 2020-10-09 22:27:55 -06:00
Simon Cozens 58bcc1cedd Serialize Unicode buffers 2020-10-09 22:27:55 -06:00
David Corbett c39ab82c90 Fix usage text of gen-use-table.py 2020-10-06 16:51:40 -04:00
Garret Rieger aace09a3ad [subset] Use glyphset gsub for layout variation indices collection. 2020-10-06 10:26:17 -07:00
Garret Rieger 1d9801e012 [subset] In AnchorMatrix::subset eliminate the use of dynamically allocated vector. 2020-10-05 14:43:29 -07:00
Garret Rieger 093909b2ff [subset] Fix wrong offset base for subsetting LigatureArray.
Offsets from LigatureArray must be relative to the beginning of the LigatureArray table. For the serialization mechanism to use the correct beginning point the LigatureArray must be created using the push()/pop() mechanism. So convert LigatureArray subsetting to use serialize_subset() instead of a manually called serialize and subset.
2020-10-05 13:14:53 -07:00
Garret Rieger 147e93b910 [subset] Fixes to get GPOS 5 subsetting code compiling. 2020-10-01 16:45:57 -07:00
Qunxin Liu 3a0b05faf1 [subset] GPOS 5 MarkToLigature subsetting support 2020-10-01 15:59:16 -07:00
Garret Rieger 718bf5aab3 [subset] only keep features reachable from script in the final subset.
Matches fontTools behaviour.
2020-09-29 13:16:01 -07:00
Garret Rieger e583505334 [subset] Use plan->glyphset_gsub instead of plan->glyphset for GSUB/GPOS
This matches fontTools behaviour. glyphset_gsub does not contain gids added from closing over composite glyphs in glyf, since these cannot particpate in GSUB/GPOS processing.
2020-09-29 11:16:15 -07:00
David Corbett a99e8721bf [use] Fix tests with MSVC 2020-09-29 09:54:33 -04:00
Garret Rieger 940e1c6f98 [subset] ChainContextFormat3 - don't subset glyph sequences.
The backtrack, input, and lookahead sequence must be matched in their entirety so these sequences should not be subset. If any of the coverage tables in a sequence subsets to empty then the whole subtable should be dropped since it's not possible for this lookup to be activated.
2020-09-28 17:22:01 -07:00
Garret Rieger e31c2690f8 [subset] remove unnecessary returns. 2020-09-28 16:51:25 -07:00
Garret Rieger ad241f9917 [subset] check that sub rules in ChainContextFormat 1 and 2 intersect the glyphs set before recursing during closure lookups. 2020-09-28 15:26:13 -07:00
Garret Rieger 9fad540245 [subset] check that sub rules in ContextFormat 1 and 2 intersect the glyphs set before recursing during closure lookups. 2020-09-28 13:24:25 -07:00
Koji Ishii 7e6070a47f Set *coord to nullptr 2020-09-28 08:36:41 -06:00
Koji Ishii 4e0bddb7fe get_baseline 2020-09-28 08:36:41 -06:00
Khaled Hosny cc7b3a1abd [Docs] Address review comments 2020-09-26 10:22:39 +02:00
n8willis 41b46a3cb2 Update hb-face.cc 2020-09-26 09:47:27 +02:00
n8willis 726e320ece Update inline doc for hb_face_create: explain index 2020-09-26 09:47:27 +02:00
Nathan Willis 70331ca485 [Docs] Minor
update GTK-Doc comments in hb-ot-layout.
2020-09-26 09:47:13 +02:00
Nathan Willis eb10ef46aa [Docs] Add GTK-Doc comments for hb-ot-font and hb-ot-shape. 2020-09-26 09:46:15 +02:00
Nathan Willis 3e72febde0 [Docs] Add GTK-Doc comments for hb-face. 2020-09-26 09:46:15 +02:00
Nathan Willis 88cdea60e0 [Docs] Add GTK-Doc comments to hb-shape-plan. 2020-09-26 09:46:10 +02:00
Nathan Willis 5b43eb5a4c [Docs] Add GTK-Dod comments to hb-unicode. 2020-09-26 09:42:22 +02:00
Garret Rieger a5c0ec7516 [subset] For [Chain]ContextFormat3 make sure the sub table intersects the retained glyphset before recursing to its lookups.
Otherwise the lookup closure will potentially pull in lookups which cannot be accessed via the retained glyph set.
2020-09-25 14:57:20 -07:00
Garret Rieger dc375559fd [subset] shrink the serialize buffer when pruning empty offsets in ChainContextFormat2.
Currently the code reduces the array length, but does not trim back the space allocated in the serializer for those empty offsets.
2020-09-25 13:08:46 -07:00
Garret Rieger 90eb1a40eb [subset] In ChainContextFormat3 don't skip subsetting if backtrack or lookahead are empty.
It's valid to have a ChainContextFormat3 with either an empty backtrack or lookahead. Only drop the lookup if the input sequence is empty.
2020-09-25 12:36:32 -07:00
Fabrice Fontaine 2604201ae0 src/meson.build: allow introspection when cross-compiling
introspection can be enabled when cross-compiling on certains conditions
(for example it is supported by buildroot) so, as suggested by
Tim-Philipp Müller, disable it by default for cross builds unless the
option was explicitly enabled by the user

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-09-25 18:40:43 +02:00
Khaled Hosny df00f45e26 Fix annotation in previous commits 2020-09-24 11:57:46 +02:00
Nathan Willis 5a695a79a0 Swap # for () in gtk-doc function mention. 2020-09-24 11:57:46 +02:00
n8willis 379be7b7c8 Update src/hb-ot-var.cc
Co-Authored-By: Khaled Hosny <khaledhosny@eglug.org>
2020-09-24 11:57:46 +02:00
Nathan Willis 938add712a Add GTK-Doc comments for hb-ot-var. 2020-09-24 11:55:09 +02:00
Khaled Hosny 9a1be3fed5 Fix enum documentation syntax 2020-09-22 16:46:03 +02:00
n8willis 3c9244e662 Update src/hb-aat-layout.cc
Co-Authored-By: Khaled Hosny <khaledhosny@eglug.org>
2020-09-22 15:59:42 +02:00
Nathan Willis d619ba0681 Add gtk-doc documentation to AAT layout functions and enums. 2020-09-22 15:59:14 +02:00
Nathan Willis 514e6baaf0 [gtk-doc] document AAT functions and enums. 2020-09-22 15:59:11 +02:00
Behdad Esfahbod a1f4d285e1 [buffer] Fix invalid write access in hb_buffer_deserialize_glyphs()
If buffer is immutable, we were trying to set content_type on it.
Ouch!
2020-09-21 16:50:11 -06:00
ebraminio 1f8b1e7f18
[ENOMEM] Return gracefully if stages isn't initialized correctly (#2639)
This happens if calls to 'm.lookups[table_index].push ()' has been
silently failed due to lack of memory.

This change just returns gracefully instead issuing the assert.

Fixes https://crbug.com/oss-fuzz/24494
2020-09-21 11:39:38 +03:30
Behdad Esfahbod e40c0d82e2 [ENOMEM] Handle immutable buffer in shape_full()
Move the content_type changing to shape_plan_execute() where it belongs.
Skip setting if content type is UNKNOWN, which happens with empty buffers
only, including the immutable buffer.

Alternate fix to https://github.com/harfbuzz/harfbuzz/pull/2606
and https://github.com/harfbuzz/harfbuzz/pull/2625
2020-09-16 12:48:30 -06:00
Garret Rieger bbbcad0dbb Revert "[ENOMEM] don't perform set process operations if the other set is in an error state."
This reverts commit f3929abafe.
2020-09-16 12:23:38 -06:00
Garret Rieger f3929abafe [ENOMEM] don't perform set process operations if the other set is in an error state.
Running a process while the other set is in an error state can potentially corrupt this sets map map (for example by overwritting all of the major values with 0).
2020-09-16 10:36:30 -07:00
Simon Cozens 584d3a43b2
Merge pull request #2681 from khaledhosny/myanmar-liga
[myanmar] Don’t disable liga feature
2020-09-16 15:08:50 +01:00
Khaled Hosny 7d64b09765 [myanmar] Don’t disable liga feature
This seems to have been carried over from the Indic shaper, but
Uniscribe enables it by default.

See https://github.com/harfbuzz/harfbuzz/issues/2213#issuecomment-686062915
2020-09-12 21:45:19 +02:00
Garret Rieger 8c3d4de796 [subset] Fix integer underflow in ContextFormat2. 2020-09-11 15:52:46 -07:00
David Corbett ac3f859a30 Demote unregistered vendor-specific language tags 2020-09-09 17:50:59 -04:00
Khaled Hosny ee12c078ed
Merge pull request #2668 from rossburton/meson
meson: add hb-version.h to dependencies correctly
2020-09-08 15:37:30 +02:00
Khaled Hosny 695d85ca32
Merge pull request #2674 from rossburton/reprod
src/hb-gobject-enums.cc.tmpl: write out only the filename, not the full path
2020-09-08 15:37:00 +02:00
David Corbett 91fe20f0f5 Disambiguate OT tags when primary tag is not first 2020-09-08 09:20:00 -04:00
Alexander Kanavin e876886d1e src/hb-gobject-enums.cc.tmpl: write out only the filename, not the full path
This is beneficial for reproducible builds, as build paths can vary
between builds.
2020-09-08 11:00:32 +01:00
Ross Burton 5aff83104e [build] generate hb-version.h once at configure time with Meson
Currently with Meson hb-version.h is generated during the build without
any explicit dependencies which can result in build failures due races
over the file.

Change this to be generated at configure time, so that the file is always
generated once before the build itself.

Closes #2667
2020-09-08 09:42:27 +01:00
Ross Burton bc1c93fbe0 [build] No need to pass source directory to gen-hb-version
The input file is by definition in the source directory, so dirname()
that instead of needing the directory to be passed.

Needed because a follow-up commit will change when this is called, and the
source directory isn't trivially available at that point.
2020-09-08 09:40:56 +01:00
David Corbett faf09f5466 [USE] Support hieroglyph clusters 2020-09-02 19:50:49 -04:00
David Corbett 06f49fc8ae [USE] Update to the 2020-08-13 USE specification
This also uses the data files from
<78b2134fdc/USE>.
2020-09-02 19:50:49 -04:00
David Corbett 6a38adeb57 [use] Skip most default ignorables when clustering 2020-09-02 15:51:15 -07:00
David Corbett 645f4e7cdd Unhide CGJ before ccc=0 characters
If a CGJ precedes a starter, then it cannot have blocked any reordering,
so it can safely be skipped.
2020-09-02 15:51:15 -07:00
Garret Rieger 9825e3dd2e [ENOMEM] fix access to unitialized memory.
If the serialize() call fails to write the object then we can't safely read varstore_prime fields. Fixes https://oss-fuzz.com/testcase-detail/5137462782066688.
2020-09-02 11:01:07 -07:00
Khaled Hosny fe6381d9f1 [build] Minor 2020-09-01 03:44:01 +02:00
ebraminio a4f3a752dd [build] hb-directwrite needs a C++ linker 2020-09-01 03:21:12 +02:00
Khaled Hosny 9c98b2b9a9 2.7.2 2020-08-29 00:39:42 +02:00
David Corbett a495a54236 Ignore T & U when determining the joining scripts 2020-08-28 14:33:25 -04:00
David Corbett 420a74f772 [USE] Fix assertion failure for joining scripts 2020-08-28 14:11:48 -04:00
ebraminio 1e48225ca3
[ENOMEM] Check whether serialize context isn't in error 2020-08-13 23:22:14 +04:30
Ebrahim Byagowi 05ef75c553 2.7.1 2020-08-13 20:54:53 +04:30
Ebrahim Byagowi 253a8f7a51 [meson] Another approach to skip tests incompatible with MSVC 2020-08-13 18:28:42 +04:30
Ebrahim Byagowi 411b426c69 [meson] minor 2020-08-13 18:28:42 +04:30
Ebrahim Byagowi 6e32145dc9 [meson] Make compatbile with 0.47.0 2020-08-13 18:28:42 +04:30
Ebrahim Byagowi 58209c86a0 [meson] Make compatbile with 0.49.0
Contains a just put together summary feature polyfill and workaround
to broken ternary operator.
2020-08-13 18:28:42 +04:30
Garret Rieger 1e4fe10b98 [ENOMEM] check for error in visited map during closure features. 2020-08-13 01:43:11 +04:30
Garret Rieger 9562239f05 [ENOMEM] check for error in lookup visited set. 2020-08-13 01:43:11 +04:30
Tom Schoonjans eea9b59fc5 [meson] fix generating introspection
Only libharfbuzz_gobject is introspectable, not libharfbuzz. Therefore,
it makes no sense to target the latter for introspection: it should
instead be listed as a dependency.
2020-08-12 16:07:30 +04:30
David Corbett 7bffb5d7ba Generate `has_arabic_joining` 2020-08-12 11:34:49 +04:30
Garret Rieger 6f754852c1 [ENOMEM] skip asserts in to_bias if serializer is in an error state. 2020-08-12 11:25:30 +04:30
Ebrahim Byagowi ef2e380342 Revert "Remove cmake-config support of HarfBuzz"
This reverts commit 75efa89343.
2020-08-12 01:00:33 +04:30
Ebrahim Byagowi 0ca3557048 Turn -Wunused-but-set-variable to warning
As #2555 turned out some glib headers are imposing that so let's turn it to warning
2020-08-12 00:38:00 +04:30
Ebrahim Byagowi 5193357832 Revert "Remove autotools build support"
This reverts commit 01ac32aab2.
2020-08-11 23:51:59 +04:30
Ebrahim Byagowi 9748ae7299 Revert "Reordering fails when GDEF table is absent #2140"
This reverts commit f4cd99f28e.

As requested in https://github.com/harfbuzz/harfbuzz/issues/2516#issuecomment-670969185
2020-08-11 22:51:48 +04:30
ebraminio d03eecb4d6
[glyf] minor
style improvement
2020-08-11 16:40:40 +04:30
ebraminio 732a9164d9
[gvar] minor 2020-08-11 16:37:55 +04:30
ebraminio 0c1561894a
[glyf] minor 2020-08-10 08:52:01 +04:30
Ebrahim Byagowi f06d7331e8 [glyf] minor 2020-08-10 08:43:54 +04:30
Ebrahim Byagowi db96c7f67a [glyf] protect CompositeGlyph fields
Introduce methods instead
2020-08-10 08:43:54 +04:30
ebraminio e5fe363aa5
[glyf] Minor, don't pass accelerator_t to points_aggregator_t
No need to pass it to aggregator itself
2020-08-10 07:39:36 +04:30
ebraminio 2b9927f7e1
[glyf] minor
No need to pass glyph_for_gid as a lambda now that we are passing the accelerator itself
2020-08-10 06:26:21 +04:30
Behdad Esfahbod fce64a407d Minor 2020-08-08 14:05:03 -06:00
Ebrahim Byagowi ffe06c8f04 [glyf] Guard all the public APIs against null pool runs
Fixes https://crbug.com/oss-fuzz/24575 and https://crbug.com/oss-fuzz/24737
2020-08-08 13:43:49 +04:30
Ebrahim Byagowi 01ac32aab2 Remove autotools build support 2020-08-07 23:28:12 +04:30
Ebrahim Byagowi 1f519c2567
[glyf] Optimize retrieval of hmtx/vmtx/gvar
This should make glyf/gvar faster as makes it to invoke less table wrapper atomic operations and things.

$ meson build -Dexperimental_api=true --buildtype=release && ninja -Cbuild && build/perf/perf "--benchmark_filter=glyf.*- ot -"

Before:
extents/glyf - ot - SourceSerifVariable         46091 ns      46036 ns      16173
extents/glyf/vf - ot - SourceSerifVariable    4160142 ns    4154913 ns        174
extents/glyf - ot - Comfortaa                   25754 ns      25726 ns      27030
extents/glyf/vf - ot - Comfortaa              2627804 ns    2624596 ns        265
extents/glyf - ot - Roboto                      33556 ns      33540 ns      18513
draw/glyf - ot - SourceSerifVariable          2716848 ns    2715438 ns        256
draw/glyf/vf - ot - SourceSerifVariable       4602379 ns    4598907 ns        151
draw/glyf - ot - Comfortaa                    1659364 ns    1658142 ns        417
draw/glyf/vf - ot - Comfortaa                 2845100 ns    2842549 ns        246
draw/glyf - ot - Roboto                       1571509 ns    1570060 ns        442

After:
extents/glyf - ot - SourceSerifVariable         34738 ns      34713 ns      21332
extents/glyf/vf - ot - SourceSerifVariable    3700510 ns    3698104 ns        187
extents/glyf - ot - Comfortaa                   21604 ns      21595 ns      31907
extents/glyf/vf - ot - Comfortaa              2324787 ns    2323440 ns        296
extents/glyf - ot - Roboto                      31259 ns      31246 ns      21814
draw/glyf - ot - SourceSerifVariable          2689230 ns    2687589 ns        260
draw/glyf/vf - ot - SourceSerifVariable       4625135 ns    4622036 ns        131
draw/glyf - ot - Comfortaa                    1690336 ns    1689454 ns        402
draw/glyf/vf - ot - Comfortaa                 2898748 ns    2897074 ns        241
draw/glyf - ot - Roboto                       1570911 ns    1570138 ns        440
2020-08-07 01:21:19 +04:30
Ebrahim Byagowi 0907c10214
[gvar] minor 2020-08-07 00:15:32 +04:30
Ebrahim Byagowi 679fac87df Skip hb_shape if buffer object is immutable 2020-08-06 23:47:35 +04:30
Ebrahim Byagowi 55c41f219f
[glyf] Clamp advance value result
Fixes a sanitizer complain https://circleci.com/gh/harfbuzz/harfbuzz/150247 revealed by 02d1ec1
2020-08-06 23:37:43 +04:30
Ebrahim Byagowi 02d1ec1658
[gvar] Don't fail on imprefect gvar
No need to fail even if gvar doesn't have that much glyphs
2020-08-06 22:18:35 +04:30
Ebrahim Byagowi ec17b62457
[var] Apply variations on empty glyphs
It was ignoring empty glyphs for no good reason, this fixes it.

Fixes #2618
2020-08-06 20:16:11 +04:30
Ebrahim Byagowi 5cab55ca90
[gvar] minor 2020-08-06 18:54:58 +04:30
Ebrahim Byagowi 75efa89343 Remove cmake-config support of HarfBuzz
Reverts d38f37b2 as discussed in #2316
2020-08-03 16:45:17 +04:30
Ebrahim Byagowi 11bb8aa83e
[meson] limit check-libstdc++ check to 0.55
library(..., link_language: 'c') is introduced in 0.55 but we were relying on this anyway
assuming b_asneeded being true on meson.

#2614
2020-08-02 00:47:21 +04:30
Ebrahim Byagowi 9d3fbe0588 [meson] Add darwin versions to library()
We now have,

$ otool -L src/libharfbuzz.dylib
src/libharfbuzz.dylib:
	@rpath/libharfbuzz.0.dylib (compatibility version 0.0.0, current version 0.0.0)

And with the change should we get

$ otool -L src/libharfbuzz.dylib
src/libharfbuzz.dylib:
	@rpath/libharfbuzz.0.dylib (compatibility version 20700.0.0, current version 20700.0.0)
2020-08-02 00:34:29 +04:30
Garret Rieger 18ab8029d5 [ENOMEM] check vector status in cmap subsetting. 2020-08-02 00:30:17 +04:30
Garret Rieger 06dbb6acbb [ENOMEM] in GSUB ChainContext subsetting check maps for allocation errors. 2020-08-01 09:21:22 +04:30
Garret Rieger fb1477795c [ENOMEM] Check result of vector resize in CBDT subsetting. 2020-08-01 09:20:52 +04:30
Ebrahim Byagowi efd716de3f [cff] Check for scalars array resize result
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24504
2020-07-31 09:27:27 +04:30
Garret Rieger 040ed094ef [ENOMEM] popragate packed/packed_map errors to the serializer.
Will disable further modifications based on a bad state.
2020-07-31 08:39:26 +04:30
Garret Rieger 7f358a55f4 [ENOMEM] unchecked resize in CFF2. 2020-07-31 02:04:06 +04:30
Garret Rieger 32f052b033 [ENOMEM] Fix several instances of not checking resize in CFF. 2020-07-31 02:04:06 +04:30
Garret Rieger 4cbc7d61bc [ENOMEM] check for unset current in serializer->length(). 2020-07-31 02:04:06 +04:30
Garret Rieger 15644ee60e [ENOMEM] fix memory leak if allocation fails during pop_pack(). 2020-07-30 04:15:35 +04:30
Garret Rieger 42237adffc [ENOMEM] make serializer modification operations no-ops if it's in an error state. 2020-07-30 03:59:49 +04:30
Ebrahim Byagowi d1f1301490
[icu] Remove support for versions older than 49
It just doesn't make sense anymore, c9e5da8ded (r41018112)
2020-07-30 02:01:43 +04:30
Ebrahim Byagowi 0b74aaece7
[icu] Remove useless HB_UNUSED tags
As c9e5da8ded (r41018040)
2020-07-30 01:47:30 +04:30
Ebrahim Byagowi c9e5da8ded [icu] Remove support of ICU versions before 42
ICU 42 is released in 2012, see also 44a3136ae6 (commitcomment-41016353)
2020-07-30 01:03:07 +04:30
Garret Rieger 4ba8e3c6fd [ENOMEM] Fix failure to check calloc return.
Fixes https://oss-fuzz.com/testcase-detail/6246465148813312.
2020-07-30 00:08:08 +04:30