Commit Graph

129 Commits

Author SHA1 Message Date
Behdad Esfahbod 5570c87f21 Port objects to use header.writable instead of immutable
Saves 4 or 8 bytes per object on 64bit archs.
2018-11-03 14:59:40 -04:00
Behdad Esfahbod 04981ee05d [docs] More 2018-10-27 04:47:41 -07:00
Behdad Esfahbod 07386ea410 Remove const and references when binding Null()
Fixes https://github.com/harfbuzz/harfbuzz/issues/1299

Removes anomaly I was seeing in cpal table trying to use implicit Null(NameID).
2018-10-22 21:21:17 -07:00
Behdad Esfahbod be2f148da4 [ft] Use mutex to lock access to FT_Face
Makes our FT-backed hb_font_t safe to use from multiple threads.  Still,
the underlying FT_Face should NOT be used from other threads by client
or other libraries.

Maybe I add a lock()/unlock() public API ala PangoFT2 and cairo-ft.
Maybe not.
2018-10-09 16:24:50 -04:00
Behdad Esfahbod d18c3c5861 [ft] Remove (probably) stale comment 2018-10-09 16:09:53 -04:00
Behdad Esfahbod ec84460e46 [ot/ft] Implement get_nominal_glyphs() callback
Some more measurable speedup.  The recent commits' speedups are as follows:

Testing with Roboto, ****when disabling kern and liga****:

Before:

FT --features=-kern,-liga
user↦   0m0.521s

OT --features=-liga,-kern
user↦   0m0.568s

After:

FT --features=-liga,-kern
user↦   0m0.428s

OT --features=-liga,-kern
user↦   0m0.470s

So, 17% speedup.

Note that FT callbacks are faster than OT these days since we added an advance
cache to FT.  I don't think the difference is enough to justify adding a cache
to OT.

When not disabling kern, the thing is three times slower, so the speedups
are three times less impressive...  Still, 5% not bad for a codebase that I
otherwise thought is optimized out.

Note that, because of this and other optimiztions in our main shaper,
disabling kern and liga, the OT shaper is now *faster* than the fallback
shaper.  So, that's my recommendation to clients that need the absolute
fastest...
2018-10-09 15:07:04 -04:00
Behdad Esfahbod bee93e2697 Add const to get_*_advances API
Ouch!
2018-10-09 08:02:25 -04:00
Behdad Esfahbod 47030b1855 [ft/ot] Remove implementation of deprecated kerning funcs 2018-10-09 00:30:45 -04:00
Behdad Esfahbod 8a31e40629 [font] Make *_advance() fallback to *_advances
And remove redundant implementations.
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 7f30629cdd [ft] Make TSan happy 2018-09-26 16:40:59 -04:00
Behdad Esfahbod 383060cc33 [ft] Invalidate advance cache if font size changed 2018-09-11 14:41:19 +02:00
Behdad Esfahbod 54998befc4 [ft] Cache advances
I decided to always use the cache, instead of my previous sketch direction
that was to only allocate and use cache if fast advances are not available.
The cache is a mere 1kb, so just use it...

TODO: Invalidate cache on font size change.

Fixes https://github.com/harfbuzz/harfbuzz/issues/651
Fixes https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:36:14 +02:00
Behdad Esfahbod 047a84c5dd [ft] Towards caching slow get_h_advance results
Related to https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:05:16 +02:00
Behdad Esfahbod 237f215378 [ft] Add advances() callback 2018-09-11 13:05:47 +02:00
Behdad Esfahbod 0f520adaac Revert "Remove unused hb_cache_t"
This reverts commit 473b17af4d.

Updates to recent changes.
2018-09-11 12:07:39 +02:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Emil A Eklund 7112c6413c Guard free_static function definitions with macro
Add HB_USE_ATEXIT macros around free_static function definitions to
avoid unused function compiler warnings/errors.
2018-08-14 14:04:10 -07:00
Behdad Esfahbod 7bd508a0c4 [lazy] Rename free() 2018-08-12 17:19:55 -07:00
Behdad Esfahbod 6901090945 [lazy] Make hb_lazy_loader_t<> more usable 2018-08-12 16:59:37 -07:00
Behdad Esfahbod 53442be1ed [lazy] Use for ft_library 2018-08-12 16:20:11 -07:00
Behdad Esfahbod 7a8d480378 [lazy] Add .free() 2018-08-12 16:00:13 -07:00
Behdad Esfahbod c7ca30a533 [ot/ft] Port font_funcs statis to lazy-loader 2018-08-12 13:46:53 -07:00
Behdad Esfahbod 1f7380944d [atomic] Add hb_atomic_ptr_t<> and port all uses
Found and fixed a couple bugs.

Found a couple multithreading issues.  Marked them with "XXX-MT-bug".
2018-08-09 00:27:01 -07:00
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