Commit Graph

3711 Commits

Author SHA1 Message Date
Behdad Esfahbod 69f9fbc420 Synthesize GDEF glyph class for any glyph that does not have one in GDEF
Previously we only synthesized GDEF glyph classes if the glyphClassDef
array in GDEF was null.  This worked well enough, and is indeed what
OpenType requires: "If the font does not include a GlyphClassDef table,
the client must define and maintain this information when using the
GSUB and GPOS tables."  That sentence does not quite make sense since
one needs Unicode properties as well, but is close enough.

However, looks like Arial Unicode as shipped on WinXP, does have GDEF
glyph class array, but defines no classes for Hebrew.  This results
in Hebrew marks not getting their widths zeroed.  So, with this change,
we synthesize glyph class for any glyph that is not specified in the
GDEF glyph class table.  Since, from our point of view, a glyph not
being listed in that table is a font bug, any unwanted consequence of
this change is a font bug :).

Note that we still don't get the same rendering as Uniscribe, since
Uniscribe seems to do fallback positioning as well, even though the
font does have a GPOS table (which does NOT cover Hebrew!).  We are
not going to try to match that though.

Test string for Arial Unicode:

	U+05E9,U+05B8,U+05C1,U+05DC

Before:		[gid1166=3+991|gid1142=0+737|gid5798=0+1434]
After:		[gid1166=3+991|gid1142=0+0|gid5798=0+1434]
Uniscribe:	[gid1166=3+991|gid1142=0@348,0+0|gid5798=0+1434]

Note that our new output matches what we were generating until July
2014, because the Hebrew shaper used to zero mark advances based on
Unicode, NOT GDEF.  That's 9e834e29e0.

Reported by Greg Douglas.
2016-03-17 11:59:43 -07:00
Behdad Esfahbod fef5dd9a72 Merge pull request #232 from c0nk/wip-icu
Add --with-icu=builtin option; fix compile error
2016-03-12 19:15:15 -08:00
Behdad Esfahbod 3e10460a1d Minor comment 2016-03-11 18:45:19 -08:00
Behdad Esfahbod d14fea4bdc Remove default clause in minor switch statements
Bending to clang warnings...
https://bugs.chromium.org/p/chromium/issues/detail?id=593057
2016-03-08 12:16:41 -08:00
Behdad Esfahbod ce8ae99701 Merge pull request #231 from KonstantinRitt/post123buildfix
Fix build with HB_DISABLE_DEPRECATED
2016-03-04 17:20:35 -08:00
Behdad Esfahbod 731a430cd3 Fix requiredFeature stage handling logic
Originally the way Jonathan had written this was correct in
"continue"ing:

35e28c7a73 (diff-ead86a33a5cc9ad7f6e6381031a0baddR199)

When I rewrote his patch, I messed it up:

da13293798 (diff-ead86a33a5cc9ad7f6e6381031a0baddR209)

the intended behavior was NOT to set found=TRUE and NOT to continue.
This was resulting in feature_index[table_index] being left unset.
Oops!
2016-03-02 13:32:42 -08:00
Behdad Esfahbod 68b6296d33 Add F2DOT14 type 2016-03-01 16:41:53 +09:00
Behdad Esfahbod 082b79fe9f Use FWORD and UFWORD when it makes sense
I had forgotten about those types.
2016-03-01 16:41:26 +09:00
Kal Conley 5f995db103 Fix missing ICU #include
Fix compile error in hb-icu.cc when ICU configured with
U_NO_DEFAULT_INCLUDE_UTF_HEADERS=1
2016-02-26 00:36:17 +01:00
Kal Conley b424b6c372 Add --with-icu=builtin configure option 2016-02-26 00:35:15 +01:00
Konstantin Ritt 71248a843f Fix build with HB_DISABLE_DEPRECATED
When HB_DISABLE_DEPRECATED is defined, no code from hb-deprecated.h
should be used, even from within HB itself.
2016-02-25 18:55:28 +04:00
Behdad Esfahbod 0c7fb7419c Speed up buffer variable allocation sanity check
This makes defining HB_NDEBUG much less relevant, to the
point of irrelevance.  Sorry about all the fuss in previous
release!
2016-02-25 14:40:09 +09:00
Behdad Esfahbod 91dd115652 Add HB_NDEBUG
API changes:
- If NDEBUG is defined, define HB_NDEBUG
- Disable costlier sanity checks if HB_NDEBUG is defined.

In 1.2.3 introduced some code to disable costly sanity checks if
NDEBUG is defined.  NDEBUG, however, disables all assert()s as
well.  With HB_NDEBUG, one can disable costlier checks but keep
assert()s.

I'll probably add a way to define HB_NDEBUG automatically in
release tarballs.  But for now, production systems that do NOT
define NDEBUG, are encouraged to define HB_NDEBUG for our build.
2016-02-25 13:56:47 +09:00
Behdad Esfahbod 988165021f Disable internal buffer variable bookkeeping in NDEBUG builds
Saves some sweet time and binary size!
2016-02-25 12:23:02 +09:00
Behdad Esfahbod 94dd0bb7e7 Add blacklist signature for Times New Roman (Bold) Italic on OS X 2016-02-25 11:31:03 +09:00
Behdad Esfahbod e23cf902e9 Blacklist GDEF table of timesi.ttf and timesbi.ttf on Win 7
See discussion:
https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
2016-02-25 11:11:15 +09:00
Behdad Esfahbod c335fd7986 In trampoline implementation of get_glyph(), don't destroy user data twice! 2016-02-25 09:16:05 +09:00
Behdad Esfahbod 23335deaad [ot-font] Accelerate cmap format4 get_glyph 2016-02-24 20:27:13 +09:00
Behdad Esfahbod e0f16a715b [ot-font] Towards accelerating get_glyph() 2016-02-24 19:52:36 +09:00
Behdad Esfahbod 5473ebfb84 [ot-font] Remove level of indirection in get_glyph_variant 2016-02-24 19:32:43 +09: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 ebd7431f82 Partially revert 86c68c7a2c
That commit moved the advance adjustment for mark positioning to
be applied immediately, instead of doing late before.  This breaks
if mark advances are zeroed late, like in Arabic.  Also, easier to
hit it in RTL scripts since a single mark with non-zero advance is
enough to hit the bug, whereas in LTR, at least two marks are needed.

This reopens https://github.com/behdad/harfbuzz/issues/211
The cursive+mark interaction is broken again.  To be fixed in a
different way.
2016-02-24 15:53:40 +09:00
Behdad Esfahbod 815bdd7700 In cluster-level=0, group ZWJ/ZWNJ with previous cluster
This better emulates Unicode grapheme clusters.

Note that Uniscribe does NOT do this, but should be harmless with most clients,
and improve fallback with clients that use HarfBuzz cluster as unit of fallback.

Fixes https://github.com/behdad/harfbuzz/issues/217
2016-02-22 18:22:44 +09:00
Behdad Esfahbod 89137e325a Minor 2016-02-22 16:00:59 +09:00
Behdad Esfahbod 15063b12f7 [coretext] Move CTFont construction to face_data 2016-02-22 15:56:29 +09:00
Behdad Esfahbod ba3d49d9a5 [coretext] Move code around 2016-02-22 15:50:12 +09:00
Behdad Esfahbod 90194efb84 [coretext] Move code around 2016-02-22 15:42:53 +09:00
Behdad Esfahbod 9a13ed453e Make FixedVersion a template 2016-02-22 15:38:44 +09:00
Behdad Esfahbod 238b943e85 [coretext] Fix leak! 2016-02-22 15:31:22 +09:00
Behdad Esfahbod e561122856 [coretext] Move code around 2016-02-22 15:28:37 +09:00
Behdad Esfahbod 04c6443153 [coretext] Ignore PPEM in font size selection 2016-02-22 15:12:27 +09:00
Behdad Esfahbod 62c2711121 [coretext] Limit grapheme-cluster forming to cluster-level=0 2016-02-22 15:07:20 +09:00
Behdad Esfahbod 061105ec44 [coretext] Fix shaping with varying font size
Fixes https://github.com/libass/libass/issues/212
2016-02-22 14:59:39 +09:00
Behdad Esfahbod b87e36f6f1 Avoid buffer->move_to() in case of buffer error
Fixes https://github.com/behdad/harfbuzz/issues/223

Right now we cannot test this because it has to be tested using hb-fuzzer.
We should move all fuzzing tests from test/shaping/tests/fuzzed.tests to
test/fuzzing/ and have its own test runner.  At that point, should add
test from this issue as well.
2016-02-19 14:52:31 +07:00
Behdad Esfahbod 568a0c60e8 Remove pointless overflow check in pointer math
Fixes https://github.com/behdad/harfbuzz/issues/227
2016-02-18 19:31:51 +07:00
Behdad Esfahbod aae2847099 Emoji skin tone modifiers need to be treated as combining marks
Fixes https://github.com/behdad/harfbuzz/issues/169
2016-02-18 17:06:25 +07:00
Behdad Esfahbod da41e48f0a [USE] Zero mark advances by GDEF early
This is what Microsoft's implementation does.  Marks that need advance
need to add it back using 'dist' or other feature in GPOS.  Update tests to
match.
2016-02-16 17:16:33 +07:00
Behdad Esfahbod 86c68c7a2c [GPOS] Fix interaction of mark attachments and cursive chaining
Fixes https://github.com/behdad/harfbuzz/issues/211

What happens in that bug is that a mark is attached to base first,
then a second mark is cursive-chained to the first mark.  This only
"works" because it's in the Indic shaper where mark advances are
not zeroed.

Before, we didn't allow cursive to run on marks at all.  Fix that.
We also where updating mark major offsets at the end of GPOS, such
that changes in advance of base will not change the mark attachment
position.  That was superior to the alternative (which is what Uniscribe
does BTW), but made it hard to apply cursive to the mark after it
was positioned.  We could track major-direction offset changes and
apply that to cursive in the post process, but that's a much trickier
thing to do than the fix here, which is to immediately apply the
major-direction advance-width offsets...  Ie.:

https://github.com/behdad/harfbuzz/issues/211#issuecomment-183194739

If this breaks any fonts, the font should be fixed to do mark attachment
after all the advances are set up first (kerning, etc).

Finally, this, still doesn't make us match Uniscribe, for I explained
in that bug.  Looks like Uniscribe applies minor-direction cursive
adjustment immediate as well.  We don't, and we like it our way, at
least for now.  Eg. the sequence in the test case does this:

- The first subscript attaches with mark-to-base, moving in x only,
- The second subscript attaches with cursive attachment to first subscript
  moving in x only,
- A final context rule moves the first subscript up by 104 units.

The way we do, the final shift-up, also shifts up the second subscript
mark because it's cursively-attached.  Uniscribe doesn't.  We get:

[ttaorya=0+1307|casubscriptorya=0@-242,104+-231|casubscriptnarroworya=0@20,104+507]

while Uniscribe gets:

[ttaorya=0+1307|casubscriptorya=0@-242,104+-211|casubscriptnarroworya=0+487]

note the different y-offset of the last glyph.  In our view, after cursive,
things move together, period.
2016-02-16 16:07:20 +07:00
Behdad Esfahbod 80c8855cfe Minor 2016-02-12 12:50:17 +07:00
Behdad Esfahbod 6ab920224c [GPOS] Minor
No effect.
2016-02-11 16:57:52 +07:00
Behdad Esfahbod cbc3a76c5a [GPOS] Merge fixing of offsets for cursive and mark attachments
Part of fixing https://github.com/behdad/harfbuzz/issues/211
2016-02-11 16:48:13 +07:00
Behdad Esfahbod 7d8d58ac81 [GPOS] Divide position_finish() into two phases, for advances and offsets
Right now the position_finish_advances() is empty.  To be used for
spacing attachments proposal later.
2016-02-11 16:34:28 +07:00
Behdad Esfahbod 8474231567 [ot] Minor shuffling code around 2016-02-11 16:27:41 +07:00
Behdad Esfahbod b0b11614e9 [GPOS] Add harmless recursion in fix_mark_attachment()
Will do nothing.  Just useful for merging two functions.
2016-02-11 15:28:55 +07:00
Behdad Esfahbod 686567baab [GPOS] Merge attach_chain() and cursive_chain()
Differentiate, using new attach_type().
2016-02-11 15:25:28 +07:00
Behdad Esfahbod 806ad8dc65 [GPOS] Minor shuffling 2016-02-11 14:53:11 +07:00
Behdad Esfahbod 0f6278d1fb [GPOS] Negate sign of attach_lookback(), and rename it to attach_chain()
No behavior change.  Preparing to unify how cursive and mark attachments
work.
2016-02-11 14:49:10 +07:00
Behdad Esfahbod 660c9d3fc2 Remove font-dependent ASCII-only perf hack
Is confusing.  I already hit it myself.  Remove.  We can optimize
ASCII based on Unicode properties.  But should not do based on
assumptions on the font.
2016-02-11 12:14:27 +07:00
Behdad Esfahbod eaadcbbc53 Remove now-unused mark zeroing BY_UNICODE 2016-02-10 18:29:54 +07:00
Behdad Esfahbod b3582a8ee8 Change default mark advance zeroing behavior from Unicode to GDEF
See thread at:
https://lists.freedesktop.org/archives/harfbuzz/2016-February/005462.html
2016-02-10 18:10:15 +07:00
Chun-wei Fan c679285455 build: Build the DirectWrite sources if requested
This adds to the autotools build system so that the (experimental)
DirectWrite support for HarfBuzz is built (and dist'ed).
2016-02-03 20:14:42 +08:00
Chun-wei Fan 35ded3af74 build: Move source listings into separate Makefile snippets
This moves all the source listings in src/Makefile.am,
src/hb-ucdn/Makefile.am and util/Makefile.am into separate Makefile
snippets, so that they may be shared between different Makefile-based
build systems, such as NMake for Visual Studio.
2016-02-03 18:14:29 +08:00
Behdad Esfahbod b894a85ad1 Fix more hangs in case of buffer allocation errors
Hopefully
fixes https://github.com/behdad/harfbuzz/issues/214
2016-02-02 16:39:19 +08:00
Behdad Esfahbod 9a6a33ccbe Merge pull request #216 from mhosken/master
Refactor graphite2 to make ovleraps into negative width spaces
2016-01-18 12:47:18 +01:00
Martin Hosken 146fe252c3 Refactor graphite2 to make ovleraps into negative width spaces 2016-01-16 17:24:00 -06:00
Behdad Esfahbod d05b783322 Fix compiler warning
Fixes https://github.com/behdad/harfbuzz/issues/212
2016-01-12 16:17:21 +00:00
Behdad Esfahbod d163dc18e6 Minor 2016-01-12 13:05:01 +00:00
Behdad Esfahbod 3e704521f6 [OT] Get list of lookup subtables once and loop through them
This speeds up shaping the Amiri font by over 15%.

This was primarily needed for my work on OpenType GX, since
we will be collecting only sublookups that are "active" for
current font instance; but it's a nice boost in general as
well.

We might, in the future, collect subtables in the lookup_accel.
That would also allow us to do a per-subtbale set-digest, which
should speed things up some more, specially for ContextChainFormat3
lookups...  Amiri, for example, contains one lookup with 53
subtables!
2016-01-11 17:38:41 +00:00
Behdad Esfahbod 97624d9244 [docs] Minor fixes. 2016-01-11 12:58:45 +00:00
Behdad Esfahbod a39ff95fce [coretext] Speed up CoreText font fallback
Fixes https://code.google.com/p/chromium/issues/detail?id=547912
2016-01-11 12:28:37 +00:00
Behdad Esfahbod 25671466d2 Add 9 reserved entries to hb_font_extents_t
Might add italic-angle, underline/strikethrough-position/thickness
in the future.  Do this before new struct goes into a release.
2016-01-07 19:13:47 +00:00
Behdad Esfahbod e6d5e4c310 [uniscribe] Fix negative advance
This happens with at least one test font I have.
2016-01-06 12:29:50 +00:00
Behdad Esfahbod 53c47c8582 Increase sanitize edit count from 8 to 32
See previous commit.
2016-01-05 13:26:20 +00:00
Behdad Esfahbod da2fcfdc51 Don't count fixing-up FeatureParams offset as error
The font Garamond Premier Pro Caption (and possibly many other
Adobe fonts), have many FeatureParamsSize tables with the old
wrong offset.  We handle fixing those up, but they were still
contributing to edit_count, and when I reduced HB_SANITIZE_MAX_EDIT
from 100 to 8 in 14c2de3218, these
fonts were now getting GPOS dropped and hence kerning disabled.

Fix, by not counting edits made towareds offset fix-up.  I'll
also increase edit count again, in the next commit.
2016-01-05 13:23:45 +00:00
Behdad Esfahbod d0adc80965 Check magicNumber in head table during sanitize 2016-01-02 13:25:36 +00:00
Khaled Hosny 9ab9f974d4 [docs] More buffers documentation 2016-01-01 20:38:21 +04:00
Behdad Esfahbod bfdf684f79 Merge pull request #205 from khaledhosny/more-docs
More docs
2015-12-30 22:20:14 +01:00
Nico Weber a7f0e25daf Remove unused HB_SHAPER_DATA_ENSURE_DECLARE lines.
The coretext_aat shaper delegates to the regular coretext_..._ensure() functions, so coretext_aat_..._ensure() functions defined by these macros are unused. The compiler warns about them, which in turn can confuse people to think that the coretext_aat_..._ensure() functions weren't called by accident.
2015-12-30 16:05:52 -05:00
Khaled Hosny 9cffe329f1 [docs] Typo 2015-12-30 22:50:08 +04:00
Behdad Esfahbod b758e5ea22 Merge pull request #203 from nico/patch-1
Remove unused `retry:` label.
2015-12-30 16:44:19 +01:00
Khaled Hosny fb192c263e [docs] A bit more buffers documentation 2015-12-30 17:59:01 +04:00
Khaled Hosny 8ab797c5b8 [docs] A bit more buffers documentation 2015-12-30 17:59:01 +04:00
Khaled Hosny f18d2226b6 [docs] Some documentation on buffers
Some of it (create, reference, destroy) are adapted from Cairo docs.
2015-12-30 17:59:01 +04:00
Khaled Hosny d7bf9d05c5 [docs] Fix comment syntax
To lower the number of gtk-doc warnings.
2015-12-30 17:58:53 +04:00
Nico Weber 8b1224f0ee Remove unused `retry:` label.
Fixes a -Wunused-label warning when building harfbuzz with clang -Wall.
2015-12-28 21:31:28 -05:00
Behdad Esfahbod fc38e6034c [layout] Collect coverage glyphs in PairPos
Apparently class=0 is used for ClassDef1.  See:
https://github.com/adobe-type-tools/afdko/issues/90
2015-12-23 14:50:53 +01:00
Behdad Esfahbod 8718dae818 [python] Hook up sample debugger 2015-12-18 19:53:40 +00:00
Behdad Esfahbod 0475ef2f97 [buffer] Add debugging, aka, message, API
Currently just announces lookup applications.  Message-API *will* change.
hb-shape / hb-view are updated to print-out messages to stder if --debug
is specified.
2015-12-18 19:29:06 +00:00
Behdad Esfahbod 9ea0aa43ac Don't deserialize positions if buffer has no positions 2015-12-18 17:30:57 +00:00
Behdad Esfahbod 862b1644e9 [use] Only set syllable-based topographical features if not Arabic-joining 2015-12-18 13:54:06 +00:00
Behdad Esfahbod 45b7ec3652 [indic] Followup fix for Malayalam context matching
We regeressed Malayalam in 508cc3d3cf
This brings down the failures to 198 (from 750).

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
MYANMAR: 1123865 out of 1123883 tests passed. 18 failed (0.00160159%)
2015-12-18 13:47:16 +00:00
Behdad Esfahbod 2813e3049a [indic] Update data tables to Unicode 8.0
Test stats remain unchanged, except for Malayalam, which we investigate:

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
MALAYALAM: 1047584 out of 1048334 tests passed. 750 failed (0.0715421%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)

Myanmar, compared to Windows 10 mmrtext.ttf:

MYANMAR: 1123865 out of 1123883 tests passed. 18 failed (0.00160159%)
2015-12-18 11:05:11 +00:00
Behdad Esfahbod fc06cff40f Remove HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT
The DEFAULT naming wasn't helpful, so just remove it.
2015-12-17 17:47:35 +00:00
Behdad Esfahbod 508cc3d3cf [indic] Allow context when matching for Malayalam new-spec
Test sequence:
	U+0995,U+09CD,U+09B0

With Nirmala shipped on Windows 10, this failed to form the below form.
Works now.

Reported by Sairus.
2015-12-17 17:31:17 +00:00
Behdad Esfahbod eaf1e93ef1 [uniscribe] Handle E_NOT_SUFFICIENT_BUFFER as well as E_OUTOFMEMORY
On Windows 10 we are seeing that other error message...

Test sequence: U+0995,U+-9CD,U+09B0
With Nirmala shipped on Windows 10, this failed to form the below form.
Works now.

Reported by Sairus.
2015-12-17 17:28:35 +00:00
Behdad Esfahbod 100fbeaf19 Fix ligature component of a mark happening after a ligature within a ligature!
Say, if we are ligating "A B_C m D", then previously 'm' was being
attached to 'B' in the combined A_B_C_D ligature.  Now we attach it
to 'C'.  No test for this though :(.
2015-12-17 15:23:09 +00:00
Behdad Esfahbod 2f02fc79a5 Improve ligature-component handling
We use three bits for lig_id these days, so we finally got a report of
two separate ligatures with the same lig_id happening adjacent to each
other, and then the component-handling code was breaking things.
Protect against that by ignoring same-lig-id but lig-comp=0 glyphs after
a new ligature.

Fixes https://github.com/behdad/harfbuzz/issues/198
2015-12-17 15:21:14 +00:00
Behdad Esfahbod 2ab0de9fbd [use] Fix halant detection
Before, we were just checking the use_category().  This detects as
halant a ligature that had the halant as first glyph (as seen in
NotoSansBalinese.)  Change that to use the is_ligated() glyph prop
bit.  The font is forming this ligature in ccmp, which is before
the rphf / pref tests.  So we need to make sure the "ligated" bit
survives those tests.  Since those only check the "substituted" bit,
we now only clear that bit for them and "ligated" survives.

Fixes https://github.com/behdad/harfbuzz/issues/180
2015-12-17 11:59:15 +00:00
Behdad Esfahbod 86bcbd65b0 [arabic] Use glyph advance width in apply_stch() instead of extents
That seems to be what Windows is doing, and makes more sense.
2015-12-17 11:04:33 +00:00
Behdad Esfahbod f11c11a1f1 Fix Since: tags for new API
e1d4d0f1db (commitcomment-15006653)
2015-12-16 17:08:36 +01:00
Steven R. Loomis a13b023dbf AIX fixes
- use '-w' instead of '\<...\>' for check-header-guards
  grep manpage says these are the same

- put '-q' first in the grep options

- move VAR into hb-private.hh

- hb-font-private.hh - use [VAR] instead of [] for variable array
2015-12-12 17:44:44 -08:00
Behdad Esfahbod 49e72634af Limit use of AIX intrinsics to IBM's compiler 2015-12-10 17:44:19 +01:00
Behdad Esfahbod e1d4d0f1db Merge branch 'font-extents'
Fixes https://github.com/behdad/harfbuzz/pull/165
2015-12-10 16:56:07 +01:00
Behdad Esfahbod 31fa389294 [ft] Use ftface->size->metrics for font extent info 2015-12-10 16:38:29 +01:00
Behdad Esfahbod 3ad16048fd [ot-font] Respect OS/2 fsSelection USE_TYPO_METRICS bit 2015-12-10 16:37:49 +01:00
Behdad Esfahbod 70b33edae7 Add atomic ops for AIX
Patch from Volker Simonis.
2015-12-10 15:54:42 +01:00
Behdad Esfahbod 98460779ba Remove final pause from Arabic shaper
Back in the old days, we used to apply 'calt' and 'cswh' in Arabic shaper,
with a pause in between.  Then we disabled the 'cswh' because Microsoft
disabled it, but forgot to remove the unnecessary pause.  Do that now.

This has the benefit that it fixes shaping with monbaiti from Windows 10.
In that version of that font, the lookups from 'calt' are duplicated in
'rclt', and Mongolian was changed to go through Universal Shaping Engine.
We still use the Arabic shaper for Mongolian.  With a pause after 'calt',
we were applying the duplicate lookups from 'calt' and 'rclt' twice.  It
happened to be the case that these lookups were NOT idempotent.  So we
were getting wrong shaping.  See thread "Windows 10 monbaiti.ttf upgrade
(5.01 -> 5.51) caused loss of diacritical marks when shaped with harfbuz"
on the mailing list.  This fixes that.
2015-12-07 21:38:47 +01:00
Behdad Esfahbod dee0fbf9e2 Merge pull request #192 from behdad/jfkthame-stch
[issue 191] Make apply_stch() give a more precise fit
2015-12-07 10:44:08 +01:00
Behdad Esfahbod 255df68012 Fix undefined behavior in cmp function
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=93274
2015-12-07 10:34:47 +01:00
Behdad Esfahbod fcf9e61bad Fix sorting order of ot_languages array
Looks like the original sort was wrongly done.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93275
2015-12-07 10:30:43 +01:00
Behdad Esfahbod 70952ddb5a Add test to make sure ot-languages array is sorted
Currently fails.  Part of
https://bugs.freedesktop.org/show_bug.cgi?id=93275
2015-12-07 10:28:46 +01:00
Behdad Esfahbod 8c37556f73 Merge pull request #134 from ebraminio/dwrite
Add working but less prefect DirectWrite backend
2015-12-07 09:34:58 +01:00
jfkthame a7ffe35358 Make apply_stch() give a more precise fit
This aims to make Syriac Abbr Mark sizing more accurate when repeating segments are used, by adding an extra repeat and tightening up the spacing slightly rather than leaving a shortfall corresponding to a partial repeat-width.
2015-12-05 17:47:37 +00:00
Behdad Esfahbod 8e5f902656 src/test.cc: wrong field printed
Fixes https://github.com/behdad/harfbuzz/issues/188
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=93182
2015-11-30 16:53:21 -08:00
Simon Cozens 6f2e6de1fa Get font ascender and descender metrics from OS/2 table. 2015-11-27 16:03:54 -05:00
Simon Cozens 097c998a0c Parse the OS/2 table. 2015-11-26 19:58:13 -05:00
Behdad Esfahbod 35d18585fc Fix a few docs blocks 2015-11-26 19:30:37 -05:00
Behdad Esfahbod 0e38c918b6 [introspection] Make scanner happy with HB_EXTERN 2015-11-26 19:26:26 -05: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 67a36a725e Fix vertical GPOS
This was brorken earlier, though, it's really hard to notice it.
Unlike the glyph_h_origin(), an unset glyph_v_origin() does NOT
mean that the vertical origin is at 0,0.

Related to https://github.com/behdad/harfbuzz/issues/187
2015-11-26 18:49:54 -05:00
Behdad Esfahbod c41c145c73 Make nil glyph_h_origin() function return true
Fixes https://github.com/behdad/harfbuzz/issues/187

Funcs implementations that have a non-zero horizontal origin must
implement the glyph_h_origin() callback, nothing new here.

Other implementations (all I know of!) can simply not set
glyph_h_origin() now.  I did that for hb-ot and hb-ft in
44f8275080, though that broke the
fallback shaper because the default was returning false...
2015-11-26 18:43:15 -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 b344af80ca Merge pull request #177 from fanc999/exporting
Enable use of compiler directives to export symbols
2015-11-24 15:30:27 -06:00
Martin Hosken 1979f6fedc Fix y_scale problems in hb-gr 2015-11-23 10:04:13 +07:00
Chun-wei Fan 835bbdc7c9 Public headers: Decorate public symbols with HB_EXTERN
This prepares the headers for exporting symbols using visibility
attributes or __declspec(dllexport), so that we do not need to maintain
symbols listing files, as this is what was and is done in GLib and GTK+.
2015-11-23 11:03:11 +08:00
ThePhD f798b8e2d6 c-style cast 2015-11-21 16:57:26 -05:00
Behdad Esfahbod a699181365 Merge pull request #176 from behdad/missing-braces
Add braces for subobject initializer in _hb_font_funcs_nil
2015-11-20 13:28:42 -08:00
Behdad Esfahbod 1dc32ea4d2 Whitespace 2015-11-20 13:24:19 -08:00
Behdad Esfahbod f94c0ecbb1 Define HB_MARK_AS_FLAG_T as a macro instead of using templates
The generic template operator overloading was causing more problems than it
solved.  Eg:

https://github.com/behdad/harfbuzz/pull/163
https://github.com/behdad/harfbuzz/issues/175

So, just use macros.

Fixes https://github.com/behdad/harfbuzz/issues/175
Fixes https://github.com/behdad/harfbuzz/pull/178
2015-11-20 13:21:29 -08:00
jfkthame f19c6db18e Add braces for subobject initializer in _hb_font_funcs_nil
To avoid triggering -Wmissing-braces; see https://bugzilla.mozilla.org/show_bug.cgi?id=1226175#c8
2015-11-20 08:43:49 +00:00
Behdad Esfahbod 9cc1ed4fa6 Do not allow recursiving to same position and same lookup
This is just to make it harder to be extremely slow.  There definitely
are ways still, just harder.  Oh well... how do we tame this problem
without solving halting problem?!

Fixes https://github.com/behdad/harfbuzz/issues/174
2015-11-19 12:39:09 -08:00
Behdad Esfahbod 13188cba7f Revert "Fix hang in OOM situations"
This reverts commit f0599db761.

Commit abadc1717d provides a better
fix for this.
2015-11-19 11:59:47 -08:00
Behdad Esfahbod 18e1c6b6ef Revert "Make sure we make progress in OOM situations"
This reverts commit 68b507a3c3.

Commit abadc1717d provides a better
fix for this.
2015-11-19 11:50:58 -08:00
Behdad Esfahbod 63fe05c8b1 Fix make distcheck 2015-11-18 23:52:51 -08:00
Behdad Esfahbod 37b40cd8a1 Fix another move_to assertion failure
If buf->idx is at end, don't set end past it...

Fixes https://github.com/behdad/harfbuzz/issues/173
2015-11-18 23:04:45 -08: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 ff16ef3379 Enable building a bounded version of the library for fuzzing
test/fuzzing/hb-fuzzer links against libharfbuzz-fuzzing.so now.
2015-11-18 16:27:32 -08:00
Behdad Esfahbod e0082ae60d Move things around 2015-11-17 18:42:13 -08:00
Chun-wei Fan 167c327177 Fix build on MSVC >= 2012
Use the DEFINE_ENUM_FLAG_OPERATORS macro in winnt.h on Visual Studio,
which defines the bitwise operators for the enumerations that we want to
mark as hb_mark_as_flags_t, which will take care of the situation on newer
Visual Studio (>= 2012), where the build breaks with C2057 errors as the
underlying types of the enumerations is not clear to the compiler when we
do a bitwise op within the declaration of the enumerations themselves.

Also disable the C4200 (nonstandard extension used : zero-sized array in
struct/union) and C4800 ('type' : forcing value to bool 'true' or 'false'
(performance warning)) warnings as the C4200 is the intended scenario and
C4800 is harmless but is so far an unavoidable side effect of using
DEFINE_ENUM_FLAG_OPERATORS.
2015-11-17 12:19:22 +08:00
Chun-wei Fan 4d27bb8746 hb-ot-shape-complex-arabic.cc: Fix build on Visual Studio
Visual Studio does not like declaring a enum variable within a for
statement, so fix the build by declaring the enum before doing the for
loop.
2015-11-16 23:04:36 +08:00
Behdad Esfahbod d5f0d7c9fb Merge pull request #167 from KonstantinRitt/unicode_cp_opt
Micro optimizations to UTF-16 and UTF-32 codecs
2015-11-07 07:50:58 -08:00
Behdad Esfahbod 04ff23e73d [arabic] Improve stretch length calculation
Err on the side of being too short, than too wide.  Reduces chance
of overlaps with neighboring glyphs.
2015-11-06 16:29:44 -08:00
Behdad Esfahbod 59821ab8b4 [arabic] Don't stretch over cased letters
Addresses
6e6f82b6f3 (commitcomment-14248516)
2015-11-06 16:27:44 -08:00
Behdad Esfahbod 5337db29af Revert "Don't process lookups if buffer is in error"
This reverts commit f92bd86cc8.

We don't want to be like cairo, where as soon as there's an error,
nothing works anymore.  So, lets process lookups as long as there's
no new memory needed.  That's also a model that hides fewer bugs.
2015-11-06 16:18:09 -08:00
Konstantin Ritt 529a933128 Micro optimization to hb_utf16_t and hb_utf32_t ::prev()
Implement reverse lookup instead of re-using next()
2015-11-07 02:00:04 +04:00
Konstantin Ritt 44ae9be7a2 Nano optimization to hb_utf16_t and hb_utf32_t ::next() 2015-11-07 01:58:38 +04:00
Behdad Esfahbod f1c4adbcd3 Fix typo 2015-11-06 09:46:05 -08:00
Behdad Esfahbod 68b507a3c3 Make sure we make progress in OOM situations 2015-11-06 00:09:26 -08:00
Behdad Esfahbod f0599db761 Fix hang in OOM situations
Fixes https://github.com/behdad/harfbuzz/issues/161
2015-11-05 23:55:51 -08:00
Behdad Esfahbod f92bd86cc8 Don't process lookups if buffer is in error 2015-11-05 23:52:29 -08:00
Behdad Esfahbod 4301703bdd Limit buffer max size growth
https://github.com/behdad/harfbuzz/issues/161
2015-11-05 23:44:59 -08:00
Behdad Esfahbod 6e6f82b6f3 Implement SYRIAC ABBREVIATION MARK with 'stch' feature
The feature is enabled for any character in the Arabic shaper.
We should experiment with using it for Arabic subtending marks.
Though, that has a directionality problem as well, since those
are used with digits...

Fixes https://github.com/behdad/harfbuzz/issues/141
2015-11-05 17:46:34 -08:00
Behdad Esfahbod c743ec5886 [ft] Fix extents with negative scales
Fixes https://github.com/behdad/harfbuzz/issues/162
2015-11-05 17:38:27 -08:00
Behdad Esfahbod 73fec3992a Reserve a few scratch-flags bits for complex shapers 2015-11-05 15:22:18 -08:00
Behdad Esfahbod 136863371c Add new shaper method postprocess_glyphs()
Unused currently.  To be used for Syriac stretch implementation.

https://github.com/behdad/harfbuzz/issues/141
2015-11-05 13:24:15 -08:00
Behdad Esfahbod e95eb23a4e Don't try zeroing marks by GDEF if there are no non-ASCII
This one is a hack, but should be ok.
2015-11-04 22:59:28 -08:00
Behdad Esfahbod 7fa54ed75a Don't try zeroing mark attachments by Unicode if there's no non-ASCII 2015-11-04 22:59:24 -08:00
Behdad Esfahbod 550bd14d2b Actually commit changes for previous commit 2015-11-04 22:58:58 -08:00
Behdad Esfahbod ff31b3c1b8 Skip GPOS cursive / attachment adjustmnent if none happened
I'm starting to really like how free these new scratch_flags are.
2015-11-04 22:47:30 -08:00
Behdad Esfahbod 0f407325f6 Minor 2015-11-04 22:28:44 -08:00
Behdad Esfahbod 497a6c2071 Skip forming clusters if text is all ASCII 2015-11-04 22:24:19 -08:00
Behdad Esfahbod 28de104f15 Move variable-sized struct member to end
Hopefully makes clang build happy
2015-11-04 22:03:09 -08:00
Behdad Esfahbod 5bc28b5f68 Optimize positioning for when h_origin is nil 2015-11-04 21:53:16 -08:00
Behdad Esfahbod 762770c964 Add font->has_...() to check for individual nil font funcs
Hopefully this wouldn't break any compiler.  There was some magic
moments to getting this to compile...
2015-11-04 21:49:19 -08:00
Behdad Esfahbod 88e9a9bcae Minor reshaping of hb_font_funcs_t implementation
In anticipation of further changes.  No functional changes.
2015-11-04 21:16:26 -08:00
Behdad Esfahbod a6a7715bac Comments 2015-11-04 20:51:21 -08:00
Behdad Esfahbod 6c48ec830f [ot] Remove font funcs that do nothing 2015-11-04 20:47:42 -08:00
Behdad Esfahbod 75ea2daa1d [ot] Port ot font funcs to allocated object 2015-11-04 20:43:59 -08:00
Behdad Esfahbod 44f8275080 [ft] Remove font funcs that do nothing 2015-11-04 20:43:43 -08:00
Behdad Esfahbod 7918c261ef [ft] Port ft font funcs to allocated object 2015-11-04 20:37:49 -08:00
Behdad Esfahbod da29b43794 Separate nil font-funcs from parent-peeking font-funcs
API change: all fonts created with hb_font_create() now inherit from
(ie have parent) hb_font_get_empty().
2015-11-04 20:22:44 -08:00
Behdad Esfahbod bee901b38e Optimize positioning direction calculations
It makes the binary smaller AND faster.  Yumm!
2015-11-04 19:28:17 -08:00
Behdad Esfahbod e3e4bb011a Don't do fractions if buffer is ASCII-only 2015-11-04 18:58:02 -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 14c2de3218 Limit max edits during sanitize to 8
Used to be 100.  If a tabe needs more than one or two edits, it's
probably completely bogus...

Might help with speeding up fuzzing for
https://github.com/behdad/harfbuzz/issues/157
2015-11-04 18:00:57 -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 aa7044de0c Generalize flags types 2015-11-04 16:25:57 -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 8565839480 Protect against possible invalid-memory access after OOM 2015-11-04 14:46:52 -08:00
Behdad Esfahbod 4cc80bed25 Fix typo!
Ouch!  Fortunately that function was unused.
2015-11-04 14:46:10 -08:00
Behdad Esfahbod 9ac4b9656d Add Unicode space category
Unused so far.
2015-11-04 14:19:25 -08:00
Behdad Esfahbod 8249ec3f86 Make top-byte of unicode_props available to be used differently per-GC 2015-11-04 13:26:17 -08:00
Behdad Esfahbod cc5d3a3388 Towards using top-byte of unicode-props for more things 2015-11-04 13:22:33 -08:00
Behdad Esfahbod 2f38dde5a1 Add _hb_glyph_info_is_unicode_mark()
Unused right now.
2015-11-04 13:17:33 -08:00
Behdad Esfahbod 90d75f93bb Tighten ccc-setting a bit and document it 2015-11-03 12:58:12 -08:00
Behdad Esfahbod df698f3299 [ot-font] Fix hmtx table length checking, *again*
Exactly the same problem that I fixed in
63ef0b41dc

I rewrote the table checking yesterday in
67f8821fb2
and introduced the exact same issue again. :(
Good thing we have ongoing fuzzing going now.  Was discovered
immediately by libFuzzer.  Thanks kcc!

https://github.com/behdad/harfbuzz/issues/139#issuecomment-153449473
Fixes https://github.com/behdad/harfbuzz/issues/156
2015-11-03 12:15:12 -08:00
Behdad Esfahbod ed2024ef93 [perf] Micro-optimize 2015-11-02 18:03:38 -08:00
Behdad Esfahbod 76a5310a83 Remove irrelevant comment
I tried moving the is_default_ignorable() function to an INTERNAL
function.  That made the binary size grow by 5k AND things got a
tad bit slower!
2015-11-02 17:52:45 -08:00
Behdad Esfahbod 8259669fbd Minor 2015-11-02 17:44:05 -08:00
Behdad Esfahbod 9382c471ea Combine unicode_props0/1 into a uint16
Slightly faster.  In prep for more changes.
2015-11-02 17:36:51 -08:00
Behdad Esfahbod 7127718545 [perf] Only call combining_class() for marks
Saves some time.  Also preparing for reusing the ccc byte for other stuff.
2015-11-02 17:27:48 -08:00
Behdad Esfahbod 5ba450407b Make max context-length and max nesting level configurable
...at compile time.
2015-11-02 15:43:39 -08:00
Behdad Esfahbod 67f8821fb2 [ot] Make bad-hmtx handling match FreeType
Also route fuzzing-related tests through hb-ot-font, to reduce dependency
on FreeType behavior for badly-broken fonts.  Fixes failing test with
FreeType master.
2015-11-02 15:37:29 -08:00
Behdad Esfahbod 672ca3b4e6 Use templates for making sure expression is constant 2015-10-26 14:05:05 -07: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 ce889189c1 Fix two more -Wshadow warnings
https://bugzilla.mozilla.org/show_bug.cgi?id=1215894
2015-10-21 11:23:12 -02:00
Behdad Esfahbod 4a6b1eedbb Fix one more -Wshadow warning
https://bugzilla.mozilla.org/show_bug.cgi?id=1215894
2015-10-21 11:20:55 -02:00
Behdad Esfahbod 6f932bc8f9 Fix a few more -Wshadow-local warnings
https://bugzilla.mozilla.org/show_bug.cgi?id=1215894
2015-10-21 11:16:49 -02:00
Behdad Esfahbod b90cb366d7 Fix one -Wshadow-compatible-local warning
From https://bugzilla.mozilla.org/show_bug.cgi?id=1215894
2015-10-21 11:13:21 -02:00
Behdad Esfahbod 50e5750bd8 Avoid unnecessary cast to 64-bit
Fixes https://github.com/behdad/harfbuzz/issues/146

Or I think it should.
2015-10-21 11:10:40 -02:00
Behdad Esfahbod 305d2fbf5a Add HB_FALLTHROUGH
Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411
2015-10-21 11:04:28 -02:00
Ebrahim Byagowi f35b3e931d Add a prototype of DirectWrite as a shaping backend 2015-10-20 22:20:47 +03:30
Behdad Esfahbod ca97ea7aa2 [ft] Revert change-of-behavior of hb_ft_font_create() introduced in 1.0.5
The default FreeType load flags where changed from FT_LOAD_NO_HINTING
to FT_LOAD_DEFAULT in 2a9627c564.
This is crashing HarfBuzz-enabled FreeType as I suppose it causes
infinite recursion between HB and FT autohinter...

Revert the behavior change.

Fixes https://github.com/behdad/harfbuzz/issues/143
2015-10-15 20:20:22 -03:00
Behdad Esfahbod 63ef0b41dc [ot-font] Fix hmtx wrong table length check
Discovered by libFuzzer.  Ouch!

https://github.com/behdad/harfbuzz/issues/139#issuecomment-148289957
2015-10-15 12:54:28 -03:00
Behdad Esfahbod 613e630617 Reduce max nesting level from 8 to 6
We probably should implement better system to catch cyclic lookups.
But for now, this speeds up worst case behavior with broken fonts
considerably without compromising legitimate usecases.

https://github.com/behdad/harfbuzz/issues/139#issuecomment-147788447
2015-10-13 23:33:28 -03:00
Behdad Esfahbod ed13e2ce50 [ot-font] Fix leak
https://github.com/behdad/harfbuzz/issues/139#issuecomment-147616887
2015-10-13 10:32:56 -03:00
Behdad Esfahbod f966649747 Fix another memory access issue discovered by libFuzzer
Fixes https://github.com/behdad/harfbuzz/issues/139#issuecomment-146984679
2015-10-13 00:30:50 -04:00
Behdad Esfahbod cc6ea308d4 Extern "C" custom-allocator declerations 2015-10-12 17:21:52 -04:00
Behdad Esfahbod 50f489a0a0 Typo 2015-10-11 20:59:29 -04:00
Behdad Esfahbod ee9b0b6cb5 Fix another sanitize bug
Also discovered by "libFuzzer".
2015-10-09 14:23:15 -04:00
Behdad Esfahbod f396fbb000 Fix return value of sanitize when subformat is not readable
This is a fix on top of the previous issue fixed in
c917965b9e.

This was caught by "libFuzzer" testing.
2015-10-09 12:25:55 -04:00
Behdad Esfahbod 77a1a2bc18 Add hb_dispatch_context_t 2015-10-09 12:20:58 -04:00
Behdad Esfahbod 3e905e396b Add hb_font_set_parent()
No reason to not have it.  Makes life easier later.
We (hb-ft, hb-ot-font, etc) can use this API to inject new
parent into a font...
2015-10-08 12:51:02 -04:00
Behdad Esfahbod edeb3dabf4 [ft] Add version for new API 2015-10-08 12:47:15 -04:00
Behdad Esfahbod 2a9627c564 [ft] API: Add hb_font_[sg]et_load_flags() API
This changes the default load_flags of fonts created using
hb_ft_font_create() from NO_HINTING to DEFAULT.  Hope that doesn't
break too much client code.

Code calling hb_ft_font_set_funcs() is unaffected.
2015-10-07 17:39:37 -04:00
Behdad Esfahbod 3224a594dc Minor 2015-10-07 17:33:02 -04:00
Behdad Esfahbod 52b418555b Allow compiling with custom allocators
User can define hb_malloc_impl, etc, to name of custom allocator functions
that have the same signature as malloc.
2015-10-03 13:20:55 +01:00
Behdad Esfahbod 88da7bba9f Default font scale to face upem
Makes for a better default and avoids nasty inheritance issues.
See mailing list thread "Default hb_font_t scale".
2015-10-02 14:38:20 +01:00
Behdad Esfahbod 1866e17114 Make hb_font_create_sub_font() NOT make parent immutable
We don't rely on that.  However, whenever hb_font_make_immutable()
is called, it makes its parenting chain immutable.
2015-10-02 14:21:29 +01: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 a5efaac4ff Replace a couple of malloc()s with calloc() 2015-10-02 08:02:29 +01:00
Behdad Esfahbod 26ba4d1e1f Fix segfault with empty buffer in hb_shape_plan_execute()
Move the empty-buffer check from hb_shape_full() to hb_shape_plan_execute().

Reported by Simon Cozens.
2015-10-02 07:25:52 +01:00
Behdad Esfahbod b47159011c Define return_trace()
Not functional change (expected!).
2015-09-29 14:57:02 +01:00
Behdad Esfahbod c917965b9e Add missing returns
Fixes possible invalid read of two bytes.

Reported by Behzad Najjarpour Jabbari, Secunia Research.
2015-09-29 14:45:35 +01:00
Behdad Esfahbod f3159ba514 Micro-optimize hb_language_from_string()
As measured / improved by Benson Limketkai.
2015-09-29 14:34:56 +01:00
Sascha Brawer f2ad935e19 Handle language tags that indicate phonetic IPA transcription
The BCP-47 registry defines a variant subtag "fonipa" that can be used
in combination with arbitrary other language tags. For example,
"rm-CH-fonipa-sursilv" indicates the Sursilvan dialect of Romansh
as used in Switzerland, transcribed used the International Phonetic
Alphabet.

http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2015-09-29 14:32:06 +01:00
Behdad Esfahbod b8811429b6 Fix Since tags
Fixes https://github.com/behdad/harfbuzz/issues/103
2015-09-03 15:53:22 +04:30
Behdad Esfahbod 5d74ff02ab Fix Since: version tags on font and face APIs
A while back we marked every API as version:1.0.  We should fix them all
to reflect real version they were introduced.  This is a start.

Patch from Nikolay Sivov.
2015-09-03 14:55:59 +04:30
Behdad Esfahbod 5828c45d7a [indic] Add comments to merge_clusters calls 2015-09-01 16:34:12 +01:00
Behdad Esfahbod bdc8215949 [thai] Respect cluster-level > 0 2015-09-01 16:24:54 +01:00
Behdad Esfahbod 5b31fe383e [use] Merge /before/ reordering 2015-09-01 16:24:34 +01:00
Behdad Esfahbod 0d438f89bd [hangul] Merge /before/ reordering 2015-09-01 16:24:13 +01:00
Behdad Esfahbod f883de664f [OT] Merge /before/ reordering 2015-09-01 16:23:40 +01:00
Behdad Esfahbod c403d63200 [myanmar] Use buffer->sort() to sort cluster
This can possibly produce more granular clusters.
2015-09-01 16:15:25 +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 93099748e3 Minor 2015-09-01 16:11:27 +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
Behdad Esfahbod 326b5ebf57 Poison freed objects such that double-free is detected
Previously we were setting refcount of freed objects to the inert value, which
was harmful because it caused further destroy()s of the freed object to NOT
call free() and hence hide the bug.  Indeed, after eb0bf3ae66 test-object
was double-free'ing objects and this was never caught on Linux.  It only was
caught as crashing on Mac.

Now we poison refcount upon freeing and check that it's valid whenever reading
it.  Makes test-object fail now.
2015-08-30 17:29:21 +01:00
Behdad Esfahbod 6578575cc8 [GPOS] Fix cursive connection with mix of RTL and non-RTL lookups
See thread "Issue with cursive attachment" started by Khaled.
Turned out fixing this wasn't as bad as I had assumed.  I like the
new code better; we now have a theoretical model of cursive
connections that is easier to reason about.
2015-08-25 20:29:36 +01:00
Behdad Esfahbod 58f2a73fb9 [GPOS] Rewrite cursive attachment slightly differently
In anticipation for upcoming fix for bug reported by
Khaled in thread "Issue with cursive attachment".
2015-08-25 18:58:24 +01:00
Behdad Esfahbod fdd1770e00 Add API/cmdline to show glyph extents when serializing buffer
New API: HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS

hb-shape now accepts --show-extents.

Patch from Simon Cozens.
2015-08-24 13:49:55 +01:00
Behdad Esfahbod 2cee5b68a0 [ot-font] Fix short-offset calculation 2015-08-24 13:45:12 +01:00
Behdad Esfahbod b50fcfa829 [ot-font] Implement glyph_extents() for TrueType fonts
This brings ot-fonts into almost-complete shape and mostly in par with
ft font.
2015-08-23 14:42:20 +01:00
Behdad Esfahbod 0299b45000 Make BYTE a real type 2015-08-21 12:44:36 +01:00
Behdad Esfahbod ed6962c795 [coretext] Use i32 instead of u32 as well
Shouldn't cause *any* functional changes, but is more correct.
2015-08-20 15:39:53 +01:00
Behdad Esfahbod 163c435f18 [uniscribe] Fix negative offsets
Ouch!
2015-08-20 15:39:06 +01:00
Behdad Esfahbod 958c268fa3 [coretext] Add TODO item 2015-08-19 13:22:12 +01:00
Behdad Esfahbod 7c5bee09d9 [uniscribe] Fix font scale handling
By default shape at upem (or ppem), and scale results.
Similar to work done in CoreText backend, but using upem as default.
2015-08-19 13:20:31 +01:00
Behdad Esfahbod 902e74a098 Commented-out code to print buffer before each lookup
To be turned into a useful HB_DEBUG_SHAPE infrastructure...
2015-08-18 18:55:03 +01:00
Behdad Esfahbod 75504a5048 Allow serializing buffer with output-buffer being used
Ie, don't call get_positions() if positions are not
requested for serialization.
2015-08-18 18:47:02 +01:00
Behdad Esfahbod e47b772a56 [ot] Change buffer content type right after we map to glyphs
Needed for upcoming debug output changes.
2015-08-18 18:42:47 +01:00
Behdad Esfahbod ddd6bf12f1 Don't declare dependency on freetype in harfbuzz.pc
See comments.
2015-08-18 15:55:09 +01:00
Behdad Esfahbod 2c8b3b2e53 [debug] Print lookup index in debug-apply output 2015-08-18 14:36:43 +01:00
Behdad Esfahbod 50ad7788ee [coretext] Remove assert that kicks in on Mac OS 10.6
http://crbug.com/419769
2015-08-18 10:22:16 +01:00
Behdad Esfahbod 2b646fa07f Remove unused function 2015-08-17 16:03:28 +02:00
ThePhD 23237b0279 Last apparent boolean fix! 2015-08-14 01:19:08 -04:00
ThePhD 5c99cf93d6 Merge branch 'master' into vc++-fixes 2015-08-14 01:02:00 -04:00
Behdad Esfahbod 539a610e2e Add Libs.private and Requires.private to harfbuzz.pc
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=64501
2015-08-11 12:58:49 +02: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
jfkthame 9099e48e29 Don't rely on .cluster field in fallback_position
Fixes tests/cluster.

Fixes https://github.com/behdad/harfbuzz/pull/123
2015-08-08 18:03:38 +02:00
Behdad Esfahbod bd22a5cfae Bug 91559 - HarfBuzz 1.0.1: Inconsistent DLL files specified/created...
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=91559
2015-08-07 11:13:27 +02:00
Behdad Esfahbod f1c20e1ba5 [USE] Fix out-of-bounds static array access 2015-07-27 12:16:02 +02:00
Behdad Esfahbod 260442346a 1.0.0 2015-07-26 23:39:10 +02:00
Behdad Esfahbod df6cb84449 Merge branch 'use' 2015-07-26 19:40:55 +02:00
Behdad Esfahbod 23e56e088a Fix broken sentence 2015-07-25 17:38:21 +02:00
Grigori Goronzy 91a2e5d287 Update UCDN to upstream commit 8af93f30
This adds support for Unicode 8.0 and fixes a bug with wrong properties
for ranges of codepoints.
2015-07-25 17:32:16 +02:00
Behdad Esfahbod 0f98fe88f4 [ot] Search globally for 'vert' feature if not found in specified script/lang
Fixes https://github.com/behdad/harfbuzz/issues/63
2015-07-23 11:52:11 +01:00
Behdad Esfahbod f327aacfa1 [ot] Minor 2015-07-23 11:32:59 +01:00
Behdad Esfahbod d78463c801 Minor debug output fix 2015-07-23 10:11:35 +01:00
Behdad Esfahbod d99f50bde0 Add missing TRACE_RETURN 2015-07-23 10:08:48 +01:00
Behdad Esfahbod 2dc8e3f470 [ot] Add missing return! 2015-07-23 10:07:21 +01:00
Behdad Esfahbod 8cfbc304ee Fix hide-default-ignorables after f0010dfd01
We can't delete things before hb_ot_layout_position_finish().  So,
just zero the advance before it, and remove later.
2015-07-22 18:41:10 +01:00
Behdad Esfahbod 2dbd3d29d6 Fix hide-ignorables if font doesn't have space glyph
Was broken by 82b521aeb7, as we have
positioning data by then and can't use the output buffer.  Ouch!
2015-07-22 18:29:47 +01:00
Behdad Esfahbod 4ba796b26e Refactor _hb_glyph_info_is_default_ignorable() 2015-07-22 17:41:31 +01:00
Behdad Esfahbod f0010dfd01 [ot] Hide default-ignorables before finishing off positioning
For example, fixes the following sequence with Arial XP:
628 25cc 651 25cc 64e 3a 20 628 651 34f 64e
628 25cc 64e 25cc 651 3a 20 628 64e 34f 651

Discovered as part of:
https://bugs.freedesktop.org/show_bug.cgi?id=85873
2015-07-22 17:36:23 +01:00
Behdad Esfahbod 376d587f36 Implement more granular cluster-merging
TODO: Documentation.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71445
2015-07-22 16:51:12 +01:00
Behdad Esfahbod a60e2cfa39 [ot] Don't rely on cluster numbers for ensure_native_direction() 2015-07-22 15:49:08 +01:00
Behdad Esfahbod 701112dad9 [ot] Simplify form_clusters() 2015-07-22 15:42:20 +01:00
Behdad Esfahbod 7b8b63adc5 [ot] Don't mirror character if font doesn't support mirrored character! 2015-07-22 15:24:26 +01:00
Behdad Esfahbod 97d7c3a100 [graphite2] Fix bunch of stuff
Based on patch from Martin Hosken, with review from Jonathan and I.
2015-07-22 14:28:25 +01:00
Behdad Esfahbod ea7f8414e3 [graphite2] Enlarge buffer for output glyphs! 2015-07-22 13:53:45 +01:00
Behdad Esfahbod 9cd59db1af [USE] Implement topographical features for non-Arabic-joining scripts
This works per-syllable as per the spec, but we think it should be per
spacing/base/??? glyph instead.
2015-07-22 13:31:07 +01:00
Behdad Esfahbod ecb0b24ef3 Use foreach_cluster in Indic shaper 2015-07-22 12:02:09 +01:00
Behdad Esfahbod 56f71ff988 Use foreach_syllable in Myanmar shaper 2015-07-22 11:58:11 +01:00
Behdad Esfahbod ac596511a8 Add foreach_syllable
Use it in USE.
2015-07-22 11:54:02 +01:00
Behdad Esfahbod 8ba9e68968 [USE] Do Arabic-like shaping 2015-07-22 11:17:34 +01:00
Behdad Esfahbod 9daf2dfb6b Add hb-ot-shape-complex-arabic-private.hh 2015-07-22 10:49:13 +01:00
Behdad Esfahbod a51a661fe1 [USE] Only reorder the first component of a split left mark 2015-07-21 18:24:21 +01:00
Behdad Esfahbod a08a278b15 [USE] Don't compose split matras
Same logic as in Indic shaper.
2015-07-21 18:09:40 +01:00
Behdad Esfahbod 21cb08a417 Remove unused SEA shaper 2015-07-21 17:47:06 +01:00
Behdad Esfahbod db1e9cdd41 Retire SEA shaper in favor of USE 2015-07-21 17:46:06 +01:00
Behdad Esfahbod 87dde9c647 [USE] Only use USE shaper if script system is not DFLT
Same logic as Indic and SEA.
2015-07-21 17:31:43 +01:00
Behdad Esfahbod 29832d797f Route misc untested scripts through USE shaper instead of Indic
These were never tested with Indic shaper, and indeed wouldn't work there
because they didn't have their viramas and other config defined.  They are
all also supported by MS through USE, so route them there.
2015-07-21 17:24:18 +01:00
Behdad Esfahbod 40c4a991c7 [USE] Implement dotted-circle
This makes USE feature-complete as far as the Indic-like features
are concerned.
2015-07-21 17:14:54 +01:00
Behdad Esfahbod 7ce03ebe7c [USE] Move pref 2015-07-21 16:55:26 +01:00
Behdad Esfahbod 2d4b62ead9 [USE] Fix-up variation selectors and word joiner in table 2015-07-21 16:46:37 +01:00
Behdad Esfahbod ad7178227f [USE] Use a couple warnings 2015-07-21 16:43:27 +01:00
Behdad Esfahbod a85c4da9b1 [USE] Move rphf 2015-07-21 16:07:10 +01:00
Behdad Esfahbod 5b5617e066 Add FLAG_UNSAFE()
Unused right now.
2015-07-21 15:52:15 +01:00
Behdad Esfahbod f8160a4959 Add FLAG_SAFE() for values known to be small-enough
And add check to FLAG()
2015-07-21 15:50:02 +01:00
Behdad Esfahbod 366aeaad00 Add note re ASSERT_STATIC_EXPR_ZERO() 2015-07-21 15:45:48 +01:00
Behdad Esfahbod d6adca9fbb Remove unused macro ASSERT_STATIC_EXPR() 2015-07-21 15:17:27 +01:00
Behdad Esfahbod 1025e1a9e7 Use unsigned in FLAG() 2015-07-21 15:05:35 +01:00
Behdad Esfahbod cf59c7589c [USE] Use use_category() for rphf/pref memory 2015-07-21 14:51:45 +01:00
Behdad Esfahbod 595936ec25 [USE] Hook of rphf and pref custom processing
Still no reordering.
2015-07-21 14:15:35 +01:00
Behdad Esfahbod ba72801325 [USE] Add CGJ to table 2015-07-21 11:57:23 +01:00