Commit Graph

117 Commits

Author SHA1 Message Date
Behdad Esfahbod dd42939e31 [aat] Reduce unsafe_to_concat calls 2023-01-10 13:23:19 -07:00
Behdad Esfahbod 8b17c6ca30 [aat] Comment 2023-01-10 12:17:38 -07:00
Behdad Esfahbod 0e11d317ee [aat] Optimize feature application 2023-01-10 12:16:04 -07:00
Behdad Esfahbod a70543daf3 [aat] Always unsafe-to-concat in state machine 2023-01-10 11:49:48 -07:00
Behdad Esfahbod e28c158c35 [aat] Run subtable across ranges if flags match 2023-01-10 11:08:21 -07:00
Behdad Esfahbod 2c9c49fd32 [aat] Support ranges in NonContextual subtable as well 2023-01-10 11:08:21 -07:00
Behdad Esfahbod db4c874758 Revert "Revert "[aat] Support feature ranges""
This reverts commit 6a7a38521f.
2023-01-10 11:08:21 -07:00
Behdad Esfahbod 6a7a38521f Revert "[aat] Support feature ranges"
This reverts commit 1b7994cb3a.

Broke Zapfino with partial ligature disabling. Debugging.
2023-01-09 21:29:39 -07:00
Behdad Esfahbod 1b7994cb3a [aat] Support feature ranges
The hard way...

A bit uglier than I liked it to be, but is proper at least.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4020
2023-01-09 21:16:20 -07:00
Behdad Esfahbod 622a686952 Revert "Revert "Revert "[aat] Allow disable feature ranges"""
This reverts commit 5202053c2c.
2023-01-09 21:16:20 -07:00
Behdad Esfahbod 5202053c2c Revert "Revert "[aat] Allow disable feature ranges""
This reverts commit 82b3e8af69.

Another try.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4020
2023-01-09 17:59:09 -07:00
Behdad Esfahbod 82b3e8af69 Revert "[aat] Allow disable feature ranges"
This reverts commit 24a4d397ba.

This was broken.
2023-01-09 17:28:52 -07:00
Behdad Esfahbod 24a4d397ba [aat] Allow disable feature ranges
Fixes https://github.com/harfbuzz/harfbuzz/issues/4020

This is a hack.

To implement this properly we need to treat runs with different features
as independent runs for running the state machine, as the subtable flags
might be different. That would be a significant change to our internal
implementation.
2023-01-09 17:26:48 -07:00
Behdad Esfahbod 1e503f587b [null] Add DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 2022-07-08 12:00:53 -06:00
Behdad Esfahbod 534b0911f7 [aat-layout] Add an unlikely() 2022-07-01 16:20:31 -06:00
Behdad Esfahbod c69ec6f5bb [kern2] Fix sanitize issue on 32bit systems
Fixes https://github.com/harfbuzz/harfbuzz/issues/3483
2022-06-29 16:32:59 -06:00
Behdad Esfahbod bea5369c6d [buffer] Rename swap_buffers() to sync() 2022-01-04 10:52:05 -07:00
Behdad Esfahbod 6d555ce82e [meta] Use std::forward instead of hb_forward() 2021-11-02 00:18:22 -06:00
Behdad Esfahbod c852b86841 Rename HBGlyphID to HBGlyphID16 2021-09-19 16:30:12 -04:00
Jonathan Kew 4f1e8d2bf7 [aat] Update glyph properties from GDEF if available when doing a replacement. 2021-05-17 21:44:29 -06:00
Behdad Esfahbod 5639e253f9 Add Array16Of<> 2021-03-31 16:04:43 -06:00
Behdad Esfahbod ad28f973f3 Rename offset types to be explicit about their size
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Behdad Esfahbod 29708e959a [aat] Fix offsetToIndex math for out-of-bounds values
Previously, some bad font data was accidentally being interpretted as
legit if it happened to not fall out of memory bounds. The intention
of the code was what this commit does.  I'm surprised we weren't getting
a "arithmetic between signed and unsigned values" warning / error
before.
2021-03-22 15:22:15 -07:00
Behdad Esfahbod 8450f43ae1 [buffer] HB_NODISCARD next_glyph() 2021-03-15 16:01:35 -06: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 9fcba109bf [buffer] Make swap_buffers() copy rest 2021-02-19 18:40:48 -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 1535440b48 [dispatch] Fix debug builds 2020-06-19 08:32:57 -07:00
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
Ebrahim Byagowi d512087e4d Rename GlyphID to HBGlyphID
Avoid collision with macOS's ATSUnicodeTypes.h GlyphID
2019-09-14 11:55:53 +04:30
Behdad Esfahbod 5902198cee [kerx] Fix offset issue in kern format 2
Fixes tests with HB_VAR_ARRAY != 1, as done in previous commit.
2019-09-06 21:36:31 -04:00
Behdad Esfahbod 83e3eabd84 Whitespace 2019-05-07 20:58:43 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod c14efb8e68 Fix previous commit
Priority should be given to specific over dispatch.  Broke sanitize before.
This fixes it, by moving prioritization to the context implementation, since
the correct priority cannot be done in the dispatch implementation.  Done
for subset and sanitize only, which need it.
2019-05-05 09:54:58 -07:00
Behdad Esfahbod ac350c92fd [dispatch] Try obj.dispatch(c) before trying c->dispatch(obj) 2019-05-05 09:10:46 -07:00
Ebrahim Byagowi 92588782d7
Remove space between right angle brackets now that we have C++11 (#1689) 2019-04-30 13:05:10 -07:00
Behdad Esfahbod 175bdad8bf One more variadic parameter pack use 2019-04-23 23:57:11 -04:00
Behdad Esfahbod ec2a5dc859 Use class templates for Null objects
This allows partial-instantiating custom Null object for template Lookup<T>.
Before, this had to be handcoded per instantiation.  Apparently I missed
adding one for AAT::ankr.lookupTable, so it was getting the wrong (generic)
null for Lookup object, which is wrong and unsafe.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=944346
2019-03-26 16:23:40 -07: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
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 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