Commit Graph

3574 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 4febed61ed [USE] Set up features 2015-07-21 10:38:48 +01:00
Behdad Esfahbod 52a9577956 [USE] Hook up new scripts to USE shaper
Don't reroute scripts that we were routing to other shapers
before (just yet).
2015-07-21 10:02:04 +01:00
Behdad Esfahbod b4c0829bc1 [USE] Remove unused Unicode data enums from USE C++ side 2015-07-21 09:31:19 +01:00
Behdad Esfahbod 44910cef62 [USE] Finish converting Unicode positional categories to USE
Even compiles.
2015-07-20 18:01:10 +01:00
Behdad Esfahbod ad72555252 [USE] Map from Unicode data to USE syllabic categories
Positional sub-categories not applied yet.
2015-07-20 17:00:06 +01:00
Behdad Esfahbod 20e246e674 [USE] Start moving Unicode-to-USE mapping into Python code 2015-07-20 15:56:19 +01:00
Behdad Esfahbod eb74535cc2 [USE] Fix Number clusters
The spec wrongly has "H" where "HN" is meant.
2015-07-20 15:33:25 +01:00
Behdad Esfahbod a9663958fe [USE] Start putting together the shaper body 2015-07-20 14:24:55 +01:00
Behdad Esfahbod e0eabd7f67 [USE] Put a Ragel machine together
Grammar from the spec!
2015-07-20 13:50:38 +01:00
Behdad Esfahbod fd74b939b1 Minor 2015-07-20 13:30:45 +01:00
Behdad Esfahbod 5e5c8560cc [USE] Minor optimization of USE table 2015-07-20 12:01:20 +01:00
Behdad Esfahbod c48ff28852 [USE] Build Universal Shaping Engine data table from Unicode 8 files 2015-07-20 11:46:17 +01:00
Behdad Esfahbod e2c95116e1 [USE] Add Universal Shaping Engine to Makefile 2015-07-20 11:33:27 +01:00
Behdad Esfahbod 41a29af805 Update Arabic shaping table for Unicode 8.0 2015-07-15 01:39:57 +01:00
Behdad Esfahbod 64a2726e2c Add Unicode 8.0 scripts
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1183209
2015-07-15 01:36:39 +01:00
Behdad Esfahbod 9ae156b768 Fix pragma usage
https://bugs.freedesktop.org/show_bug.cgi?id=91228

Commit cdcdfe61b9 changed two `#pragma
message` to `#pragma error` in hb-unicode.cc, however MSVC uses #error,
just like the #else branch. `#pragma error` is an unknown pragma so
MSVC does not fail the build because of it, which I believe was the
intention of that commit.

If it's meant to be an #error, then the #ifdef for _MSC_VER can be
removed entirely.
2015-07-05 22:43:17 +01:00
ThePhD 8ad89f057d Spelling words is not my strong point. 2015-06-23 09:09:24 -04:00
ThePhD e0a828ecbd Back to using regular `strdup`, with an `hb-private.hh` fix that special-cases VC++'s
definition and usage of the words
2015-06-23 09:07:17 -04:00
ThePhD 8e545d5961 Fix all VC++ warnings and errors in the current commit's builds. 2015-06-22 22:29:04 -04:00
Behdad Esfahbod 5f13bbd9d4 When removing default-ignorables, merge clusters
Fixes test-shape, and:
https://code.google.com/p/chromium/issues/detail?id=497578
2015-06-19 13:31:49 -07:00
Behdad Esfahbod 82b521aeb7 Rewrite hide_default_ignorables
Separate the loops for the two cases of replacing with space
and deleting.  For deleting, use the out-buffer machinery.

Needed for upcoming cluster merge fix.
2015-06-19 13:26:03 -07:00
Behdad Esfahbod 351f68f4e0 [bindings] Fix hb_language_get_default() and hb_ot_tag_to_language()
Part of https://github.com/behdad/harfbuzz/issues/91
2015-06-12 17:46:06 -07:00
Behdad Esfahbod a5e4f6d608 Fix warnings: "member call on null pointer of type"
https://bugzilla.mozilla.org/show_bug.cgi?id=1167119
2015-06-10 10:57:46 -07:00
Behdad Esfahbod 8dacb7f8b4 Add include check to hb-ot-font.h 2015-06-03 11:53:42 -07:00
Sascha Brawer 01c3a88543 Fix "Since:" tags
Based on data from http://upstream-tracker.org/versions/harfbuzz.html
Resolves #103
2015-06-01 13:25:27 +02:00
Behdad Esfahbod f1b44303df Fix unary minus operator applied to unsigned int
Applying unary minus operator to unsigned int causes the following
warning on MSVS:

  warning C4146: unary minus operator applied to unsigned type, result still unsigned

Based on patch from Koji Ishi.

Fixes https://github.com/behdad/harfbuzz/pull/110
2015-05-21 14:00:15 -07:00
Behdad Esfahbod 1ae6cdb365 [gobject] Remove hb_language_t workarounds for g-i shortcomings
Using latest gobject-introspection, I don't seem to be having this
problem anymore:

  https://bugzilla.gnome.org/show_bug.cgi?id=707656

Removing that kludge makes language_t behave more like the way I expect it
in Python.

Also fixes:
https://github.com/behdad/harfbuzz/issues/91
2015-05-19 17:42:30 -07:00
Behdad Esfahbod ece434fa0f [gobject] Macroize value types
Fixes user_data_t
2015-05-19 17:20:58 -07:00
Behdad Esfahbod 9df099b483 [ft] Don't set *glyph in get_glyph() if glyph not found 2015-05-18 18:37:46 -07:00
Behdad Esfahbod 5801521532 Add note re OpenType 1.7 language tags 2015-05-06 00:40:31 -07:00
Roozbeh Pournader f6266ad291 [minor] Remove comment about Navajo OpenType code.
Apparently the code is already standardized:
https://www.microsoft.com/typography/otspec/languagetags.htm
2015-05-05 22:39:04 -07:00
Behdad Esfahbod 42b00118ea Merge pull request #102 from roozbehp/master
Add OpenType language tag 'NAV ' for Navajo.
2015-05-05 14:49:47 -07:00
Behdad Esfahbod be66ec5373 Use TRUE/FALSE instead of true/false in docs 2015-04-30 18:27:13 -04:00
Khaled Hosny d055e1fc78 Some attempt into initial hb-shape documentation
Very anaemic, needs to descripe the format understood by
hb_feature_from_string() etc., but it is just start.
2015-04-30 18:24:45 -04:00
Behdad Esfahbod 81bedda58c New API: hb_buffer_reverse_range() 2015-04-30 13:04:16 -04:00
Roozbeh Pournader cfeb0562eb Add OpenType language tag 'NAV ' for Navajo.
The code is not standardized yet, but is used in some Google fonts.
2015-04-29 09:32:42 -07:00
Jonathan Kew f724cc3516 Don't apply Arabic shaping to vertical text. 2015-04-24 12:19:02 -07:00