Commit Graph

106 Commits

Author SHA1 Message Date
Behdad Esfahbod 42c183f803 Minor 2018-07-27 14:55:29 -07:00
prrace 2e25d8f491 Fix unlikely leaks 2018-07-27 14:54:08 -07:00
Behdad Esfahbod be458eb059 Include more basic internal headers from hb-private.hh 2018-07-10 14:41:04 +02:00
Behdad Esfahbod b8e406f0c7 More fixes for SunStudio 12.6 build
Followup to https://github.com/harfbuzz/harfbuzz/pull/1053
2018-06-10 17:22:38 -04:00
Ebrahim Byagowi 24b8b9b227 Resolve clang's used-but-marked-unused warnings 2018-04-23 11:38:45 -07:00
Ebrahim Byagowi f24b0b9728 Update the links and revive the dead ones 2018-04-12 13:44:32 +04:30
Ebrahim Byagowi 70d36543aa Make atexit callbacks threadsafe (#930) 2018-03-29 17:30:28 -07:00
Bruce Mitchener 90218fa93c Fix typos. 2018-01-31 08:18:15 -08:00
Behdad Esfahbod 0473d95e27 [ft] Use FT_Done_MM_Var() if available 2018-01-08 10:07:46 +00:00
Behdad Esfahbod cb43bdbc2f [ft] If there's no variations set, don't set them on hb-font 2018-01-05 13:06:25 +00:00
Olivier Blin 0fd89dc61c [hb-ft] Fix build when Multiple Master font support is disabled in freetype
FT_Set_Var_Blend_Coordinates() is not available when "Multiple Master
font interface" is disabled in freetype's modules.cfg
2017-12-04 10:52:06 -08:00
Behdad Esfahbod 93f7c1652a Revert "[glib/ucdn/icu/ft/ot] Make returned funcs inert"
This reverts commit 5daf3bd449.

If other atexit callbacks try to destruct the objects we destruct
in atexit callbacks, bad things will happen.

I'll come up with some other way to catch premature destruction
of HB-owned objects.

Fixes https://github.com/behdad/harfbuzz/issues/618
2017-11-14 10:59:54 -08:00
Behdad Esfahbod 40ec3bbb55 Consolidate debug stuff into hb-debug.hh
Part of fixing https://github.com/behdad/harfbuzz/pull/605
2017-11-03 17:18:17 -04:00
Behdad Esfahbod 5daf3bd449 [glib/ucdn/icu/ft/ot] Make returned funcs inert
Such that client cannot accidentally destroy them, even though that
will be a bug in their code...
2017-10-27 16:37:11 -06:00
Behdad Esfahbod 473b17af4d Remove unused hb_cache_t 2017-10-15 14:11:09 +02:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod 4e4781319b [ft] Add hb_ft_font_changed()
When the font size or variations settings on underlying FT_Face change,
one can call hb_ft_font_changed() and continue using hb_font created using
hb_ft_font_create().

Fixes https://github.com/behdad/harfbuzz/issues/559

New API:
hb_ft_font_changed()
2017-10-12 10:33:16 +02:00
Behdad Esfahbod e1b6d92302 Remove cast of functions to (hb_destroy_func_t)
Fixes https://github.com/behdad/harfbuzz/issues/474
2017-10-11 15:51:31 +02:00
Behdad Esfahbod ac8c4e56d8 [ft] Fix theoretical leak 2017-08-09 22:05:08 -07:00
Behdad Esfahbod 68af14d5cc Protect against div-by-zero in CBDT extent code
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1452#c5

CC https://github.com/behdad/harfbuzz/issues/139
2017-08-09 17:09:21 -07:00
Behdad Esfahbod 7647a05a0b Minor 2017-01-22 17:47:49 -08:00
Behdad Esfahbod 825e40407d [hb-ft] Remove use of variable-length array
Hopefully also fixes build failure on msvc.
2017-01-22 16:41:45 -08:00
Behdad Esfahbod 47ee34e847 [var] Hook up variations to FreeType face
hb-view correctly renders variations with ft font-funcs now.
hb-ot-font needs HVAR implementation.
2017-01-21 18:10:08 -08:00
Behdad Esfahbod b8376b1090 Minor 2017-01-20 18:19:28 -08:00
Behdad Esfahbod 42c8142531 [GX] Fix build with older FreeType 2016-12-16 19:06:26 -06:00
Sascha Brawer 72873cf522 Call hb_font_set_var_coords_normalized() from FT_Face coords 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 333173103b Fix sign of shift operators
This one:

  map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);

before the fix, the shift was done as an int, causing overflow
if it ever got to 1 << 31.  Sprinkle 'u's around.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
2016-08-08 17:28:14 -07:00
Behdad Esfahbod 34f9aa582c Implement symbol cmap in ft and ot fonts
Fixes https://github.com/behdad/harfbuzz/issues/236
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=627953
2016-07-20 02:35:54 -07:00
Birunthan Mohanathas 6bf9db4f1e [ft] Fix unsafe cast of FT_Done_Face in hb_ft_{face,font}_create_referenced (#289)
Prior to this change the function `FT_Error FT_Done_Face(FT_Face *)` was
called through a pointer with the signature `void (void *)` resulting in
undefined behaviour.
2016-07-11 13:38:23 -07:00
Behdad Esfahbod 8b5bc141cd Add get_nominal_glyph() and get_variation_glyph() instead of get_glyph()
New API:
- hb_font_get_nominal_glyph_func_t
- hb_font_get_variation_glyph_func_t
- hb_font_funcs_set_nominal_glyph_func()
- hb_font_funcs_set_variation_glyph_func()
- hb_font_get_nominal_glyph()
- hb_font_get_variation_glyph()

Deprecated API:
- hb_font_get_glyph_func_t
- hb_font_funcs_set_glyph_func()

Clients that implement their own font-funcs are encouraged to replace
their get_glyph() implementation with a get_nominal_glyph() and
get_variation_glyph() pair.  The variation version can assume that
variation_selector argument is not zero.
2016-02-24 19:05:23 +09:00
Behdad Esfahbod 31fa389294 [ft] Use ftface->size->metrics for font extent info 2015-12-10 16:38:29 +01:00
Simon Cozens 6f2e6de1fa Get font ascender and descender metrics from OS/2 table. 2015-11-27 16:03:54 -05: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 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 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 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 b8811429b6 Fix Since tags
Fixes https://github.com/behdad/harfbuzz/issues/103
2015-09-03 15:53:22 +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 9df099b483 [ft] Don't set *glyph in get_glyph() if glyph not found 2015-05-18 18:37:46 -07:00
Behdad Esfahbod 7888a6b07a [ft] Handle negative scales with vertical writing 2015-01-28 12:40:40 -08:00
Behdad Esfahbod a319d0777b [ft] Handle negative x_scale / y_scale 2015-01-23 12:44:24 -08:00
Chris Peterson fb85d618f5 Add #ifdef HB_USE_ATEXIT to fix -Wunused-function warnings 2015-01-04 19:31:10 -08:00
Behdad Esfahbod f34aaba868 [ft] Don't set font ppem
For discussion see:

  http://lists.freedesktop.org/archives/harfbuzz/2012-April/001905.html

Over time we have had added NO_HINTING all over the place in hb-ft.  Finish it off.
Not setting ppem on hb-font disables get_contour_point() calls which is good anyway.

See comments in the commit.
2014-12-28 18:56:15 -08:00
Behdad Esfahbod 350f3a02ce [ft] Add hb_ft_face_create_referenced() and hb_ft_font_create_referenced()
When I originally wrote hb-ft, FreeType objects did not support reference
counting.  As such, hb_ft_face_create() and hb_ft_font_create() had a
"destroy" callback and client was responsible for making sure FT_Face is
kept around as long as the hb-font/face are alive.

However, since this was not clearly documented, some clienets didn't
correctly did that.  In particular, some clients assumed that it's safe
to destroy FT_Face and then hb_face_t.  This, indeed, used to work, until
45fd9424c7, which make face destroy access
font tables.

Now, I fixed that issue in 395b35903e since
the access was not needed, but the problem remains that not all clients
handle this correctly.  See:

  https://bugs.freedesktop.org/show_bug.cgi?id=86300

Fortunately, FT_Reference_Face() was added to FreeType in 2010, and so we
can use it now.  Originally I wanted to change hb_ft_face_create() and
hb_ft_font_create() to reference the face if destroy==NULL was passed in.
That would improve pretty much all clients, with little undesired effects.
Except that FreeType itself, when compiled with HarfBuzz support, calls
hb_ft_font_create() with destroy==NULL and saves the resulting hb-font on
the ft-face (why does it not free it immediately?).  Making hb-face
reference ft-face causes a cycling reference there.  At least, that's my
current understanding.

At any rate, a cleaner approach, even if it means all clients will need a
change, is to introduce brand new API.  Which this commit does.

Some comments added to hb-ft.h, hoping to make future clients make better
choices.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=75299
2014-12-28 17:59:28 -08:00
Behdad Esfahbod 9a3b74884b Remove redundant check for FT_Face_GetCharVariantIndex
We require FreeType >= 2.8.3.  This symbol was introduced earlier
than that.
2014-12-28 17:27:39 -08:00
Behdad Esfahbod affacf2f37 [ft] Open blob in READONLY mode
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE is deprecated and fairly
useless now.
2014-12-28 16:20:31 -08:00
Behdad Esfahbod 8afaf09687 [ft] Add NO_HINTING in a couple other places 2014-10-02 16:40:41 -04:00
Behdad Esfahbod 38fb30d742 Use atexit() only if it's safe to call from shared library
Apparently they are not (advertised as?) safe on BSD systems.
We ignore the case of static libraries.

Whitelisted on glibc, Android, and MSVC / mingw.

https://bugs.freedesktop.org/show_bug.cgi?id=82246
2014-08-06 13:34:49 -04:00