Commit Graph

331 Commits

Author SHA1 Message Date
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 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 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 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
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 eb0bf3ae66 Relax inert checks
Previously, when creating an object from inert inputs (eg:
"hb_font_create(hb_face_get_empty())") we returned the inert
empty object.  This is not helpful as there are legitimate
usecases to do that.

We now never return the inert object unless allocation failed.

Tests are revised to reflect.
2015-04-09 19:16:57 -07:00
Khaled Hosny a394bb6670 [bindings] Fix *_from_string functions
Without the element-type they will be getting garbage, at least with
Python.
2015-03-22 20:29:10 +02:00
Behdad Esfahbod 3f310dc0ca Disallow changing settings on immutable face
Ouch!
2014-07-22 16:26:27 -04:00
Behdad Esfahbod 2a8c49ade0 Remove unnecessary includes 2013-12-11 20:24:20 -05:00
Behdad Esfahbod a8949df487 [introspection] Annotate Unicode / font callbacks
Should move these out of the public header...

We're "clean" of introspection warnings now.  Remaining ones are about
graphite2 / freetype types not being introspectable.
2013-09-13 20:31:07 -04: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 70303cf23b [docs/introspection] Some more annotations 2013-09-06 17:38:25 -04:00
Behdad Esfahbod 288f289997 [docs/introspection] More annotations 2013-09-06 17:30:54 -04:00
Behdad Esfahbod 2e3a07abdf Separate face source code from font
Makes documentation / introspection easier.
2013-08-27 11:46:08 -04:00
Behdad Esfahbod e05a999495 Add hb_face_[sg]et_glyph_count() 2012-11-15 16:23:21 -08:00
Behdad Esfahbod 7c8e844d92 Use namespace for OpenType tables
Avoids USHORT, SHORT, ULONG, LONG clashes with Windows API.
2012-08-28 17:57:49 -04:00
Behdad Esfahbod 4c8ac4f47e Misc minor fixes 2012-08-08 17:44:19 -04:00
Behdad Esfahbod 6f3a300138 Add hb_font_glyph_from/to_string 2012-08-07 22:13:25 -04:00
Behdad Esfahbod 368b4e7649 Minor 2012-08-06 23:06:04 -04:00
Behdad Esfahbod 66591ececf Remove unnecessary lifecycle bits
We already set recount to INVALID when destroying.
This block was not necessary.
2012-08-06 17:07:19 -07:00
Behdad Esfahbod 8fbfda920e Inline font getters 2012-08-01 19:03:46 -04:00
Behdad Esfahbod 2f87cebe10 Implement shape_plan caching
Should give us some performance boost.
2012-07-27 04:20:39 -04:00
Behdad Esfahbod ea278d3895 Partially switch ot shaper to shape_plan 2012-07-27 02:12:28 -04:00
Behdad Esfahbod 027857d041 Start adding a unified shaper access infrastructure
Add global shape_plan.  Unused so far.
2012-07-26 21:14:02 -04:00
Behdad Esfahbod 1bc1cb3603 Make source more digestable for gobject-introspection 2012-06-16 15:21:55 -04:00
Behdad Esfahbod 0594a24484 Cleanup TRUE/FALSE vs true/false 2012-06-05 20:35:40 -04:00
Behdad Esfahbod f06ab8a426 Better hide nil objects and make them const 2012-06-05 14:49:14 -04:00
Behdad Esfahbod bce095524b Add hb_font_get_glyph_name() and hb_font_get_glyph_from_name() 2012-05-28 10:45:50 -04:00
Behdad Esfahbod 20fdb0f41d Add a lock-free cache type for int->int functions
To be used for cmap and advance caching if desired.
2012-05-17 22:04:45 -04:00
Behdad Esfahbod d993e72331 Fix hb_face_set_index() 2012-05-13 16:04:36 +02:00
Behdad Esfahbod 0cd33592ab Fix possible leaks 2011-09-21 16:49:33 -04:00
Behdad Esfahbod b9415e76d7 [API] Add hb_font_set_funcs_data() 2011-08-19 19:20:30 +02:00
Behdad Esfahbod 7a750ac33e Rename table files from eg maxp-private.hh to maxp-table.hh 2011-08-17 14:19:59 +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 3897335c76 [API] Sort out get_blob API
hb_face_get_blob() renamed to hb_face_reference_blob(), returns a
reference now.

hb_face_[sg]et_index() added.

hb_face_set_upem() added.
2011-08-08 23:37:41 +02:00
Behdad Esfahbod e715784be3 Rename get_table to reference_table in all API 2011-08-08 21:43:06 +02:00
Behdad Esfahbod c605bbbb6d Remove C++ guards from source files
Where causing issues for people with MSVC.
2011-08-04 20:00:53 -04:00
Behdad Esfahbod bf8c57ba74 [API] Add hb_face_get_blob()
Need to think more about it.
2011-08-03 17:38:04 -04:00
Behdad Esfahbod 4b6317c4f4 More code shuffling 2011-07-07 23:14:42 -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 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 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 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 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 80a6833b03 [API] Add hb_*_get_empty() for all objects 2011-05-11 18:21:58 -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 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 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 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 1c9f8717eb [API] Simplify blob API, remove lock 2011-05-06 22:59:42 -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 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 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 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 c7ffe2ad5f [API Remove hb_font_funcs_copy()
Will be adding font_funcs subclassing instead.
2011-04-28 16:03:29 -04:00
Behdad Esfahbod 5fa849b77d [API] Add _set/get_user_data() for all objects 2011-04-27 21:46:01 -04:00
Behdad Esfahbod 47e71d9661 [object] Remove unnecessary use of macros 2011-04-27 16:41:08 -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 2409d5f8d7 Update Copyright headers 2011-04-21 17:14:28 -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 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 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 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 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 502f4cba3e Divide get_metrics into get_advance and get_extents
Graphite module not updated.
Bump version to 0.3.
2010-10-27 01:13:56 -04:00
Behdad Esfahbod ec6c0e54d3 Fix blob leak 2010-10-26 11:28:14 -04:00
Behdad Esfahbod 3111b8a0d5 Fix stupid bug, oops 2010-10-13 10:41:53 -04:00
Behdad Esfahbod e81d7afe6e Add hb_face_get_upem() 2010-10-04 18:18:48 -04:00
Behdad Esfahbod 645f6f265b Add is_mutable() functions
Correspond to the make_mutable() ones.
2010-10-04 17:01:01 -04:00
Behdad Esfahbod 19c0eab8cf Add getters for all setter APIs
One in particular is not a straight getter: hb_font_unset_funcs() is
special because of the specific needs of the lifecycle management of
the user_data object.
2010-10-04 16:45:21 -04:00
Behdad Esfahbod 8e577acae2 Fix blob refcounting with insane SFNT table directories 2010-09-22 17:37:02 -04:00
Behdad Esfahbod acdba3f90b Prefer C linkage 2010-07-23 15:39:27 -04:00
Behdad Esfahbod cc6d52279d De-C++ where possible
Helps with avoiding many "extern C" declarations in source files.
2010-07-23 15:00:13 -04:00
Behdad Esfahbod f97bf4f812 Make sure we initialize all callbacks upon creation
Also fixes issue with unicode callbacks never being set really.
2010-05-24 17:50:19 +01:00
Behdad Esfahbod bf36a1074a Move all callback functions in a vtable structs 2010-05-24 17:46:21 +01:00
Behdad Esfahbod 280af1bddb Let hb_face_get_table() return NULL if table not found 2010-05-20 18:33:35 +01:00
Behdad Esfahbod 750a229455 get_table() is allowed to return NULL. Use that to simplify code 2010-05-20 16:23:27 +01:00
Behdad Esfahbod 99d9ef785f Write hb_face_create_for_data() in terms of hb_face_create_for_tables()
Fixes lack of head_table initialization in create_for_tables() also.
2010-05-20 15:47:49 +01:00
Behdad Esfahbod 0a4399ca22 Fix scale issues
hb_font_set_scale() now sets the value to be used to represent a unit
pixel.  For example, if rendering a 10px font with a 26.6 representation,
you would set scale to (10 << 6).  For 10px in 16.16 you would set it to
(10 << 16).  This space should be the same space that the get_glyph_metrics
and get_kerning callbacks work in.
2010-05-19 15:45:06 -04:00
Behdad Esfahbod cf5585cfa6 Add 'head' table 2010-05-19 12:03:35 -04:00
Behdad Esfahbod 22da7fd94d Rename a few files to be C++ sources
In anticipation for buffer revamp coming.
2010-05-12 18:23:21 -04:00
Behdad Esfahbod b435ab7e29 Fix accessing tables from NULL pointer 2010-05-10 19:51:57 -04:00
Behdad Esfahbod 64d3fc8d0d Cosmetic: Rename HB_LIKELY/HB_UNLIKELY to likely/unlikely 2010-05-03 22:51:19 -04:00
Behdad Esfahbod 33d13fdda9 Rename HB_GNUC_UNUSED -> HB_UNUSED 2010-04-29 13:56:44 -04:00
Behdad Esfahbod 6f729b45b0 More contour point use 2010-04-29 03:59:06 -04:00
Behdad Esfahbod 1cebfbb063 Cleanup hb_face_create_for_data() 2010-04-23 20:49:18 -04:00
Behdad Esfahbod d6b3c83a90 Allow get_table() to return NULL 2010-04-23 19:59:53 -04:00
Behdad Esfahbod 990443e5f2 Remove lock_instance() 2010-04-23 17:53:32 -04:00
Behdad Esfahbod 33d4d4325e Zero glyph metrics before calling user callback 2010-04-23 14:56:55 -04:00
Behdad Esfahbod 1d720192b1 Fix compile warnings (HB_GNUC_UNUSED) 2010-04-23 14:39:10 -04:00
Behdad Esfahbod c755cb3e3a Change header comment 2010-04-22 00:11:43 -04:00
Behdad Esfahbod 0465e69832 Protect against NULL funcs 2009-12-20 16:25:18 +01:00
Behdad Esfahbod 850dc5bb55 Return 0 from get_glyph_nil 2009-11-05 18:26:52 -05:00
Behdad Esfahbod 85555a9533 Initialize font->klass 2009-11-05 18:25:56 -05:00
Behdad Esfahbod 2e33669291 Add hb_font_get_* 2009-11-05 13:55:41 -05:00
Behdad Esfahbod 3b59306b85 Finish FT glue. Rough and untested 2009-11-04 15:48:32 -05:00
Behdad Esfahbod 7951279b4a Implement nil font functions 2009-11-03 20:27:05 -05:00
Behdad Esfahbod 8fb3d1aa4e Start ft glue 2009-11-03 18:34:20 -05:00
Behdad Esfahbod 5ebabecef3 Move unicode_funcs to buffer 2009-11-03 15:15:07 -05:00
Behdad Esfahbod 32c65a5ca3 [HB] Add font funcs prototypes 2009-11-02 14:40:45 -05:00
Behdad Esfahbod 8d70312c7b [HB] Add hb_font_funcs_make_immutable() 2009-11-02 14:40:40 -05:00
Behdad Esfahbod 3284d05da2 [HB] Add missing initializer 2009-11-02 14:40:40 -05:00
Behdad Esfahbod af9e104028 [HB] Use nil unicode funcs in nil face 2009-11-02 14:40:38 -05:00
Behdad Esfahbod 5c44188455 [HB] Start adding Unicode funcs 2009-11-02 14:40:36 -05:00
Behdad Esfahbod d60bb8ca2a [HB] Hook Sanitizer up. Hell's breaking loose right now 2009-11-02 14:40:30 -05:00
Behdad Esfahbod 15164d9258 [HB] Fix mix warnings 2009-11-02 14:40:29 -05:00
Behdad Esfahbod 5fc22e647c [HB] Remove use of typeof() 2009-11-02 14:40:27 -05:00
Behdad Esfahbod 70e0f2a75e [HB] Make it all work again 2009-11-02 14:40:27 -05:00
Behdad Esfahbod 23c86aa000 [HB] Use face_t directly instead of ot_layout_t 2009-11-02 14:40:27 -05:00
Behdad Esfahbod b28e21b90c [HB] Rename hb-font.c to hb-font.cc 2009-11-02 14:40:27 -05:00