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