Commit Graph

99 Commits

Author SHA1 Message Date
Behdad Esfahbod 7f5941e162 Remove stale comment
Ugliness was fixed in 30eab97a00
But yeah, my smell detector was working.  Ugliness was buggy.
2018-10-27 00:06:48 -07:00
Behdad Esfahbod 30eab97a00 Fix invalid memory read
Buffer might be relocated inside replace_glyphs().

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=895117
2018-10-26 21:54:40 -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 e883f52732 Call get_nominal_glyphs() for runs of simple clusters at a time
Even without FT or OT font funcs implementing get_nominal_glyphs(), there's measurable
speedup.
2018-10-09 14:50:57 -04:00
Behdad Esfahbod 8008bca83b Whitespace 2018-10-09 14:43:03 -04:00
Behdad Esfahbod 30c114ffec Avoid sort and recompose stages if all clusters simple
Even has measurable speedup...
2018-10-09 14:37:08 -04:00
Behdad Esfahbod 24382debe8 Rewrite main normalizer loop to isolate runs of simple clusters 2018-10-09 14:33:24 -04:00
Behdad Esfahbod b5371f18ef Inline decompose_cluster
Towards separating the common case into its own loop.
2018-10-09 14:12:59 -04:00
Behdad Esfahbod 1d1734e985 Shuffle code around 2018-10-02 13:04:05 +02:00
Behdad Esfahbod 7f335390f3 Revert change that would decompose text if GPOS mark feature is available
https://github.com/harfbuzz/harfbuzz/issues/653#issuecomment-423905920
2018-09-24 09:56:18 -04:00
Behdad Esfahbod a6f4b2f7cd Fix normalization
62d1e0852a (commitcomment-30613091)
2018-09-24 09:54:37 -04:00
Behdad Esfahbod 62d1e0852a Prefer decomposed form if font has GPOS mark feature
Fixes https://github.com/harfbuzz/harfbuzz/issues/653
2018-09-23 21:32:18 -04: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 7185b273b3 Rename in_error to !successful
Towards possibly using Null pool for some nil objects.
2018-05-31 20:03:34 -07:00
Ebrahim Byagowi eaf649450a Resolve clang's conditional-uninitialize warnings 2018-04-23 11:38:45 -07:00
Behdad Esfahbod 8c0d1916a4 Improve CGJ skipping logic
Previously we made CGJ unskippable.  Now, if CGJ did NOT prevent
any reordering, allow skipping over it.  To make this work we
had to make changes to the Arabic mark reordering algorithm
implementation to renumber moved MCM marks.  See comments.

Fixes https://github.com/harfbuzz/harfbuzz/issues/554
2018-01-05 12:48:19 +00:00
Behdad Esfahbod ab8d70ec70 [arabic] Implement Unicode Arabic Mark Ordering Algorithm UTR#53
Fixes https://github.com/behdad/harfbuzz/issues/509
2017-10-04 14:47:10 +02:00
Behdad Esfahbod b6fe0ab636 Add info_cc() convenience macro 2017-10-04 13:37:08 +02:00
Behdad Esfahbod 7f9e7f8689 Adjust normalizer for out-of-order marks
We are going to implement Unicode Arabic Mark Ordering Algorithm:

  http://www.unicode.org/reports/tr53/tr53-1.pdf

which will reorder marks out of their sorted ccc order.  Adjust
normalizer to stop combining as soon as dangerous ordering is
detected.
2017-10-04 13:20:33 +02:00
Behdad Esfahbod 1dd630a7f2 Minor
Fixes https://github.com/behdad/harfbuzz/issues/411
2017-02-01 11:57:21 -08:00
Behdad Esfahbod 8b5bc141cd Add get_nominal_glyph() and get_variation_glyph() instead of get_glyph()
New API:
- hb_font_get_nominal_glyph_func_t
- hb_font_get_variation_glyph_func_t
- hb_font_funcs_set_nominal_glyph_func()
- hb_font_funcs_set_variation_glyph_func()
- hb_font_get_nominal_glyph()
- hb_font_get_variation_glyph()

Deprecated API:
- hb_font_get_glyph_func_t
- hb_font_funcs_set_glyph_func()

Clients that implement their own font-funcs are encouraged to replace
their get_glyph() implementation with a get_nominal_glyph() and
get_variation_glyph() pair.  The variation version can assume that
variation_selector argument is not zero.
2016-02-24 19:05:23 +09:00
Behdad Esfahbod ea512f7108 Use C-style casts instead of compare to 0, to convert hb_bool_t to bool 2015-11-26 19:22:22 -05:00
Behdad Esfahbod 766963adba Merge pull request #114 from ThePhD/vc++-fixes
Fix all VC++ warnings and errors
2015-11-24 15:38:43 -06:00
Behdad Esfahbod abadc1717d Try to better handle OOM situations
Fixes assert fail in https://github.com/behdad/harfbuzz/issues/161
with libharfbuzz-fuzzing.
2015-11-18 17:52:08 -08:00
Behdad Esfahbod 6986208ba3 Optimize runs without Default_Ignorable's
Now that we have a buffer-wide scratch flags facility, use it to
optimize away a few passes.
2015-11-04 18:46:41 -08:00
Behdad Esfahbod 9cbc39aef9 Minor 2015-11-04 18:00:53 -08:00
Behdad Esfahbod 52e6c4e158 If font doesn't support U+2011, fall back to U+2010
Test passes now.
2015-11-04 17:45:56 -08:00
Behdad Esfahbod 75483aafa6 Untangle if/else waterfall 2015-11-04 17:43:36 -08:00
Behdad Esfahbod 49ef630936 Adjust the width of various spaces if font does not cover them
See discussion here:
81ef4f407d

There's no way to disable this fallback, but I don't think it would
be needed.  Let's hope for the best!

Fixes https://github.com/behdad/harfbuzz/issues/153
2015-11-04 17:27:07 -08:00
Behdad Esfahbod 7793aad946 Normalize various spaces to space if font doesn't support
This resurrects the space fallback feature, after I disabled
the compatibility decomposition.  Now I can release HarfBuzz
again without breaking Pango!

It also remembers which space character it was, such that later
on we can approximate the width of this particular space
character.  That part is not implemented yet.

We normalize all GC=Zs chars except for U+1680 OGHA SPACE MARK,
which is better left alone.
2015-11-04 15:51:41 -08:00
Behdad Esfahbod 5c8174eda3 Update comments for removal of compat decompositions 2015-10-21 18:51:40 -02:00
Behdad Esfahbod f679970040 Disable compatibility decomposition usage during normalization
Fixes https://github.com/behdad/harfbuzz/issues/152
2015-10-21 17:20:55 -02:00
Behdad Esfahbod 980e25cad2 Fix hb-ot-shape-normalize with empty buffer
Part of https://github.com/behdad/harfbuzz/issues/136
2015-10-02 08:21:12 +01:00
Behdad Esfahbod e995d33c10 [OT] Merge clusters when reordering marks for normalization
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=541608
and cluster test.
2015-09-01 16:13:32 +01: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
ThePhD 5c99cf93d6 Merge branch 'master' into vc++-fixes 2015-08-14 01:02:00 -04:00
jfkthame c7dfe316f8 Don't rely on .cluster in _hb_ot_shape_normalize()
Fixes https://github.com/behdad/harfbuzz/pull/124
2015-08-09 18:26:27 +02:00
ThePhD 8e545d5961 Fix all VC++ warnings and errors in the current commit's builds. 2015-06-22 22:29:04 -04:00
Behdad Esfahbod 1eff435023 Minor optimization 2015-01-27 12:26:04 -08: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 5209c50506 Revert "Show U+FFFD REPLACEMENT CHARACTER for invalid Unicode codepoints"
We now handle U+FFFD replacement in hb_buffer_add_utf*().  Any other
manipulation can happen in user callbacks.  No need for this.

efe74214bb (commitcomment-7039404)

This reverts commit efe74214bb.

Conflicts:
	src/hb-ot-shape-normalize.cc
2014-07-17 12:23:44 -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 efe74214bb Show U+FFFD REPLACEMENT CHARACTER for invalid Unicode codepoints
Only if the font doesn't support it.  Ie, this gives the user to
use non-Unicode codepoints as private values and return a meaningful
glyph for them.  But if it's invalid and font callback doesn't
like it, and if font has U+FFFD, show that instead.

Font functions that do not want this automatic replacement to
happen should return true from get_glyph() if unicode > 0x10FFFF.

Replaces https://github.com/behdad/harfbuzz/pull/27
2014-07-11 11:59:48 -04:00
Behdad Esfahbod 08cf5d75ef [ot] Don't try to compose if normalization is off 2014-01-22 07:53:55 -05:00
Behdad Esfahbod 8fc1f7fe74 [ot/hangul] Don't decompose Hangul even when combining marks present
As discussed on
https://github.com/behdad/harfbuzz/pull/10#issuecomment-31442030
2014-01-02 17:04:04 +08:00
Behdad Esfahbod 64426ec73a [ot] Simplify composing
Not tested.  Ouch.
2014-01-02 14:33:10 +08:00
Behdad Esfahbod 3d6ca0d32e [ot] Simplify normalization_preference again
No shaper has more than one behavior re this, so no need for a callback.
2013-12-31 16:35:37 +08:00
Behdad Esfahbod ac8cd51191 Refactor 2013-10-18 19:33:09 +02:00
Behdad Esfahbod 79d1007a50 If variation selector is not consumed by cmap, pass it on to GSUB
This changes the semantics of get_glyph() callback and expect that
callbacks return false if the requested variant is not available, and
then we will call them back with variation_selector=0 and will retain
the glyph for the selector in the glyph stream.

Apparently most Mongolian fonts implement the Mongolian Variation
Selectors using GSUB, not cmap.

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

Note that this doesn't fix the Mongolian shaping yet, because the way
that's implemented is that the, say, 'init' feature ligates the letter
and the variation-selector.  However, since currently the variation
selector doesn't have the 'init' mask on, it will not be matched...
2013-06-13 19:01:07 -04:00
Behdad Esfahbod c7a8491720 Skip over multiple variation selectors in a row 2013-06-10 15:08:49 -04:00