Commit Graph

3711 Commits

Author SHA1 Message Date
Behdad Esfahbod 1ba767cd4e [MATH] Move API from hb-ot-layout.h to hb-ot-math.h 2016-09-26 21:57:14 +02:00
Behdad Esfahbod 97b72da600 Whitespace 2016-09-26 21:53:25 +02:00
Behdad Esfahbod 559eb56447 [MATH] Wire up get_glyph_assembly() 2016-09-26 21:46:05 +02:00
Behdad Esfahbod 353f455af7 [MATH] Wire up get_glyph_variants() 2016-09-26 21:25:00 +02:00
Behdad Esfahbod 7fe0e28c22 [MATH] Start fleshing out glyph variant API 2016-09-26 17:51:47 +01:00
Behdad Esfahbod 1f3327f210 [MATH] Clean up math variants 2016-09-26 16:10:08 +01:00
Frédéric Wang 51da7a1cd6 MATH table: Add API to access math variants. 2016-09-26 15:18:16 +01:00
Behdad Esfahbod 8d58e3433e [MATH] Fix get_kerning() with negative y-scale 2016-09-26 13:39:58 +01:00
Behdad Esfahbod 94f5df5626 [MATH] Clean up get_kerning() 2016-09-26 13:31:47 +01:00
Behdad Esfahbod 17ff30e9af [MATH] Clean up get_top_accent_attachment()
Note, the function now returns "half of horizontal advance width"
if top accent attachment for glyph is not explicitly defined.
This is what the spec requires.  Updated tests.
2016-09-26 12:21:27 +01:00
Behdad Esfahbod 8bcf517fe5 [MATH] Clean up get_italics_correction() 2016-09-26 12:13:14 +01:00
Behdad Esfahbod 06003f71ba [MATH] Clean up a bit more 2016-09-26 12:07:29 +01:00
Behdad Esfahbod 54c0cc38fb [MATH] Clean up get_math_constant implementation 2016-09-26 11:56:40 +01:00
Behdad Esfahbod 8a8cfad9a0 [MATH] Cleanup previous commit a bit 2016-09-26 11:51:07 +01:00
Frédéric Wang d7182d1296 MATH Table: Add API to access glyph info. 2016-09-26 11:32:25 +01:00
Behdad Esfahbod 6fd2fe418d [MATH] Fixup math constants commit a bit more 2016-09-26 11:24:39 +01:00
Behdad Esfahbod 1a381153a2 [MATH] Fixups for math constants commit 2016-09-26 11:15:59 +01:00
Frédéric Wang 319ff59161 MATH Table: Add API to access math contants. 2016-09-26 10:49:09 +01:00
Behdad Esfahbod 4d3892e9b0 [MATH] Fixups for previous commit 2016-09-26 10:45:58 +01:00
Frédéric Wang 5fbcb992bd MATH Table: Add API to check availability of math data. 2016-09-26 10:27:33 +01:00
Ebrahim Byagowi fc4e671f31 [coretext] Use intended coretext version check logic (#315) 2016-09-09 11:58:28 -07:00
Khaled Hosny 4867734528 Try to unbreak building on older macOS again (#314) 2016-09-07 18:44:37 -07:00
Dominik Röttsches b717cd7be5 Do reconfigure the cascade list for Emoji font on OS X 10.9.5 (#313)
This seems to fix crash issues on 10.9.5 reported on Chrome, compare
crbug.com/549610
2016-09-07 13:56:57 -07:00
Dominik Röttsches 67e9fdf427 Blacklist Padauk 2.80 and 3.00 (#311)
According to comments in issue #305 broken GDEF tables lead
to incorrect rendering of Latin characters. Blacklisting
this font.
2016-09-05 01:27:25 -07:00
Ebrahim Byagowi 5362ce6a64 [dwrite] Minor, don't include unnecessary headers (#309) 2016-09-01 08:35:45 -07:00
Khaled Hosny 3d976d20f1 Show the shaper name in the debug message (#306) 2016-08-27 16:38:42 +03:00
Sascha Brawer e7ecbba2cc Support Americanist Phonetic Notation
OpenType language system tag: `APPH`
https://www.microsoft.com/typography/otspec/languagetags.htm

IETF BCP47 variant tag: `fonnapa`
http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2016-08-18 14:13:26 +02:00
Khaled Hosny a0f1b44b6c [coretext] Blind fix for build on MacOS 10.9 2016-08-16 03:09:04 +02:00
Behdad Esfahbod 37f21bdbb7 Map Macao to ZHH lang tag
Fixes https://github.com/behdad/harfbuzz/issues/300
2016-08-08 17:57:06 -07:00
Behdad Esfahbod 09c7a2d6bf Limit bits-per-feature to eight
Limits number of alternatives per glyph per feature to 255, so be it.
That's better than possibly breaking shaping because of one bad feature
value.
2016-08-08 17:29:30 -07:00
Behdad Esfahbod 333173103b Fix sign of shift operators
This one:

  map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);

before the fix, the shift was done as an int, causing overflow
if it ever got to 1 << 31.  Sprinkle 'u's around.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
2016-08-08 17:28:14 -07:00
Behdad Esfahbod 10a0d4aa22 Map zh-Hant-HK to ZHH
Fixes https://github.com/behdad/harfbuzz/issues/300
2016-08-08 16:51:08 -07:00
Behdad Esfahbod 489acf6c31 [coretext] "Fix" crashes on CoreText < 10.10
Fixes https://github.com/behdad/harfbuzz/issues/297
2016-07-22 17:41:43 -07:00
Behdad Esfahbod 08c08af2f9 [ucdn] Update to Unicode 9.0.0
Fixes https://github.com/grigorig/ucdn/issues/12
2016-07-21 01:35:30 -07:00
jfkthame f3f6c1ccbf Blacklist GDEF tables of more fonts
This is based on bug reports that have been filed against Firefox since it
updated to a version of harfbuzz that uses zeroing by GDEF rather than by
Unicode. I'm sure there are a bunch more font versions that should also be
included; these are just the ones I have on hand and have confirmed as having
bad GDEF data.

Given how the list here is growing, I think we should reconsider the approach,
and perhaps revert to zeroing by Unicode instead.

Fixes https://github.com/behdad/harfbuzz/issues/264
Fixes https://github.com/behdad/harfbuzz/pull/266
2016-07-21 01:15:12 -07:00
Behdad Esfahbod 34f9aa582c Implement symbol cmap in ft and ot fonts
Fixes https://github.com/behdad/harfbuzz/issues/236
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=627953
2016-07-20 02:35:54 -07:00
Behdad Esfahbod 6363d7df28 Clean up buffer area when rewinding
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=614647
If allocation fails, we might be leaving junk behind.  At least
clear it up.
2016-07-20 01:44:47 -07:00
Behdad Esfahbod f80c34eb55 Whitespace 2016-07-12 11:18:26 -07:00
Ebrahim Byagowi 874421203e [coretext] Speculative fix for CoreText nullptr access (#288) 2016-07-11 16:19:21 -07:00
Birunthan Mohanathas 6bf9db4f1e [ft] Fix unsafe cast of FT_Done_Face in hb_ft_{face,font}_create_referenced (#289)
Prior to this change the function `FT_Error FT_Done_Face(FT_Face *)` was
called through a pointer with the signature `void (void *)` resulting in
undefined behaviour.
2016-07-11 13:38:23 -07:00
Steve Lhomme 0b8f3ab022 clang in MSVC mode doesn't like when we redefine __attribute__ (#283) 2016-07-11 12:57:26 -07:00
Khaled Hosny e4d451ee55 [introspection] Fix hb_tag_from_string annotation 2016-07-02 00:04:57 +02:00
Behdad Esfahbod d3e2a06b0f [python] Use utf-32 / utf-16 based on build of Python
Fixes https://github.com/behdad/harfbuzz/pull/271
2016-06-30 11:01:22 -07:00
Behdad Esfahbod fc9de44a03 Comments 2016-06-30 09:46:52 -07:00
Dominik Röttsches 1bea49eb4b Merge branch 'master' into conflictingFontFix 2016-06-29 12:10:41 +02:00
Behdad Esfahbod 70e72e5f61 [gobject] Fix a few warnings
Part of https://github.com/behdad/harfbuzz/issues/277
2016-06-28 21:15:36 -07:00
Behdad Esfahbod ae9054c740 Revert "use utf32" 2016-06-28 21:14:38 -07:00
Dominik Röttsches 7aa3631dd0 Merge branch 'master' into conflictingFontFix 2016-06-28 09:52:18 +02:00
Ebrahim Byagowi 8179ff5d7b [dwrite] Don't allocate more than needed
Addressing Nikolay Sivov reviews on harfbuzz mailing list
2016-06-27 03:58:49 +04:30
Ebrahim Byagowi 07b724f341 [dwrite] Delete remained objects
No longer noticeable memory increase on create/destroy iterations,
highly better than current state of uniscribe backend
2016-06-24 14:29:24 +04:30
Ebrahim Byagowi be565d1714 [dwrite] Release allocated blob on face destroy
This reduces memory consumption of my iterated font create/destroy cycle test
significantly and makes it much better than uniscribe backend even
2016-06-24 11:46:53 +04:30
Ebrahim Byagowi f3f0ea980a [dwrite] Remove ifdefs without breaking execution on old Windows versions 2016-06-23 17:26:55 +04:30
Ebrahim Byagowi 6b861dbd8b [dwrite] Use stream font loader instead GDI interop
With help of
https://dxr.mozilla.org/mozilla-central/source/gfx/2d/NativeFontResourceDWrite.cpp
2016-06-23 15:57:34 +04:30
Dominik Röttsches f7da0486ed Merge branch 'master' into conflictingFontFix 2016-06-20 10:25:43 +03:00
Kelvin 07461d06d2 Use UTF-32 in Python sample 2016-06-19 01:46:38 +03:00
Dominik Röttsches a0223274b9 Discard reconfigured CTFont if URL changes
Fixes https://github.com/behdad/harfbuzz/issues/267
2016-06-16 14:19:39 +02:00
Behdad Esfahbod 4b8de1ea80 Round, not truncate, when scaling values
Fixes https://github.com/behdad/harfbuzz/issues/255
2016-06-06 23:08:54 -07:00
Behdad Esfahbod bed201d2b8 Update for latest Unicode 9 data files 2016-06-06 14:14:24 -07:00
Behdad Esfahbod aba4b0ca52 Add TODO 2016-06-01 16:57:29 -07:00
Behdad Esfahbod a2b03de5b3 [myanmar] Handle U+AA74..U+AA76
Fixes https://github.com/behdad/harfbuzz/issues/218
2016-05-06 17:56:07 +01:00
Behdad Esfahbod 9b6312f945 [use] Update to draft spec from Andrew Glass from August 2015 2016-05-06 17:41:49 +01:00
Behdad Esfahbod 3e4e7616a8 [use] Add a catch-all clause to the machine 2016-05-06 17:28:25 +01:00
Behdad Esfahbod d04e461fe3 [use] Fix 'Number-joiner terminated cluster' to use HN instead of H
From draft update to USE.
2016-05-06 17:17:00 +01:00
Behdad Esfahbod 359dead960 Allow MultipleSubst to delete glyph
Fixes https://github.com/behdad/harfbuzz/issues/253

Hopefully we got the logic right.
2016-05-06 16:19:19 +01:00
Behdad Esfahbod 3c1666cfb5 [indic] Remove more unused logic after Javanese is gone 2016-05-06 16:05:07 +01:00
Behdad Esfahbod 8b5d6e755b [indic] Remove unused Javanese bits 2016-05-06 15:59:27 +01:00
Behdad Esfahbod 30e6e29f0f [indic/use] Move Javanese from Indic shaper to USE
Fixes https://github.com/behdad/harfbuzz/issues/243

With javatext.ttf, the reodering medial Ra gets its advance width
zero'ed in Uniscribe implementation, and the font adds the advance
back.  Our Indic shaper does not do that, but USE does.  So, route
Javanese through USE.  That's what Microsoft does anyway.  Test:

  U+A9A5,U+A9BA

This also seems to fix the following sequence, and variations thereof:

  U+A99F,U+A9C0,U+A9A2,U+A9BF
2016-05-06 15:52:27 +01:00
Behdad Esfahbod 01a30a6aa9 [indic] Remove data for scripts that don't go thorough this shaper 2016-05-06 12:10:07 +01:00
Behdad Esfahbod 7cd9269f4e Update tables to Unicode 9.0.0 beta
Fixes https://github.com/behdad/harfbuzz/issues/251
2016-05-06 12:10:03 +01:00
Behdad Esfahbod f718fe370e Minor 2016-05-06 12:10:00 +01:00
Behdad Esfahbod 691086f131 Add Unicode 9 beta scripts
These are frozen, so good time to add.
2016-05-06 12:09:53 +01:00
Behdad Esfahbod bc5198fe12 Whitespace 2016-05-06 12:09:49 +01:00
Behdad Esfahbod 9879fc1db3 [ot-font] Remove unused 'post' table include for now
To make a release...
2016-05-02 10:29:12 +02:00
Behdad Esfahbod f00ab2a33a [hb-ot-font] Make 'glyf' table loading lazy
Apparently some clients have reference-table callbacks that copy the table.
As such, avoid loading 'glyf' table which is only needed if fallback positioning
happens.
2016-05-02 10:24:00 +02:00
Behdad Esfahbod 587d46227a [ot-font] Start implementing 'post' table, for accessing glyph names 2016-04-30 19:20:56 +02:00
Behdad Esfahbod 9abaaac409 Merge commit '264b7a728a41becfbf23ce258fc2a3af19d0cbbe' into HEAD 2016-04-27 03:38:24 -07:00
Behdad Esfahbod 2f560ee44b [tibetan] Reorder marks to better match Uniscribe
Fixes https://github.com/behdad/harfbuzz/issues/237

Note that Uniscribe enforces a certain syllable order.  We don't.
But with this change, I get all of the tibetan contractions pass
with Microsoft Himalaya font.
2016-04-27 03:11:41 -07:00
Arthur Reutenauer adafdcddce Mass-added “difficult” tags – to be curated. 2016-04-27 02:14:16 +02:00
Arthur Reutenauer 3d6a2c0d7d Initial import of missing OpenType 1.7 language tags. 2016-04-27 02:14:16 +02:00
Behdad Esfahbod 7e2da035f6 Undo accidental change 2016-04-26 16:42:25 -07:00
Behdad Esfahbod b20305022a Do NOT ignore Mongolian Free Variation Selectors during matching
Fixes https://github.com/behdad/harfbuzz/issues/234
2016-04-26 16:41:17 -07:00
Behdad Esfahbod 21ab5501f5 Move ZWJ/ZWNJ bits to top byte of unicode_props()
To make room to remember Mongolian Free Variation Selectors.
Part of fixing https://github.com/behdad/harfbuzz/issues/234
2016-04-26 16:15:22 -07:00
Behdad Esfahbod 29393884b9 Annotate blacklisted fonts with their sha1sum 2016-04-26 10:35:47 -07:00
Konstantin Ritt 5069062d0a Unbreak build on Windows CE
0475ef2f97 broke the build by using
vsnprintf(), which is not defined on Windows CE
2016-04-26 12:02:26 +04:00
Behdad Esfahbod 1c625dff22 Minor 2016-04-09 12:53:23 -07:00
Behdad Esfahbod 851b0db36d Minor. We should never get to this branch, but fix it anyway. 2016-04-08 23:46:55 -07:00
Behdad Esfahbod 4f3d59a187 Blacklist another set of timesi.ttf and timesbi.ttf 2016-04-08 13:41:20 -07:00
Behdad Esfahbod ef476be80d Merge pull request #239 from ebraminio/dwfix
Improve DirectWrite backend
2016-04-08 13:16:33 -07:00
Ebrahim Byagowi d3134a66ad Fix when no feature is given 2016-04-05 21:42:37 +00:00
Behdad Esfahbod 59089622db [coretext] Clarify comment 2016-04-04 14:56:15 -07:00
Behdad Esfahbod 6dd80faf0d Fix FixedVersion::to_int()
Ouch.  Had broken it in 9a13ed453e

Fixes https://github.com/behdad/harfbuzz/issues/238
Will add test soon.
2016-04-04 14:34:25 -07:00
Ebrahim Byagowi 4a10402169 Hide justification behind HB_DIRECTWRITE_EXPERIMENTAL_JUSTIFICATION 2016-04-02 13:47:59 +00:00
Ebrahim Byagowi 63ee9ca5d8 Use standard types instead Windows favourites ones 2016-04-01 15:47:07 +00:00
Ebrahim Byagowi adf20ba0d1 Limit GetJustifiedGlyphs only to scripts with custom justification character 2016-04-01 15:36:40 +00:00
Ebrahim Byagowi 32ae9d1b3f Add justification support 2016-04-01 14:39:07 +00:00
Ebrahim Byagowi 10c3d9e415 Basic opentype features support 2016-04-01 01:39:15 +00:00
Ebrahim Byagowi d129897120 Refactor and remove dupe getglyphs call 2016-03-31 13:47:32 +00:00
Ebrahim Byagowi 5f1a896100 Better glyph offset support 2016-03-31 12:43:37 +00:00
Ebrahim Byagowi d691ba3f40 Don't fail when language is not set 2016-03-30 20:50:28 +00:00
Ebrahim Byagowi 1c00a46c7a Make DirectWrite backend to work with different font sizes
Actually copyedited same logic from Uniscribe to make it just work
2016-03-30 20:15:09 +00:00
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