Commit Graph

187 Commits

Author SHA1 Message Date
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 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod f7f6d278bb Add hb_language_matches()
New API:
+ hb_language_matches()
2022-07-17 22:15:42 -06:00
Behdad Esfahbod a972d05d7e [aat] Fix build 2022-07-17 21:42:04 -06:00
Behdad Esfahbod 2124ad8906 [aat/morx] Implement language-specific forms
Test on Mac with, eg.

$ hb-view /Library/Fonts/BigCaslon.ttf -u 107
vs
$ hb-view /Library/Fonts/BigCaslon.ttf -u 107 --language pl

Fixes https://github.com/harfbuzz/harfbuzz/issues/1373
2022-07-17 21:32:27 -06:00
Behdad Esfahbod 9e1479b5f0 [morx] Limit context length
Fixes https://github.com/harfbuzz/harfbuzz/issues/3097
2022-06-01 07:54:45 -06:00
Behdad Esfahbod 4d48fae4f2 Enforce Regional_Indicators native direction to LTR
And undo the morx direction reversal change introduced in
https://github.com/harfbuzz/harfbuzz/pull/3315
23159084b4

This fixes original bug https://github.com/harfbuzz/harfbuzz/issues/3314

And the reversion in morx code fixes regressions:
https://github.com/harfbuzz/harfbuzz/issues/3528
https://github.com/harfbuzz/harfbuzz/issues/3535

Supersedes:
https://github.com/harfbuzz/harfbuzz/pull/3529
2022-04-21 11:15:34 -06:00
Behdad Esfahbod 23159084b4 [morx] Reverse graphemese, not whole buffer
Fixes https://github.com/harfbuzz/harfbuzz/issues/3314
Supersedes https://github.com/harfbuzz/harfbuzz/pull/3315
2021-12-10 15:02:57 -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 5efe360986 Rename (Unsized)OffsetListOf 2021-03-31 15:33:22 -06:00
Behdad Esfahbod 34a1204f10 [buffer] HB_NODISCARD output_glyph()
Also, generalize and use replace_glyphs() in morx where output_glyph() was used
in a loop.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod 2a0dbb3ee5 [buffer] HB_NODISCARD copy_glyph() 2021-03-15 14:10:39 -06:00
Behdad Esfahbod cac6c86d2f [buffer] HB_NODISCARD move_to() 2021-03-15 13:56:46 -06:00
Behdad Esfahbod 3f1998a065 [buffer] HB_NODISCARD replace_glyph() 2021-03-15 13:33:44 -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
Ebrahim Byagowi d0e2addd43 minor 2020-07-18 22:16:02 +04:30
Ebrahim Byagowi 9566904cb3
[morx] minor, mark with unlikely
at least just to show this is the unusual path
2020-07-14 15:17:17 +04:30
Ebrahim Byagowi 11d583a9ea
[aat] Consume glyph insertion from buffer's max_ops (#2223)
Glyph insertion is an expensive operation and we like to have it limited
based on buffer's input size which is handled by buffer's max_ops.

clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5754958982021120:

Before the change: 0.67s user 0.00s system 99% cpu 0.674 total
 After the change: 0.02s user 0.00s system 98% cpu 0.024 total

Which takes much longer on valgrind and tsan bots.
2020-07-13 18:53:06 -07:00
Behdad Esfahbod e7c79e16b8
Merge pull request #2287 from simoncozens/instrumentation
Add messages for GPOS/GSUB (take 2)
2020-06-17 15:32:40 -07:00
Simon Cozens fe926970bc Reformat messages again
Messages can be:

start/end table  XXXX
start/end lookup NNNN
start/end subtable NNNN (for kerx/kern)
start/end chainsubtable NNNN (for morx)
2020-06-16 09:12:44 +01: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
Jonathan Kew 573b6bf826 Handle non-exclusive features when mapping OpenType tags to AAT feature type/selector pairs.
Fixes #2290.
2020-04-16 01:33:01 +04:30
Simon Cozens bef7ef81da Reformat kerx/morx instrumentation to 'verb noun identifier' 2020-03-30 16:39:43 +01:00
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 170b5dd856 [aat] Minor 2019-09-09 10:52:54 -04:00
Behdad Esfahbod a0695687eb [aat] Minor 2019-09-09 10:52:54 -04:00
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
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 36bb24f7b4 [dispatch] Forward arguments in all dispatch multiplexers 2019-05-05 10:14:17 -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 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
Behdad Esfahbod 1ec90514f6 [AAT] Minor 2019-01-24 17:21:41 +01: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 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 7e6bd510fc Use NNOffsetTo<> in rest of places 2019-01-17 18:24:18 -05:00
Behdad Esfahbod 7a6686a589 [AAT] Fix mort ContextualSubtable offset access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12312
2019-01-14 15:09:14 -05:00
Behdad Esfahbod 1043ddbee8 [aat] Minor 2018-12-27 18:27:11 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod fb05908213 Revert ugly fixes
Now that we have 6daf45e0, revert cryptic hacks...

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

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:15 -05:00
Behdad Esfahbod 9c6921c08c More...
hb-ot-layout-gsubgpos.hh:1707: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
...
2018-11-30 15:16:57 -05:00