Commit Graph

1363 Commits

Author SHA1 Message Date
Behdad Esfahbod 0c6a9767c8 [hb-view] Add --face-index to choose a face in a TrueType Collection 2011-05-31 12:59:17 -04:00
Behdad Esfahbod 4f28fbdd80 Fix TTC header handling
Also change the Version type to avoid similar bugs in the future.

Reported by Grigori Goronzy.
2011-05-31 12:33:11 -04:00
Behdad Esfahbod 21deab2bdc Fixed inifinite loop introduced in 7403e055cd
k is the index, not j.

Reported by Tom Hacohen.
2011-05-30 11:08:40 -04:00
Behdad Esfahbod 51881a61ca Shrink code size 2011-05-27 18:15:56 -04:00
Behdad Esfahbod 90645fb24b [OT] Separate map_builder from the actual map
Respectively, separate planner from the actual plan.
2011-05-27 18:13:31 -04:00
Behdad Esfahbod 5560a19e2b Minor 2011-05-27 17:49:16 -04:00
Behdad Esfahbod 5bc18195d5 Add check-includes.sh 2011-05-27 15:58:54 -04:00
Behdad Esfahbod 376dafa6ed Hide internal symbols 2011-05-27 03:40:04 -04:00
Behdad Esfahbod 329c15714b Add libtool versioning
The versioning is automatic.  For now, soname-major is 0.  With
the 1.0.0 release it will jump to 1 and stay there forever.
2011-05-25 16:07:07 -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 7403e055cd [Vertical] fix vertical gpos
Wow, it took me a few days to find the right fix!

We now set the advance for attached marks to zero, but we
do this in the _finish() state of gpos, so it shouldn't
regress with fonts like DejaVuSansMono that explicitly
decrease the mark advance width to set it to zero.
2011-05-25 10:52:15 -04:00
Behdad Esfahbod 3b0bb855e0 [Vertical] GPOS x/y advance adjustments only apply in hori/vert respectively 2011-05-20 15:59:59 -04:00
Behdad Esfahbod cc2086d67c [Vertical] Fix GPOS y-advance direction 2011-05-19 19:19:50 -04:00
Behdad Esfahbod 67d51ff961 [Vertical] Do fallback origin calculation 2011-05-19 19:08:57 -04:00
Behdad Esfahbod 60fbb36096 [Vertical] GPOS is always done with horizontal origin 2011-05-19 18:46:15 -04:00
Behdad Esfahbod 8b38faeede More vertical
Starting to get there, but not without yet another round of changes.

I think I know wheere to go now.
2011-05-19 13:08:00 -04:00
Behdad Esfahbod e609aeb1e2 [hb-view] Add --annotate
Currently it only marks glyph origins.
2011-05-18 10:17:02 -04:00
Behdad Esfahbod b8d76dd74e Vertical: Adjust origin in glyph_extents() and glyph_contour_point()
The base for vertical is almost ready now.
2011-05-17 23:31:00 -04:00
Behdad Esfahbod 190981851f Cosmetic 2011-05-17 23:27:22 -04:00
Behdad Esfahbod 2c3f51a11c Minor 2011-05-17 23:23:27 -04:00
Behdad Esfahbod 7e2c85de30 [API] Vertical support, take 2
I like this API *much* better.  Implementation still incomplete, but
horizontal works.
2011-05-17 17:55:03 -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 4053f3f788 Cosmetic 2011-05-16 17:03:27 -04:00
Behdad Esfahbod 56d12e0356 Remove unnecessary TODO item 2011-05-16 16:01:58 -04:00
Behdad Esfahbod 1883af3796 [hb-view] Start work on vertical support 2011-05-16 15:18:16 -04:00
Behdad Esfahbod 9aa6f96af5 [hb-view] No need to allocate an extra glyph item at the end 2011-05-16 15:08:31 -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 20c8b908dd Finish off previous change 2011-05-12 15:19:33 -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 805af72405 Rename get_kernings() arguments from first/second_glyph to left/right_glyph
Makes it clear that kerning is in visual order.
2011-05-12 12:39:40 -04:00
Behdad Esfahbod df077fadd7 [object] Make object inert during destruction
Such that user_data and other finalizers cannot resurrect object
2011-05-12 01:19:39 -04:00
Behdad Esfahbod 52df150efe Fix font subclass chainup
Test passing now.
2011-05-12 00:46:57 -04:00
Behdad Esfahbod 7033518f75 [API] Pass face to get_table() 2011-05-11 23:31:15 -04:00
Behdad Esfahbod b467827806 [API] Remove const from font user_data 2011-05-11 23:25:28 -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 46d6a21cc8 [API] Add hb_ot_layout_substitute_start/finish() 2011-05-11 22:33:13 -04:00
Behdad Esfahbod c84d15f52e Remove unused hb_set_t 2011-05-11 22:23:15 -04:00
Behdad Esfahbod 389a7c9e67 Remove hb_static_threadsafe_set_t 2011-05-11 22:21:38 -04:00
Behdad Esfahbod e06d4eda7b Use constructor/destructor for hb_ot_shape_plan_t 2011-05-11 22:18:31 -04:00
Behdad Esfahbod daa446f184 Fix compile with no mutex available 2011-05-11 21:31:25 -04:00
Behdad Esfahbod 1e56c476c1 Free static mutex'es 2011-05-11 21:28:01 -04:00
Behdad Esfahbod 831886a9b4 Streamline mutex stuff 2011-05-11 21:27:52 -04:00
Behdad Esfahbod 438c4eee35 Remove unused hb_mutex_trylock() 2011-05-11 21:14:34 -04:00
Behdad Esfahbod 80a6833b03 [API] Add hb_*_get_empty() for all objects 2011-05-11 18:21:58 -04:00
Behdad Esfahbod d3b30be378 [API] Add HB_UNTAG()
Useful in C API only.
2011-05-11 18:06:12 -04:00
Behdad Esfahbod 3cc6e9dcb4 Minor 2011-05-11 18:02:48 -04:00
Behdad Esfahbod 4101ca7dbb Plug more leaks
All good now.
2011-05-11 14:30:56 -04:00
Behdad Esfahbod 6a7ac79e26 Plug leaks 2011-05-11 14:19:18 -04:00
Behdad Esfahbod 7aa12ebdff [unicode] Simplify method setting 2011-05-11 11:55:11 -04:00
Behdad Esfahbod d5bfd02721 Minor 2011-05-11 11:48:28 -04:00
Behdad Esfahbod 6a4e7e1372 Add maxp table
Not used for anything right now.  Will use to get num_glyphs in the future.
2011-05-11 10:31:33 -04:00
Behdad Esfahbod a513dbcf73 [API] Change signature of get_contour_point and get_kerning ffuncs
get_contour_point now takes glyph id before point_index.

get_kerning now takes a vector to fill-in.
2011-05-11 00:38:22 -04:00
Behdad Esfahbod 63d646fb29 [font] Do user-space conversion when chaining up to parent font 2011-05-11 00:15:37 -04:00
Behdad Esfahbod b6f902a1a9 Minor 2011-05-11 00:04:15 -04:00
Behdad Esfahbod abcfe9b59b Remove hb_ot_layout_context_t, simplify code 2011-05-11 00:02:02 -04:00
Behdad Esfahbod 1ded6d8bbf Make default font-funcs chain-up to the parent 2011-05-10 20:50:06 -04:00
Behdad Esfahbod b9d975b931 [API] Pass down closure user_data to font funcs 2011-05-10 20:41:13 -04:00
Behdad Esfahbod 446df9cdb1 Whitespace 2011-05-10 20:14:44 -04:00
Behdad Esfahbod 686c2d165d [API] Remove font_funcs func getter functions 2011-05-10 20:04:26 -04:00
Behdad Esfahbod defc45be6d [API] Add hb_font_create_sub_font() and hb_font_get_parent()
Not quite useful just yet.
2011-05-10 20:02:49 -04:00
Behdad Esfahbod 11bb8fe7b3 [font] Fix internal sign of x/y_scale
Should have been done as part of da97541988
2011-05-10 19:57:00 -04:00
Behdad Esfahbod 85e6218e33 [API] Remove broken-by-design hb_font_unset_funcs() 2011-05-10 19:40:44 -04:00
Behdad Esfahbod 74f1d896f2 Add hb_font_make/is_immutable() 2011-05-10 19:39:32 -04:00
Behdad Esfahbod 8c7a100a4d Fix build without mutex 2011-05-10 19:21:07 -04:00
Behdad Esfahbod 19d3035c40 Remove duplicate atomic_int implementation 2011-05-10 19:18:12 -04:00
Behdad Esfahbod 45bfa99034 Fix set implementation to be truly threadsafe even with destroy() callbacks
The test/object test is passing again, instead of deadlocking.
2011-05-10 19:15:49 -04:00
Behdad Esfahbod 1c9f8717eb [API] Simplify blob API, remove lock 2011-05-06 22:59:42 -04:00
Behdad Esfahbod a0f337a1cc Remove unused hb_blob_try_writable_inplace() 2011-05-06 19:20:52 -04:00
Behdad Esfahbod 08611d5194 Add note re deadlocks 2011-05-06 16:28:10 -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 3935af1c0d [buffer] Remove wrong optimization
While the cluster fields of the glyph string are usually sorted, they
wouldn't be in special cases (for example for non-native direction).
Blindly using bsearch is plain wrong.  If we want to reintroduce this
optimization we have to make sure we know the buffer clusters are
monotonic and in which direction.  Not sure it's worth it though.
2011-05-05 16:09:45 -04:00
Behdad Esfahbod 46df682851 Make user_data access threadsafe
For now, by taking a global user_data mutex.
2011-05-05 15:33:19 -04:00
Behdad Esfahbod 218e67b9ee Shrink code 2011-05-05 15:28:37 -04:00
Behdad Esfahbod b8d6183ebc Use threadsafe set implementation for hb_language lookups
Note that the static variable has to be a global static, as gcc
implements local statics differently and that would require linking
to libstdc++, which we don't want.
2011-05-05 15:14:04 -04:00
Behdad Esfahbod d37486d87b Add hb_threadsafe_set_t 2011-05-05 15:07:54 -04:00
Behdad Esfahbod b45f32ee4e Use hb_array_t for hb_language_t mapping 2011-05-05 15:00:43 -04:00
Behdad Esfahbod 21d2c92fdf Move code around 2011-05-05 14:47:53 -04:00
Behdad Esfahbod 265ac614ea Replace fixed-size lookup_maps array with hb_array_t 2011-05-05 14:38:16 -04:00
Behdad Esfahbod 6843569d2c Replace fixed-size feature_maps array with hb_array_t 2011-05-05 14:30:51 -04:00
Behdad Esfahbod 44b0a4d2fc Replace fixed-size feature_infos array with hb_array_t 2011-05-05 13:42:19 -04:00
Behdad Esfahbod b214ec3ac0 Minor 2011-05-05 13:24:07 -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 478a42536f Make array/map implementation more generic 2011-05-05 12:39:51 -04:00
Behdad Esfahbod b81bd42951 Make hb_mutex_*() macros take a pointer
More intuitive.
2011-05-05 00:21:16 -04:00
Behdad Esfahbod a4b1900913 Add hb_static_mutex_t 2011-05-05 00:17:43 -04:00
Behdad Esfahbod 56eb5ad6f9 Move code around
Mutex (and Windows.h by extension) are fairly isolated now.
2011-05-04 19:27:37 -04:00
Behdad Esfahbod d292885893 [ft] Fix font->face handling
Don't use _cached()
2011-05-03 01:03:53 -04:00
Behdad Esfahbod 2000179487 Move Win32 thread-safety stuff to hb-object-private.h
The Win32 definitions for LONG, ULONG, etc conflicts with
hb-open-type.h.  Avoid that by making sure hb-object-private.h
and hb-open-type.h are not included in the same compilation unit.
2011-05-03 00:49:06 -04:00
Behdad Esfahbod 266b34418c Refactor to keep hb-object-private.h and hb-open-type.h separate
Needed to be able to include <Windows.h> from hb-object-private.h.
2011-05-03 00:35:53 -04:00
Behdad Esfahbod d4141a44b9 [blob] Implement sub_blob() in terms of create()
Fixes problem with uninitialized sub_blob->mutex among other things.

Reported by Bradley Grainger.
2011-05-03 00:19:18 -04:00
Behdad Esfahbod fc52e9e44c Implement win32 thread-safety stuff
Patch from Bradley Grainger.
2011-05-03 00:09:16 -04:00
Behdad Esfahbod f55272ecde Add hb_mutex_free() and use it
Based on patch by Bradley Grainger.
2011-05-02 20:57:28 -04:00
Behdad Esfahbod 8d5186484b Cosmetic 2011-05-02 20:52:21 -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 cec6611c5c Protect NULL in a couple places 2011-05-02 20:18:58 -04:00
Behdad Esfahbod 5a5030366e Fix bug in array growth implementation
With this, test/object is now passing.  Yay!
2011-05-02 19:54:29 -04:00
Behdad Esfahbod 16123e1070 Fix bug in map implementation 2011-05-02 19:54:17 -04:00
Behdad Esfahbod 1cd5969f25 [object] Fix bug in get_user_data() implementation 2011-05-02 19:53:39 -04:00
Behdad Esfahbod 4911062d5b [API] Rename hb_blob_create_empty() to hb_blob_get_empty() 2011-05-02 19:36:39 -04:00
Behdad Esfahbod 1ab1d3e38c [face] Return nil face if blob is inert 2011-05-02 19:35:53 -04:00
Behdad Esfahbod e87867cb88 [buffer] Fail in _create() if we cannot pre-allocate the requested size 2011-05-02 19:35: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 03034acb8a [icu] Make sure we return script UNKNOWN instead of INVALID 2011-05-02 12:37:45 -04:00
Behdad Esfahbod d02985ec5a ISO 15924 fixes
Update to http://unicode.org/iso15924

Fixes some of the test failures in test-unicode with ICU.  Still
one more to fix before the test passes.
2011-05-02 12:35:14 -04:00
Behdad Esfahbod 6af9cff5e1 [test/unicode] Use text fixture instead of static variables 2011-04-29 12:12:37 -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 c7ffe2ad5f [API Remove hb_font_funcs_copy()
Will be adding font_funcs subclassing instead.
2011-04-28 16:03:29 -04:00
Behdad Esfahbod 30f34d08d4 [TODO] Remove finished items 2011-04-28 16:02:40 -04:00
Behdad Esfahbod 080a0eb7d8 Add _hb_unsigned_int_mul_overflows 2011-04-28 16:01:01 -04:00
Behdad Esfahbod 3264042873 [test/buffer] Test pre_allocate() and allocation_successful() 2011-04-28 14:24:16 -04:00
Behdad Esfahbod 123aa04f7b Fix possible but improbable overflow in hb_array_t 2011-04-28 12:58:28 -04:00
Behdad Esfahbod e0db4b868f [buffer] More error handling
Should be all set now.
2011-04-28 12:56:49 -04:00
Behdad Esfahbod 5fa849b77d [API] Add _set/get_user_data() for all objects 2011-04-27 21:46:01 -04:00
Behdad Esfahbod 852e08ec8f Move code around 2011-04-27 21:45:51 -04:00
Behdad Esfahbod 29c67d3f70 Add initial implementation of user_data to objects 2011-04-27 21:27:40 -04:00
Behdad Esfahbod 47e71d9661 [object] Remove unnecessary use of macros 2011-04-27 16:41:08 -04:00
Behdad Esfahbod 8be1420f8f [blob] Use HB_FUNC instead of __FUNCTION__ 2011-04-27 16:16:43 -04:00
Behdad Esfahbod ae008b90cf [object] Add tracing support back in 2011-04-27 16:16:39 -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 f1425a549f Rename hb-view.c and test.c to .cc files 2011-04-27 12:15:06 -04:00
Behdad Esfahbod 65e0063eae Make buffer size growth start from 32 instead of 8 2011-04-27 09:38:23 -04:00
Behdad Esfahbod d4bee9f813 [API] Add hb_unicode_funcs_get_default() 2011-04-27 09:38:19 -04:00
Behdad Esfahbod 153142dac8 Replace simple macros with inline functions for better type safety
Now that we use C++ for all source code, lets benefit from it!

The hb_be_int16/32_get/put/eq() macros grow code size if replaced with
inline functions, so leave them as is.
2011-04-27 02:07:46 -04:00
Behdad Esfahbod 40a9b8154f Add TODO item 2011-04-27 01:48:56 -04:00
Behdad Esfahbod ebdc83467c Don't return in void function
Would have been nice if gcc had warned...
2011-04-27 01:41:24 -04:00
Behdad Esfahbod ec6f9c2fd0 Further simplify object handling 2011-04-21 18:35:58 -04:00
Behdad Esfahbod fca368c468 Add hb_object_header_t which is the common part of all objects
Makes way for adding arbitrary user_data support.
2011-04-21 18:24:02 -04:00
Behdad Esfahbod a9f24c8029 Move hb_reference_count_t to hb-private.h 2011-04-21 17:18:22 -04:00
Behdad Esfahbod 2409d5f8d7 Update Copyright headers 2011-04-21 17:14:28 -04:00
Behdad Esfahbod 08da7a3841 [hb-view] Accept numbers in feature tag name
Reported by Adam Twardoch.
2011-04-21 16:59:10 -04:00
Behdad Esfahbod 24229eb132 Remove obsolete comment
Talking to Ryan Lortie, he thinks my comment doesn't make sense.

So I'm making the getter const.  Note that g_atomic_int_get()
casts that away itself, so we don't need to worry about that
(which kinda makes me uncomfortable actually).
2011-04-21 16:55:17 -04:00
Behdad Esfahbod dcb7026f33 Add ASSERT_STATIC_EXPR macro
Unused right now.
2011-04-21 16:34:22 -04:00
Behdad Esfahbod 3e8bdbf941 Cleanup hb_refrence_count_t 2011-04-21 16:16:21 -04:00
Behdad Esfahbod 783a7d6969 [TODO] Remove finished items 2011-04-21 16:03:59 -04:00
Behdad Esfahbod da97541988 [API] Allow negative font x_scale/y_scale
I was reconsidering whether y should grow down, since all three/four
times I've used this API I was tricked and got that wrong in my use.
So I was very inclined to make y grow down instead of up.  However,
considering that the font space has y up and it would be very confusing
for callbacks to work against that, I decided that what I really want
is for the user to be able to set y_scale to a negative number to imply
that user-space y grows down.

Changing x_scale/y_scale from unsigned int to int allows that, and I've
made pango to use that instead of negating glyph y_offset later.  hb-ft
however still has y group up.  I *guess* that's how FreeType works?
I'm not sure, FreeType docs don't make this clear...

I'm happy with the resolution :-).
2011-04-21 15:15:02 -04:00
Behdad Esfahbod 4d559cddbb [icu] Remove big script switch(), rely on reverse-lookup 2011-04-21 14:58:23 -04:00
Behdad Esfahbod d18431b4cd Move hb_reference_count_t from macros to inline methods 2011-04-20 18:59:10 -04:00
Behdad Esfahbod c57d454acc Rename all private sources and headers to C++ files
So we can liberally use the simple features of C++ that parts of the
codebase is already using.
2011-04-20 18:50:27 -04:00
Behdad Esfahbod f19f4f9b09 Rename hb-blob.c to hb-blob.cc in preparation of more changes 2011-04-20 18:25:56 -04:00
Behdad Esfahbod 9417c1c0d2 [API] Make hb_face_reference_table() return empty blob instead of NULL
The idea here is that:

  - Like pretty much all other API in harfbuzz, user does not have to
    check for NULL.

  - In any caller code, the case of missing table should be handled
    exactly the same way that a too-short table is handled.  Turning
    a non-existent talbe into a table of size 0 makes the user code
    safer.
2011-04-20 17:21:23 -04:00
Behdad Esfahbod c035812feb [API] Rename hb_face_get_table() to hb_face_reference_table()
That correctly reflects the reference ownership transfer happening.
2011-04-20 17:03:00 -04:00
Behdad Esfahbod 2d7b61a4b0 [TODO] Remove done items 2011-04-20 16:40:56 -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 440a76b630 [OT] Fix script to ot-script-tag conversion 2011-04-20 14:20:00 -04:00
Behdad Esfahbod a3036a3e97 Minor 2011-04-20 14:13:23 -04:00
Behdad Esfahbod 5668189c12 [API] font: move user_data before destroy()
This is the common convention for language binding tools.
2011-04-20 03:03:32 -04:00
Behdad Esfahbod e5847f75fb [API] blob: move user_data before destroy()
This is the common convention for language binding tools.
2011-04-20 02:59:28 -04:00