Commit Graph

52 Commits

Author SHA1 Message Date
Behdad Esfahbod 44be1e5dfb s/SHAPE_COMPLEX/SHAPER/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod c852b86841 Rename HBGlyphID to HBGlyphID16 2021-09-19 16:30:12 -04:00
Behdad Esfahbod 2337f0d047 Internally use hb_malloc/.../hb_free instead of malloc/.../free
Redefining those stock names as macros was conflicting with gcc 10
headers.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07: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
ebraminio 1e48225ca3
[ENOMEM] Check whether serialize context isn't in error 2020-08-13 23:22:14 +04:30
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 51b720f686 Fix -Wsizeof-array-div clang warning 2019-10-01 12:40:41 +03: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 edfc6be4a0 [arabic] Disable fallback shaping if HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK defined
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-04-10 16:10:54 -04:00
Behdad Esfahbod b986c6a321 [C++11] Remove IntType::set() in favor of operator= 2019-03-29 20:21:21 -07:00
Behdad Esfahbod 815cde9fa3 [iter] Use is_sorted_iterator 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 f1e95e40ed [arrays] Remove hb_supplier_t<> 2018-12-18 16:49:08 -05:00
Behdad Esfahbod cf39c24205 [arrays] Rename Supplier to hb_supplier_t 2018-12-17 22:36:23 -05:00
Behdad Esfahbod 1bcc4fc9f3 Whitespace 2018-12-16 23:47:56 -05:00
Ken Brown eee5b5ed04 Don't use Win32 API on Cygwin
Cygwin is a Posix platform to the extent possible.  It should use the
Posix API except in special circumstances.
2018-11-12 21:07:34 -05:00
Behdad Esfahbod 4674655841 Minor 2018-11-10 20:11:10 -05:00
Behdad Esfahbod 35d410f2ba Remove ASSERT_POD
Newer compilers / language allows structs with constructor in union.
So, this was not actually testing anything.  Indeed, the recent
change in DISALLOW_COPY *is* making some of our types non-POD.
That broke some bots.

Just remove this since it wasn't doing much, and I'd rather have
DISALLOW_COPY.
2018-10-29 14:45:44 -07:00
Behdad Esfahbod 39bd07aed5 Fix bunch of unused parameter warnings
Show up with gcc -O0.

There's a few more but those are functions that need to be filled in.

Maybe this is a lost battle...
2018-10-26 21:22:26 -07:00
Behdad Esfahbod 97e5913d5a Move more code 2018-10-10 11:41:05 -04:00
Behdad Esfahbod 606bf57430 Revert forcing use of single-parameter static_assert()
Some clang versions define static_assert as a macro apparently, so we cannot
redefine it...

This reverts commit 94bfea0ce6.
This reverts commit 4e62627831.
2018-09-16 19:34:39 +02:00
Behdad Esfahbod 4e62627831 Enforce single-param static_assert() only
So we don't accidentally break it again.
2018-09-16 18:09:36 +02:00
Behdad Esfahbod 18d01eac7f Minor 2018-08-31 13:00:57 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod b912fbea17 Remove most uses of direct comparison to Null objects 2018-08-06 06:38:59 -07:00
Behdad Esfahbod 3506672ce9 Port _nil objects to Null() machinery
Finally, unified!
2018-08-06 06:17:48 -07:00
Behdad Esfahbod ed7b2e58fc Remove OT namespace from hb-machinery-private.hh 2018-08-02 00:08:08 -07:00
Behdad Esfahbod fd03449094 Rename hb_apply_context_t to hb_ot_apply_context_t 2018-01-19 16:40:13 -08:00
Volker H. Simonis a9432bde7e HarfBuzz 1.7.1 and later don't compile on AIX with xlC (#655) 2017-12-19 20:22:24 -05:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod c3448e8d21 Use static_assert instead of custom ASSERT_STATIC 2017-10-15 12:02:00 +02:00
Behdad Esfahbod 85846b3de7 Use insertion-sort instead of bubble-sort
Needed for upcoming merge-clusters fix.
2015-09-01 15:07:52 +01:00
Behdad Esfahbod 395b35903e Avoid accessing layout tables at face destruction
"Fixes" https://bugs.freedesktop.org/show_bug.cgi?id=86300

Based on discussion someone else who had a similar issue, most probably
the user is releasing FT_Face before destructing hb_face_t / hb_font_t.
While that's a client bug, and while we can (and should) use FreeType
refcounting to help avoid that, it happens that we were accessing
the table when we didn't really have to.  Avoid that.
2014-12-28 16:03:26 -08:00
Behdad Esfahbod 9ceb673d9c [arabic] Allow disabling win1256 fallback code
By defining HB_NO_WIN1256.
2014-08-25 11:48:12 -04:00
Behdad Esfahbod 8f3eebf7ee Make sure gsubgpos buffer vars are available during fallback_position
Add buffer var allocation asserts to a few key places.
2014-08-02 19:07:49 -04:00
Behdad Esfahbod abfa4252cc [arabic/win1256] Really fix lam-alef this time
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c26
b276e897d1 (commitcomment-7243499)
2014-08-02 14:59:32 -04:00
Behdad Esfahbod 55977f2a46 [arabic/win1256] Hook up lamMedi lookup
Restructure lookup array to accommodate.

https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c18
2014-08-01 16:14:33 -04:00
Behdad Esfahbod 1789ccb1dd [arabic/win1256] Remove GCC'ism
The table can now compile independently too.  If we cannot make it work
on MSVC, we can always generate the data and distribute it.

The code now compiles cleanly with:

gcc -c -xc -std=c99 -Werror -pedantic hb-ot-shape-complex-arabic-win1256.hh
g++ -c -xc -std=c++1x -Werror -pedantic hb-ot-shape-complex-arabic-win1256.hh

See:
a97f537cec (commitcomment-7218736)
2014-07-31 18:58:24 -04:00
Behdad Esfahbod f28b1c823d [arabic] Implement Windows-1256 private shaping
Bug 1045139 - The Arabic text with "MS Sans Serif" font is rendered bad
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139

This is only enabled on Windows platforms, and requires support from
Uniscribe to work.  But for clients that do hook up to Uniscribe, this
fixes shaping of Windows-1256-encoded bitmap fonts like "MS Sans Serif".

The code and table together have just less than a 1kb footprint when
enabled.

UNTESTED.  I might even have broken regular Arabic fallback shaping.
2014-07-31 18:58:24 -04:00
Behdad Esfahbod 88911e8cc7 Minor 2014-07-29 19:47:26 -04:00
Behdad Esfahbod 7627100f42 Mark unsigned integer literals with the u suffix
Simplifies hb_in_range() calls as the type can be inferred.
The rest is obsessiveness, I admit.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod bac1dd6a0f [OTLayout] Refactor a bit more 2013-05-04 16:04:04 -04:00
Behdad Esfahbod 45fd9424c7 [OTLayout] Add hb_ot_layout_lookup_accelerator_t 2013-05-04 16:04:03 -04:00
Behdad Esfahbod 893991fc9d Initialize set digests
We were not initializing the digests properly and as a result they were
being initialized to zero, making digest1 to never do any useful work.

Speeds up Amiri shaping significantly.
2013-04-16 21:57:35 -04:00
Behdad Esfahbod a8cf7b43fa [Indic] Futher adjust ZWJ handling in Indic-like shapers
After the Ngapi hackfest work, we were assuming that fonts
won't use presentation features to choose specific forms
(eg. conjuncts).  As such, we were using auto-joiner behavior
for such features.  It proved to be troublesome as many fonts
used presentation forms ('pres') for example to form conjuncts,
which need to be disabled when a ZWJ is inserted.

Two examples:

	U+0D2F,U+200D,U+0D4D,U+0D2F with kartika.ttf
	U+0995,U+09CD,U+200D,U+09B7 with vrinda.ttf

What we do now is to never do magic to ZWJ during GSUB's main input
match for Indic-style shapers.  Note that backtrack/lookahead are still
matched liberally, as is GPOS.  This seems to be an acceptable
compromise.

As to the bug that initially started this work, that one needs to
be fixed differently:

  Bug 58714 - Kannada u+0cb0 u+200d u+0ccd u+0c95 u+0cbe does not
  provide same results as Windows8
  https://bugs.freedesktop.org/show_bug.cgi?id=58714

New numbers:

BENGALI: 353689 out of 354188 tests passed. 499 failed (0.140886%)
DEVANAGARI: 707305 out of 707394 tests passed. 89 failed (0.0125814%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%)
KANNADA: 951030 out of 951913 tests passed. 883 failed (0.0927606%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%)
MALAYALAM: 1048102 out of 1048334 tests passed. 232 failed (0.0221304%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271666 out of 271847 tests passed. 181 failed (0.0665816%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
2013-03-19 06:22:06 -04:00
Behdad Esfahbod cfc507c543 [Indic-like] Disable automatic joiner handling for basic shaping features
Not for Arabic, but for Indic-like scripts.  ZWJ/ZWNJ have special
meanings in those scripts, so let font lookups take full control.

This undoes the regression caused by automatic-joiners handling
introduced two commits ago.

We only disable automatic joiner handling for the "basic shaping
features" of Indic, Myanmar, and SEAsian shapers.  The "presentation
forms" and other features are still applied with automatic-joiner
handling.

This change also changes the test suite failure statistics, such that
a few scripts show more "failures".  The most affected is Kannada.
However, upon inspection, we believe that in most, if not all, of the
new failures, we are producing results superior to Uniscribe.  Hard to
count those!

Here's an example of what is fixed by the recent joiner-handling
changes:

  https://bugs.freedesktop.org/show_bug.cgi?id=58714

New numbers, for future reference:

BENGALI: 353892 out of 354188 tests passed. 296 failed (0.0835714%)
DEVANAGARI: 707336 out of 707394 tests passed. 58 failed (0.00819911%)
GUJARATI: 366262 out of 366457 tests passed. 195 failed (0.0532122%)
GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%)
KANNADA: 950680 out of 951913 tests passed. 1233 failed (0.129529%)
KHMER: 299074 out of 299124 tests passed. 50 failed (0.0167155%)
LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%)
MALAYALAM: 1047983 out of 1048334 tests passed. 351 failed (0.0334817%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271539 out of 271847 tests passed. 308 failed (0.113299%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
2013-02-14 13:10:54 -05:00
Behdad Esfahbod 6880f7e19d [OTLayout] Make table type known to apply context 2013-02-13 12:17:25 -05:00
Behdad Esfahbod 0beb66e3a6 Fix warnings 2012-12-05 19:14:28 -05:00
Behdad Esfahbod 07cfbe21b5 [OT] Streamline Arabic fallback shaping table 2012-09-06 01:16:39 -04:00