Commit Graph

173 Commits

Author SHA1 Message Date
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 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 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 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
Khaled Hosny 9ab9f974d4 [docs] More buffers documentation 2016-01-01 20:38:21 +04:00
Khaled Hosny 9cffe329f1 [docs] Typo 2015-12-30 22:50:08 +04: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
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 35d18585fc Fix a few docs blocks 2015-11-26 19:30:37 -05: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 68b507a3c3 Make sure we make progress in OOM situations 2015-11-06 00:09:26 -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 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 b8811429b6 Fix Since tags
Fixes https://github.com/behdad/harfbuzz/issues/103
2015-09-03 15:53:22 +04:30
Behdad Esfahbod e995d33c10 [OT] Merge clusters when reordering marks for normalization
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=541608
and cluster test.
2015-09-01 16:13:32 +01:00
Behdad Esfahbod 85846b3de7 Use insertion-sort instead of bubble-sort
Needed for upcoming merge-clusters fix.
2015-09-01 15:07:52 +01:00
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 701112dad9 [ot] Simplify form_clusters() 2015-07-22 15:42:20 +01: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
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 81bedda58c New API: hb_buffer_reverse_range() 2015-04-30 13:04:16 -04:00
Khaled Hosny 22524a514f [bindings] Fix hb_buffer_get_segment_properties
Annotate the output parameter.
2015-04-10 22:57:38 +02:00
Khaled Hosny 04f89e8f7d [bindings] Fix ownership of returned hb_language_t
It should not be freed by the caller.
2015-04-10 18:17:02 +02:00
Behdad Esfahbod 9e401f6890 Fix reverse_range() for empty range
Fixes coretext notdef loop consisting of all default_ignorable glyphs

https://code.google.com/p/chromium/issues/detail?id=464755
2015-03-20 16:08:38 -04:00
Behdad Esfahbod 8ac345e5c0 Fix reverse_range() to only reverse alt array if positions are used
In hb-coretext, when we were using scratch buffer for book-keeping,
a reverse_range() caused by the notdef-insertion loop could mess up
our log_clusters.  Ouch!
2015-03-02 16:06:55 -08:00
Behdad Esfahbod 61820bc4ca [API] Add hb_buffer_add_latin1()
This is by no ways to promote non-Unicode encodings.  This is an entry
point that takes Unicode codepoints that happen to all be the first
256 characters and hence fit in 8bit strings.  This is useful eg in Chrome
where strings that can fit in 8bit are implemented that way, and this
avoids copying into UTF-8 or UTF-16.

Perhaps we should rename this to hb_buffer_add_codepoints8().  I'm also
curious if anyone would be really interested in hb_buffer_add_codepoints16().

Please discuss!
2015-01-26 14:25:52 -08:00
Behdad Esfahbod 78c6e86c04 Fix hb_buffer_add_codepoints to actually NOT validate 2015-01-26 14:08:36 -08:00
Behdad Esfahbod b632e7997d Fix up gobject-introspection a bit
Minimal shaping works now!
2015-01-06 14:05:26 -08:00
Behdad Esfahbod b5fbc3b8f5 API: Do not clear buffer-flags in hb_buffer_clear_contents()
After 763e5466c0, one doesn't
need to set flags for different pieces of text.  The flags now
are something the client sets up once, depending on how it
actually uses the buffer.  As such, don't clear it in
clear_contents().

Tests updated.
2014-08-11 18:40:01 -04:00
Behdad Esfahbod 976c8f4552 New API: hb_buffer_[sg]et_replacement_codepoint()
With this change, we now by default replace broken UTF-8/16/32 bits
with U+FFFD.  This can be changed by calling new API on the buffer.
Previously the replacement value used to be (hb_codepoint_t)-1.

Note that hb_buffer_clear_contents() does NOT reset the replacement
character.

See discussion here:

6f13b6d62d

New API:

  hb_buffer_set_replacement_codepoint()
  hb_buffer_get_replacement_codepoint()
2014-07-16 15:34:20 -04:00
Behdad Esfahbod bcba8b4502 New API hb_buffer_add_codepoints()
Like hb_buffer_add_utf32, but doesn't do any Unicode validation.
This is like what hb_buffer_add_utf32 used to be until a couple
commits ago.
2014-07-16 14:59:04 -04:00
Behdad Esfahbod 625dbf141a [buffer] Templatize UTF-* functions 2014-07-16 14:52:59 -04:00
Behdad Esfahbod 66c6a48b6c Add HB_NO_MERGE_CLUSTERS
Disables any cluster-merging.  Added for testing purposes while
we investigate what kind of API to add for this.
2014-04-14 15:55:42 -07:00
Behdad Esfahbod 02c6c8cd6e Set buffer content type to INVALID in hb_buffer_set_length(0)
Previously we were only setting this in hb_buffer_clear_contents(),
but set_length(0) is a valid way to reinitialize buffer to use with
new text.
2013-11-15 13:07:03 -05:00
Behdad Esfahbod 061cb46493 Use long alignment for scratch buffer
Fixes last of scratch alignment warnings in hb-coretext.
2013-11-13 14:50:25 -05:00
Behdad Esfahbod 68c372ed2e More scratch-buffer cleanup 2013-11-13 14:45:43 -05:00
Behdad Esfahbod 16f175cb2e Fix scratch-buffer alignment warnings 2013-11-12 17:22:49 -05:00
Behdad Esfahbod da72042c52 [otlayout] Fix up recent Context matching change
Commit 6b65a76b40.  "end" was becoming
negative.  Was trigerred by Lohit-Kannada 2.5.3 and the sequence:
U+0CB0,U+200D,U+0CBE,U+0CB7,U+0CCD,U+0C9F,U+0CCD,U+0CB0,U+0C97,U+0CB3
Two glyphs were being duplicated.
2013-10-17 12:02:34 +02:00
Behdad Esfahbod 6b65a76b40 [otlayout] Fix (Chain)Context recursion!
Previously we only supported recursive sublookups with
ascending indices.  We were also not correctly handling
non-1-to-1 recursed lookups.

Fix all that!

Fixes the three tests in test/shaping/tests/context-matching.tests,
which were derived from NotoSansBengali and NotoSansDevanagari
among others.
2013-10-14 18:54:51 +02:00
Behdad Esfahbod 085d4291a9 [introspection] Disable constructors for now
Since our types are not associated with their methods, marking
constructors makes them inaccessible from bindings.  Undo for now.
2013-09-12 17:14:33 -04:00
Behdad Esfahbod 288f289997 [docs/introspection] More annotations 2013-09-06 17:30:54 -04:00
Behdad Esfahbod c44b81833d Whitespace 2013-09-06 15:13:16 -04:00
Behdad Esfahbod 5f512017ba [docs] Document a few symbols 2013-09-05 16:40:32 -04:00
Behdad Esfahbod 4dc798de19 Add hb-deprecated.h, and rename a couple enum values
Add deprecated alias for old name.
2013-08-27 11:46:08 -04:00
Behdad Esfahbod 6c15ddfe2b Renamed DEBUG to something else
Some infrastructures use DEBUG as a generic symbol.
2013-04-30 11:34:00 -04:00
Behdad Esfahbod 847794e929 [buffer] Implement buffer deserialization for format=text
Using a ragel machine.
2013-02-27 18:49:18 -05:00