Commit Graph

294 Commits

Author SHA1 Message Date
Behdad Esfahbod 055fb24d03 Add test for bug in ICU decompose
As reported by Kenichi Ishibashi on 2011-10-28.
2012-01-18 22:11:31 -05:00
Behdad Esfahbod a17554bfd5 Make test-c.c actually use hb
This will make sure we test that C code can actually link to the
library.
2011-09-28 16:57:34 -04:00
Behdad Esfahbod 738d096a06 Pass through unknown ISO 639-3 language tags to OpenType engine
In hb_ot_tag_from_language(), if first component of an unknown
language is three letters long, use it directly as OpenType language
tag (after case conversion and padding).
2011-09-02 13:31:19 -04:00
Behdad Esfahbod 4c9fe88d30 [API] Make all _from_string() functions take a len parameter
Can be -1 for NUL-terminated string.  This is useful for passing parts
of a larger string to a function without having to copy or modify the
string first.

Affected functions:

	hb_tag_t hb_tag_from_string()
	hb_direction_from_string()
	hb_language_from_string()
	hb_script_from_string()
2011-08-26 09:22:12 +02:00
Behdad Esfahbod e6c09cdf43 Remove the pre_allocate argument from hb_buffer_create()
For two reasons:

1. User can always call hb_buffer_pre_allocate() themselves, and

2. Now we do a pre_alloc in add_utfX anyway, so the total number of
reallocs is limited to a small number (~3) anyway.  This just makes the
API cleaner.
2011-08-19 19:20:26 +02:00
Behdad Esfahbod 217cc81cd9 [test/shape-complex] Print cluster and position info in --verbose 2011-08-09 14:00:44 +02:00
Behdad Esfahbod 708403e7f3 Fix warnings with old glib 2011-08-09 13:52:36 +02:00
Behdad Esfahbod 38b2118724 [API] Add hb_ft_font_set_funcs(), remove hb_ft_get_font_funcs()
Remove hb_ft_get_font_funcs() as it cannot be used by the user anyway.

Add hb_ft_font_set_funcs().  Which will make the font internally use
FreeType.  That is, no need for the font to have created using the
hb-ft API.  Just create using hb_face_create()/hb_font_create() and
then call this on the font (after having set font scale).  This
internally creates an FT_Face and attached to the font.
2011-08-09 11:10:32 +02:00
Behdad Esfahbod c0975e1231 Fix build again 2011-08-09 00:46:18 +02:00
Behdad Esfahbod 33ccc77902 [API] Make set_user_data() functions take a replace parameter
We need this to set data on objects safely without worrying that some
other thread unsets it by setting it at the same time.
2011-08-09 00:43:24 +02:00
Behdad Esfahbod 458c89a856 Minor 2011-08-09 00:19:19 +02:00
Behdad Esfahbod f1f848e2e4 Fix build 2011-08-08 23:41:06 +02:00
Behdad Esfahbod 206e329345 [test] test-object is not FreeType-specific, move it to the right place 2011-08-07 01:10:55 -04:00
Behdad Esfahbod 9da554504e Add hb_shape_list_shapers() 2011-08-05 19:59:02 -04:00
Behdad Esfahbod 3ca6c4ecc2 Change hb_shape() API back to what it was, add hb_shape_full()
I disliked changing hb_shape() API, and disliked the fact that it was
returning a bool now.  So, reverted.  Added new API for the extra
functionality.
2011-08-05 17:22:19 -04:00
Behdad Esfahbod 02aeca985b [API] Changes to main shape API
hb_shape() now accepts a shaper_options and a shaper_list argument.
Both can be set to NULL to emulate previous API.  And in most situations
they are expected to be set to NULL.

hb_shape() also returns a boolean for now.  If shaper_list is NULL, the
return value can be ignored.

shaper_options is ignored for now, but otherwise it should be a
NULL-terminated list of strings.

shaper_list is a NULL-terminated list of strings.  Currently recognized
strings are "ot" for native OpenType Layout implementation, "uniscribe"
for the Uniscribe backend, and "fallback" for the non-complex backend
(that will be implemented shortly).  The fallback backend never fails.

The env var HB_SHAPER_LIST is also parsed and honored.  It's a
colon-separated list of shaper names.  The fallback shaper is invoked if
none of the env-listed shapers succeed.

New API hb_buffer_guess_properties() added.
2011-08-04 22:38:09 -04:00
Behdad Esfahbod 0530ca9a18 Fix out-of-tree build 2011-08-04 01:42:59 -04:00
Behdad Esfahbod 199abbd0f1 Minor 2011-08-02 13:59:47 -04:00
Behdad Esfahbod 4f052b93c0 Fix build with glib but not freetype 2011-08-02 13:44:24 -04:00
Behdad Esfahbod c21be799da Minor 2011-08-02 12:05:49 -04:00
Behdad Esfahbod 07cedd81f4 Minor 2011-07-30 21:16:51 -04:00
Behdad Esfahbod 3a9b14dfdf Minor 2011-07-30 20:23:55 -04:00
Behdad Esfahbod 8613193bbf [test] Fix problem with N'ko test direction
Old HarfBuzz test suite always shaped as left-to-right and hence had wrong
0x14db, direction expected glyphstring for N'ko.  Doh!

Failures down from 92 to 88.
2011-07-30 20:21:40 -04:00
Behdad Esfahbod 1a1b501315 Minor 2011-07-29 16:36:46 -04:00
Behdad Esfahbod dd5546de15 Minor 2011-07-29 16:27:31 -04:00
Behdad Esfahbod 63c0ef4a07 Fix decompose() implementations to work with non-starter non-composables
Add tests.
2011-07-21 20:58:42 -04:00
Behdad Esfahbod ad903e66b1 s/COMBINING_MARK/SPACING_MARK/ here too. Oops! 2011-07-21 10:17:22 -04:00
Behdad Esfahbod 498e1a9be6 [icu] Implement compose()/decompose() 2011-07-20 23:19:49 -04:00
Behdad Esfahbod ffd4a436f7 Add tests for compose()/decompose()
Adjust glib fallback implementation.

The tests are not hooked up for ICU yet.
2011-07-20 22:31:23 -04:00
Behdad Esfahbod 23db8d5c92 [test] Work around glib <= 2.30 API 2011-07-12 12:02:26 -04:00
Behdad Esfahbod c4641723fb [API] Add compose() and decompose() unicode funcs, rename other ones
Add compose() and decompose() unicode funcs.  These implement
pair-wise canonical composition/decomposition.

The glib/icu implementations are lacking for now.  We are adding
API for this to glib, but I cannot find any useful API in ICU.
May end of implementing these in-house.

Changed all unicode_funcs callback names to remove the "_get" part.
Eg, hb_unicode_get_script_func_t is now hb_unicode_script_func_t,
and hb_unicode_get_script() is hb_unicode_script() now.
2011-07-08 00:09:31 -04:00
Behdad Esfahbod fc551edbf2 Add todo
I'm too lazy to fix the tests now.
2011-07-07 16:09:38 -04:00
Behdad Esfahbod 253a57fb5a [test-shape-complex] Remove the greek tests
They are outdated with respect to the DejaVu Sans I'm using.
We need to add font version checking to the tests.
2011-06-28 17:26:03 -04:00
Behdad Esfahbod afa74bf904 [test-shape-complex] Print out expected and actual glyphstrings upon failure
One has to run the test with --verbose to see that right now.
2011-06-28 17:25:17 -04:00
Behdad Esfahbod 42d453b023 [test] Name tests after their input string 2011-06-28 16:59:16 -04:00
Behdad Esfahbod 2741316978 Minor
Towards a better test runner.
2011-06-28 16:21:31 -04:00
Behdad Esfahbod cc674cbf7f Minor 2011-06-28 16:17:16 -04:00
Behdad Esfahbod 20d8a3982a [test] Remove disabled code
We'd add normalization and decomposition tests later.
2011-06-28 16:16:53 -04:00
Behdad Esfahbod 9704f0ca6c [test] Restructure shape test data a bit 2011-06-28 16:15:46 -04:00
Behdad Esfahbod a346e923a9 [test] Add Indic tests from harfbuzz.old
Needs fonts to be put in test/fonts.  Tests are skipped otherwise.
Run with --verbose for details.  Working on improving the test runner
to make it easier to make sense of what's going on.
2011-06-28 12:49:18 -04:00
Behdad Esfahbod 31f18abecb Minor compiler warning fixes 2011-06-15 09:49:58 -04:00
Behdad Esfahbod 75ba4073ca [test] Rename valgrind-log to log-vaglring.txt 2011-05-27 04:14:42 -04:00
Behdad Esfahbod 654f88fbc9 [test-common] Test hb_direction_to_string()
Caught by "make check-symbols".
2011-05-27 03:40:04 -04:00
Behdad Esfahbod 18bced134f [test] Rename test-symbols to check-symbols
Shows undocumented symbols.
2011-05-27 03:40:04 -04:00
Behdad Esfahbod 0e482ec6ba [test/unicode] Fix double-free
Caught by "make check-valgrind".
2011-05-27 03:40:04 -04:00
Behdad Esfahbod 28b1bac541 [test] Switch to automake-based test-runner
Adds check-valgrind among other modes.  We do not run under gtester by
default anymore.
2011-05-27 03:40:04 -04:00
Behdad Esfahbod adbc97ddde [test] Add test-symbols that checks API symbol text coverage
We're not at 100% coverage yet, so do not enable the test by default.
2011-05-27 03:40:03 -04:00
Behdad Esfahbod 9313b9aa66 [test/version] Test hb-version.h 2011-05-27 03:40:03 -04:00
Behdad Esfahbod 5bf56ea056 [TODO] Add item 2011-05-25 14:44:08 -04:00
Behdad Esfahbod 2d8ebcb9d0 [API] One last font-funcs API change
Now that vertical text works correctly, I'm doing a last round
modification of the font-funcs API to simplify.  Expect no more
changes around here.
2011-05-25 11:27:33 -04:00
Behdad Esfahbod d31691296f [test] Update to API changes 2011-05-25 11:01:32 -04:00
Behdad Esfahbod 744970af4d [API] Add support for vertical text
Design not final yet, and in fact I'm going to change it immediately,
but this is an standalone change for itself.
2011-05-17 17:12:34 -04:00
Behdad Esfahbod 5be7d047f6 Check for mmap()
Apparently there exist systems with mprotect(), but not mmap()?
2011-05-17 15:56:31 -04:00
Behdad Esfahbod 4053f3f788 Cosmetic 2011-05-16 17:03:27 -04:00
Behdad Esfahbod a0359485c9 Minor 2011-05-16 15:07:48 -04:00
Behdad Esfahbod 92de53ea45 [test/buffer] Add more tests for nil buffer 2011-05-16 12:24:56 -04:00
Behdad Esfahbod 065fb38c9a [test/ot-tag] More tests 2011-05-13 23:04:46 -04:00
Behdad Esfahbod 1a64f6e19a [API] Add HB_LANGUAGE_INVALID 2011-05-13 22:55:32 -04:00
Behdad Esfahbod 40b5c2e86c [test/test-ot-tag] Test hb-ot-tag.h, fix many bugs
I'm in awe with how many bugs this test revealed.  All fixed.
2011-05-13 22:46:36 -04:00
Behdad Esfahbod 7fc5a30cb4 [API] Add hb_face_make/is_immutable() 2011-05-12 17:48:20 -04:00
Behdad Esfahbod 0fd8c2f1be [API] Make get_glyph() callback return a boolean
We need to know whether the glyph exists, so we can fallback to
composing / decomposing.  Assuming that glyph==0 means "doesn't exist"
wouldn't work for applications like Pango that want to use different
"doesn't exist" glyph codes for different characters.  An explicit
return value fixes that.
2011-05-12 15:14:13 -04:00
Behdad Esfahbod 8e07f93ab4 [test/shape] Check shape output 2011-05-12 14:27:44 -04:00
Behdad Esfahbod 23d2432219 [test] Add test-shape.c. Oops 2011-05-12 10:53:57 -04:00
Behdad Esfahbod c098c3acc8 [test/blob] Use MAP_ANON instead of MAP_ANONYMOUS
More portable.
2011-05-12 10:49:30 -04:00
Behdad Esfahbod 8329eb7c6c [test/shape] Add simplest test for hb_shape() 2011-05-12 01:39:17 -04:00
Behdad Esfahbod f2c1dd4f74 [test/font] Test font_funcs subclassing 2011-05-12 00:46:53 -04:00
Behdad Esfahbod 14f1e81b77 [test/font] Test empty funcs 2011-05-12 00:18:28 -04:00
Behdad Esfahbod 2ca0b5ae1e [test/font] Test more 2011-05-12 00:04:48 -04:00
Behdad Esfahbod 7033518f75 [API] Pass face to get_table() 2011-05-11 23:31:15 -04:00
Behdad Esfahbod ea93e7b27c [test/font] More tests 2011-05-11 23:22:55 -04:00
Behdad Esfahbod cdb153175f [test/font] More tests 2011-05-11 23:12:58 -04:00
Behdad Esfahbod 74d9fa3d9a [test/font] More get_empty() tests 2011-05-11 23:07:47 -04:00
Behdad Esfahbod db9f4eb4e0 [test/font] Test get_face() / get_parent() 2011-05-11 23:06:02 -04:00
Behdad Esfahbod 606923bb43 [test/font] Add test_font_properties() 2011-05-11 23:05:02 -04:00
Behdad Esfahbod da603e8038 [test/font] Start adding tests for hb-font.h 2011-05-11 22:58:54 -04:00
Behdad Esfahbod 9a14688e40 [API] Rename hb_face_create_for_data() to hb_face_create() 2011-05-11 22:49:29 -04:00
Behdad Esfahbod b8477e1da2 [test] Add tests for _get_empty() funcs 2011-05-11 21:12:44 -04:00
Behdad Esfahbod 80a6833b03 [API] Add hb_*_get_empty() for all objects 2011-05-11 18:21:58 -04:00
Behdad Esfahbod 7aa12ebdff [unicode] Simplify method setting 2011-05-11 11:55:11 -04:00
Behdad Esfahbod 74f1d896f2 Add hb_font_make/is_immutable() 2011-05-10 19:39:32 -04:00
Behdad Esfahbod 0c2ec1d78b [test] Always initialize gthread such that our mutex() stuff is tested
Now the test/object test deadlocks as expected.  Fix coming.
2011-05-10 19:11:52 -04:00
Behdad Esfahbod 6a9093cc48 [test/object] Test user_data with destroy() callback that calls user_data
Exposes the non-atomicity of user_data opertaions at this time because
we call finish() while still locked and modifying the object.  In fact,
I'm surprised that it doesn't deadlock.  It should.
2011-05-10 19:00:07 -04:00
Behdad Esfahbod f82c186304 [test/blob] Fix bug in test 2011-05-10 17:48:34 -04:00
Behdad Esfahbod 785d23acd0 [test/blob] Add create_sub_blob() 2011-05-10 17:41:44 -04:00
Behdad Esfahbod 0617b15582 [test] Test blob API 2011-05-10 17:37:08 -04:00
Behdad Esfahbod 1c9f8717eb [API] Simplify blob API, remove lock 2011-05-06 22:59:42 -04:00
Behdad Esfahbod 34fb5521a5 [API] Add hb_language_get_default()
It uses locale information to detect default language.  It's used by
hb_shape() whenever language is not set on the buffer.

Not sure how to properly test it in the test suite.  Tested by observing
that with DejaVu Sans we select the proper local glyph version for U+431
under Serbian locale.  See http://www.pango.org/ScriptGallery
2011-05-06 00:05:08 -04:00
Behdad Esfahbod c78f448558 [API] Add version macros and functions
Step version up to 0.5.0.

Also, fix to pass "make distcheck"
2011-05-05 21:31:04 -04:00
Behdad Esfahbod e6a5b88c01 Fix build with older glib 2011-05-05 16:24:42 -04:00
Behdad Esfahbod 811482bd65 Replace hb_map_t with hb_set_t which is more intuitive and flexible 2011-05-05 13:21:04 -04:00
Behdad Esfahbod 72657e4ce7 [API] Make hb_font_create() take a face and reference it 2011-05-02 20:47:23 -04:00
Behdad Esfahbod db99589529 [test/object] Add test for object lifecycle stuff
Revealed many bugs in the (untested and known buggy) user_data
support.
2011-05-02 19:52:47 -04:00
Behdad Esfahbod f74d6c81f1 Cosmetic 2011-05-02 19:52:32 -04:00
Behdad Esfahbod cd361ec9a1 Cosmetic 2011-05-02 16:54:05 -04:00
Behdad Esfahbod c784c67a28 [unicode] Make _get_parent() return _nil object instead of NULL 2011-05-02 15:59:57 -04:00
Behdad Esfahbod 07e22779ab [test/unicode] Add script roundtrip tests for glib and ICU 2011-05-02 14:58:36 -04:00
Behdad Esfahbod 7cda65935c [test/unicode] Better test chainup 2011-05-02 14:33:53 -04:00
Behdad Esfahbod 250c59225e [test/unicode] Port the _custom test to test all property setters 2011-05-02 14:21:30 -04:00
Behdad Esfahbod e74b5b339a [test/unicode] Test Unicode 5.2+ but don't fail 2011-05-02 14:03:55 -04:00
Behdad Esfahbod c763aa42b4 [test/buffer] Clean up testing
Getting the hang of how to cleanly use gtest.
2011-05-02 13:52:17 -04:00
Behdad Esfahbod 819e9d9e53 Minor 2011-05-02 12:38:54 -04:00
Behdad Esfahbod e8e29c725a [test/unicode] Add log messages
Use with --verbose to see what's failing
2011-05-02 12:06:18 -04:00
Behdad Esfahbod 208c2c3150 Minor 2011-05-01 20:04:01 -04:00
Behdad Esfahbod 60833efaf1 [test/unicode] Add testing of all unicode properties
ICU fails for now.
2011-04-29 16:50:34 -04:00
Behdad Esfahbod da96ee072f [test/unicode] Test is/make_immutable() 2011-04-29 12:17:09 -04:00
Behdad Esfahbod 6af9cff5e1 [test/unicode] Use text fixture instead of static variables 2011-04-29 12:12:37 -04:00
Behdad Esfahbod 13db3d40bf [test/buffer] Add UTF-16 tests 2011-04-28 19:44:45 -04:00
Behdad Esfahbod 243673d601 [test/buffer] Add more extensive UTF-8 test data from glib 2011-04-28 19:37:51 -04:00
Behdad Esfahbod dfec67f958 [test/buffer] Add initial utf-8 tests 2011-04-28 18:34:42 -04:00
Behdad Esfahbod aafe395ab5 Add test suite infrastructure
Wraps around glib for convenience and ease of use.
2011-04-28 17:11:21 -04:00
Behdad Esfahbod 1d39d6e42b Desable possibly lethal test on 64-bit machines 2011-04-28 15:54:16 -04:00
Behdad Esfahbod 3264042873 [test/buffer] Test pre_allocate() and allocation_successful() 2011-04-28 14:24:16 -04:00
Behdad Esfahbod 15c57e04bf [test/buffer] Add test pre_alloc(); hangs in the buffer code right now
Because the following loop overflows:

  while (size > new_allocated)
      new_allocated += (new_allocated >> 1) + 32;
2011-04-28 12:28:54 -04:00
Behdad Esfahbod 1e5527e2d6 [test/buffer] Test reset(), set_length(), and set/get_unicode_data() 2011-04-28 12:15:24 -04:00
Behdad Esfahbod db126b5448 [test/buffer] Test reverse() and reverse_clusters() 2011-04-28 11:56:29 -04:00
Behdad Esfahbod 39a840ae65 [API] Add hb_direction_from/to_string()
And hb-view --direction argument.
2011-04-27 14:48:19 -04:00
Behdad Esfahbod d4bee9f813 [API] Add hb_unicode_funcs_get_default() 2011-04-27 09:38:19 -04:00
Behdad Esfahbod 2409d5f8d7 Update Copyright headers 2011-04-21 17:14:28 -04:00
Behdad Esfahbod af02933739 [API] Remove hb_*_get_reference_count()
This was a bizzare piece of API that I inherited from cairo.  It has
been wrong adding them to cairo in the first place.  Remove them before
someone uses them!
2011-04-20 15:49:31 -04:00
Behdad Esfahbod fb6291d9c9 [test] Add test for headers included from C and C++ 2011-04-20 03:15:31 -04:00
Behdad Esfahbod 107a50581c [test] Add todo items 2011-04-20 03:04:56 -04:00
Behdad Esfahbod 1fd73b594d [test] Rename test-types to test-common 2011-04-20 02:56:39 -04:00
Behdad Esfahbod f144a8ea84 [icu] Add two-way script conversion functions
Also optimizes the common-direction script lookup.
2011-04-20 02:54:42 -04:00
Behdad Esfahbod fb194b8794 unicode: Cleanup implementation 2011-04-20 02:27:39 -04:00
Ryan Lortie 2fd0c577e3 [API] unicode: rework virtual functions for subclassing
Unicode data providers can now be subclassed, including support for
chain-up.  The interface should now be nicely bindable, as well.

Also fix glib unicode funcs that where broken after hb_script_t
changes.  Nicely caught by the test-unicode.c added in this commit.
2011-04-20 00:19:20 -04:00
Behdad Esfahbod f85faee9b3 [API] Rename hb_buffer_add_glyph() to hb_buffer_add() 2011-04-19 00:38:01 -04:00
Behdad Esfahbod aab0de50e2 [API] Add hb_buffer_allocation_successful()
Returns the error status of the buffer.
2011-04-19 00:32:19 -04:00
Ryan Lortie 70566befc5 [API} hb_buffer_get_glyph_{infos,positions}: Add length out parameter
Return the length, whenever we return an array.  Makes it easier on the
language bindings.
2011-04-19 00:03:44 -04:00
Behdad Esfahbod 62879eebd9 [API] Use ISO 15924 tags for hb_script_t
This simplifies the code, reduces static data, and makes the design
more extensible to future additions of new scripts.
2011-04-18 23:40:21 -04:00
Behdad Esfahbod c0af193c8e Change buffer default properties to invalid
This includes HB_DIRECTION_INVALID and HB_SCRIPT_INVALID.

The INVALID will cause a "guess whatever from the text" in hb_shape().
While it's not ideal, it works better than the previous defaults at
least (HB_DIRECTION_LTR and HB_SCRIPT_COMMON).
2011-04-15 19:26:24 -04:00
Behdad Esfahbod 2fc56edff6 [API] Remove hb_buffer_clear()
One should use hb_buffer_reset() really.
2011-04-15 19:08:38 -04:00
Behdad Esfahbod 2f2f448af3 [test] Add more TODO items 2011-04-15 11:45:14 -04:00
Behdad Esfahbod 7dea908cd5 [test] Add todo items 2011-04-13 01:35:58 -04:00
Behdad Esfahbod d0f53fdbea [test] Test hb-buffer.h 2011-04-13 01:09:53 -04:00
Behdad Esfahbod 4744379efc Minor 2011-04-11 19:47:33 -04:00
Behdad Esfahbod 9385caa8a6 [test] Actually hook up hb_script_t tests
I really shall find a way to automate the test enumeration.  Otherwise
it's too easy to add a test and wrongly hook it up.  Did it twice today.
2011-04-11 19:43:51 -04:00
Behdad Esfahbod 09125576ca [test] Test hb_language_t 2011-04-11 17:49:33 -04:00
Behdad Esfahbod db60c96f20 [teset] Test hb_script_t 2011-04-11 16:17:02 -04:00
Behdad Esfahbod 4188096a77 Make HB_TAG_CHAR4 private
It's just sugar.
2011-04-11 14:58:28 -04:00
Behdad Esfahbod 7ff7401c92 Make hb_tag_from_string(NULL) return HB_TAG_NONE 2011-04-11 13:27:30 -04:00
Behdad Esfahbod 02f6e62d6c Build fix 2011-04-11 13:27:21 -04:00
Behdad Esfahbod 07233581c9 Rename HB_TAG_STR() to HB_TAG_CHAR4()
The problem with HB_TAG_STR() was that it expected a string of size 4
exactly, and unlike hb_tag_from_string() it doesn't pad the tag with
space characters.  So, the new name is more appropriate.
2011-04-11 13:12:37 -04:00
Behdad Esfahbod 9faa980067 Add an in-tree test suite
Uses the glib testing framework.  Wrote unit tests for hb-common.h
types.
2011-04-11 12:46:49 -04:00
Behdad Esfahbod bbdeff5964 Add test directory 2011-04-07 16:05:07 -04:00