Commit Graph

2478 Commits

Author SHA1 Message Date
Behdad Esfahbod 8659c63608 Hand-code bsearch in the hot inner loop.
Saves another 3 / 4 percent with Amiri.
2013-04-19 14:36:32 -04:00
Behdad Esfahbod 797d76d07f Minor 2013-04-18 19:04:12 -04:00
Behdad Esfahbod 0dc3a4e034 Obssesive optimization
Not measurable by any means, but conceptually this is faster since
the mask matches more often than the digest.
2013-04-17 23:04:03 -04:00
Behdad Esfahbod f9a6110267 Remove HB_DEBUG_SET_DIGESTS
Wasn't correct with the new combiner.  I should add it back somehow,
but for now the digests seem to be working very well...
2013-04-17 19:01:49 -04:00
Behdad Esfahbod f7466ee76f Remove hb_set_digest_common_bits_t
Was unused.
2013-04-17 18:20:44 -04:00
Behdad Esfahbod 0d5798a137 Improve hb_set_digest_t
Make Amiri rendering faster a whopping 45% again!  Speends up pretty
much anything I tested.
2013-04-17 18:19:21 -04:00
Behdad Esfahbod c7851efcd3 Templatize hb_set_digest_lowest_bits_t filter 2013-04-17 18:18:10 -04:00
Behdad Esfahbod 0edd0fd255 Add comment 2013-04-17 17:26:56 -04:00
Behdad Esfahbod b40f2c0372 Add hb_set_digest_combiner_t 2013-04-16 23:21:38 -04:00
Behdad Esfahbod 02e5e58368 Speed up Speed up hb_set_digest_common_bits_t calcs
Correctly this time.
2013-04-16 23:13:10 -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 4d2813d3e9 Print set-digest hit ratio with HB_DEBUG_SET_DIGESTS 2013-04-16 21:57:35 -04:00
Behdad Esfahbod 1357c2dd12 Revert "Speed up hb_set_digest_common_bits_t calcs"
This reverts commit 3d1b66a35e.

The calculations were buggy.  It's not worth optimizing right now.
2013-04-16 21:47:40 -04:00
Behdad Esfahbod 2b712bba3f Fix typo in unused macro 2013-04-16 16:11:09 -04:00
Behdad Esfahbod 08677c2507 [old] Speed up Unicode properties access in hb-old shaper
Just to be sure it's not punishing the old shaper performance
numbers.  Doesn't seem to have a measurable effect.
2013-04-11 14:45:58 -04:00
Behdad Esfahbod ef9e02eddf Minor 2013-04-09 14:06:54 -04:00
Behdad Esfahbod 587e5753e0 Add note re Hangul shaping 2013-04-05 12:38:58 -04:00
Behdad Esfahbod 269de14dda Don't compose Hangul jamo
See thread "an issue regarding discrepancy between Korean and Unicode
standards" on the mailing list for the rationale.  In short: Uniscribe
doesn't, so fonts are designed to work without it.
2013-04-04 23:06:54 -04:00
Behdad Esfahbod 1f97060985 Put back MemoryBarrier fallback implementation on MINGW32
This almost reverts 2761e8a632,
but only if under MINGW32, so it doesn't affect MSVC.
2013-04-04 15:02:03 -04:00
Behdad Esfahbod f368ba4a9e [Arabic] Zero marks by GDEF, not Unicode category
Testing shows that this is closer to what Uniscribe does.

Reported by Khaled Hosny:

"""
commit 568000274c
...
This commit is causing a regression with Amiri, the string “هَٰذ” with
Uniscribe and HarfBuzz before this commit, gives:

	[uni0630.fina=3+965|uni0670.medi=0+600|uni064E=0@-256,0+0|uni0647.init=0+926]

But now it gives:

	[uni0630.fina=3+965|uni0670.medi=0+0|uni064E=0@-256,0+0|uni0647.init=0+926]

i.e. uni0670.medi is zeroed though it has a base glyph GDEF class.
"""

The test case is U+0647,U+064E,U+0670,U+0630 with Amiri.
2013-04-04 14:25:36 -04:00
Behdad Esfahbod 3b80674c50 Bug 63107 - FTBFS on ppc64: symbols marked with 'D' on powerpc64 instead 2013-04-04 12:06:46 -04:00
Behdad Esfahbod 7148dc1a97 [graphite2] Don't crash if language is not set
https://bugs.webkit.org/show_bug.cgi?id=113796
2013-04-02 14:08:53 -04:00
Behdad Esfahbod a88a62f70f Minor 2013-03-21 21:02:16 -04:00
Behdad Esfahbod cc50bf5b13 Remove Hangul filler characters from Default_Ignorable chars
See discussion on mailing list.
2013-03-19 07:00:41 -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 190e19e684 [ft] Remove TODO items that I'm not going to fix 2013-03-09 20:30:22 -05:00
Behdad Esfahbod 392ee97431 [ft] Remove TODO item re FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
That flag is redundant, deprecated, and ignored since April 2011.
From FreeType git log:

commit 8c82ec5b17d0cfc9b0876a2d848acc207a62a25a
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Thu Apr 21 08:21:37 2011 +0200

    Always ignore global advance.

    This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant,
    deprecated, and ignored.  The new behavior is what every major user
    of FreeType has been requesting.  Global advance is broken in many
    CJK fonts.  Just ignoring it by default makes most sense.

    * src/truetype/ttdriver.c (tt_get_advances),
    src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics,
    tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph),
    src/truetype/ttgload.h: Implement it.

    * docs/CHANGES: Updated.
2013-03-09 20:27:55 -05:00
Behdad Esfahbod c5d91f3980 Add hb_auto_array_t 2013-03-09 04:34:21 -05:00
Behdad Esfahbod ee5464d17f [OTLayout] Move code around 2013-03-09 01:59:30 -05:00
Behdad Esfahbod 9c5a9ee967 [OTLayout] Rename process() to dispatch() 2013-03-09 01:55:04 -05:00
Behdad Esfahbod 2761e8a632 [win32] Remove MemoryBarrier() fallback implementation
I added these because the older mingw32 toolchain didn't have
MemoryBarrier().  The newer mingw-w64 toolchain however has.
As reported by John Emmas this was causing build failure with
MSVC (on glib) because of inline issues.  But that reminded me
that we may be taking this path even if the system implements
MemoryBarrier as a function, which is a waste.  So, just remove
it.
2013-03-07 20:51:30 -05:00
Behdad Esfahbod 5594c2d112 [FT] Just return if glyph name not found
The fallback happens in higher level already.  No need to do here.
2013-03-06 19:37:31 -05:00
Behdad Esfahbod fb7c182bf9 [Indic] Minor 2013-03-06 00:53:24 -05:00
Behdad Esfahbod 8144936d07 [Indic] Work around fonts with broken new-spec tables
See comments, and this thread:

http://lists.freedesktop.org/archives/harfbuzz/2013-March/002990.html

Originally reported here:

https://code.google.com/p/chromium/issues/detail?id=96143

Doesn't change test suite numbers.
2013-03-05 20:08:59 -05:00
Behdad Esfahbod cd54d505d1 Fix distcheck 2013-03-04 21:29:38 -05:00
Behdad Esfahbod 41732f1fe3 [Indic] Help compiler put indic_features table in .rodata
The overridden "or" operator was preventing the flag expression from
being const, and putting the table in .data instead or .rodata.
2013-02-27 20:40:54 -05:00
Behdad Esfahbod 778d7f844c [buffer] Better parse glyph names 2013-02-27 18:49:18 -05:00
Behdad Esfahbod 20b817ac21 [buffer] Implement buffer deserialization for format=json
Using a ragel machine.
2013-02-27 18:49:18 -05:00
Behdad Esfahbod 847794e929 [buffer] Implement buffer deserialization for format=text
Using a ragel machine.
2013-02-27 18:49:18 -05:00
Behdad Esfahbod 4ee803b42a [buffer] Fix serializing of buffer with invalid direction 2013-02-27 18:49:15 -05:00
Behdad Esfahbod e54dd26300 [buffer] Start implementing buffer deserialization 2013-02-27 18:49:13 -05:00
Behdad Esfahbod bcc8f32b4c [buffer] Minor 2013-02-27 18:49:10 -05:00
Behdad Esfahbod d3e14aafff [buffer] Move buffer serialization code to a new file 2013-02-27 18:49:05 -05:00
Behdad Esfahbod 8da5111269 Minor 2013-02-27 18:49:05 -05:00
Behdad Esfahbod 94789fd601 [Indic] Sort pre-base reordering consonants with post-forms
Before, we were marking them as below-form for initial reordering.
However, there is a rule that says "post consonants should follow
below consonsnts" for base determination purposes.  Malayalam has
port-form YA/VA, and RA is pre-base.  As such, for a sequence like
YA,Virama,YA,Virama,RA, the correct base is at index 0.  But
because the code was seeing RA as a below-base, it was stopping at
the second YA as base, instead of jumping it as a post-base.

By treating prebase-reordering consonants like post-forms, this
is fixed.

MALAYALAM went down from 351 to 265.  Other numbers didn't change:

BENGALI: 353686 out of 354188 tests passed. 502 failed (0.141733%)
DEVANAGARI: 707305 out of 707394 tests passed. 89 failed (0.0125814%)
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: 1048069 out of 1048334 tests passed. 265 failed (0.0252782%)
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-26 21:22:37 -05:00
Behdad Esfahbod 05d5d3cd63 Fix "comparison between signed and unsigned" warnings
Patch from Jonathan Kew.
2013-02-25 23:57:51 -05:00
Behdad Esfahbod 07a52b6211 Give up sanitizing after 100 edit requests
Such fonts are *definitely* really broken.  Give up.
Limits time spent in sanitize for extremely / deliberately broken
fonts.  For example, two fonts with these md5sum / names:

  9343f0a1b8c84b8123e7d201cae62ffd.ttf
  eb8c978547f09d368fc204194fb34688.ttf

were spending over a second in sanitize!  Not anymore.
2013-02-25 19:09:57 -05:00
Behdad Esfahbod 29ff254815 Add HB_DEBUG_VERBOSE
Only affects the verbosity of function name printing right now.
2013-02-25 19:04:56 -05:00
Behdad Esfahbod c3ba49b6fa Always create sub-blobs in MEMORY_MODE_READONLY
This fixes a design bug with sanitize and sub-blobs that can
cause crashes.  Jonathan and I found and debugged this issue
when we tested a corrupt font with the md5sum / filename:
ea395483d37af0cb933f40689ff7b60a.  Two hours of intense
debugging we found out that the font has overlapping GSUB/GPOS
tables, and as such, sanitizing the second table can modify
the first one, which can cause all kinds of undefined behavior.

The correct way to fix this is to make sure sub-blobs are
always created readonly, since we consider the parent blob
to be a shared resource and can't modify it, even if it *is*
writable.

This essentially makes the READONLY_MAY_MAKE_WRITABLE mode
unused...  Maybe we should simply remove / deprecate it.
2013-02-25 17:06:35 -05:00
Behdad Esfahbod 57542d7f41 Minor 2013-02-21 15:55:49 -05:00