src/hb-ft.cc


Log

Author Commit Date CI Message
Behdad Esfahbod 447323b8 2019-01-22T12:45:40 Better fix for -Wcast-align errors
Behdad Esfahbod 81ec543d 2019-01-22T12:43:12 More -Wcast-error fixes
Behdad Esfahbod 8d05bf7d 2019-01-22T12:34:05 Fix cast-align error If compiler doesn't inline StructAtOffset, this was an error since we only disable cast-align at call-site. So, move the cast out. ../src/hb-machinery.hh: In instantiation of 'const Type& StructAtOffset(const void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:146:85: required from here ../src/hb-machinery.hh:63:12: error: cast from 'const char*' to 'const unsigned int*' increases required alignment of target type [-Werror=cast-align] { return * reinterpret_cast<const Type*> ((const char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/hb-machinery.hh: In instantiation of 'Type& StructAtOffset(void*, unsigned int) [with Type = unsigned int]': ../src/hb-font.cc:147:79: required from here ../src/hb-machinery.hh:66:12: error: cast from 'char*' to 'unsigned int*' increases required alignment of target type [-Werror=cast-align] { return * reinterpret_cast<Type*> ((char *) P + offset); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Behdad Esfahbod b900f780 2019-01-18T10:08:23 [pragma] More cast-align whitelist
Ebrahim Byagowi e4120085 2018-12-17T21:31:01 Remove redundant void from C++ sources (#1486)
Ebrahim Byagowi b2ebaa9a 2018-12-16T22:38:10 Remove redundant 'inline' from methods (#1483)
Behdad Esfahbod f99abcc3 2018-11-24T00:22:21 Add template-function convenience macros
Behdad Esfahbod b89c7fd3 2018-11-21T12:32:48 Allow defining HB_USE_ATEXIT to 0 That's better use of that value than requiring extra macro HB_NO_ATEXIT
HinTak 7ec694dd 2018-11-07T13:19:36 Use non-GRID-fitted values for metrics (#1363) * Use non-GRID-fitted values for metrics See freetype/src/base/ftobjs.c:ft_recompute_scaled_metrics() and the usage of GRID_FIT_METRICS inside. Fixes https://github.com/behdad/harfbuzz/issues/1262 * Update hb-ft.cc
Behdad Esfahbod 5570c87f 2018-11-03T14:51:38 Port objects to use header.writable instead of immutable Saves 4 or 8 bytes per object on 64bit archs.
Behdad Esfahbod 04981ee0 2018-10-27T04:40:43 [docs] More
Behdad Esfahbod 07386ea4 2018-10-22T21:18:27 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).
Behdad Esfahbod be2f148d 2018-10-09T16:24:50 [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.
Behdad Esfahbod d18c3c58 2018-10-09T16:07:55 [ft] Remove (probably) stale comment
Behdad Esfahbod ec84460e 2018-10-09T15:07:04 [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...
Behdad Esfahbod bee93e26 2018-10-09T08:01:49 Add const to get_*_advances API Ouch!
Behdad Esfahbod 47030b18 2018-10-09T00:30:45 [ft/ot] Remove implementation of deprecated kerning funcs
Behdad Esfahbod 8a31e406 2018-09-30T05:27:39 [font] Make *_advance() fallback to *_advances And remove redundant implementations.
Behdad Esfahbod 7f30629c 2018-09-26T16:40:23 [ft] Make TSan happy
Behdad Esfahbod 383060cc 2018-09-11T14:41:19 [ft] Invalidate advance cache if font size changed
Behdad Esfahbod 54998bef 2018-09-11T14:35:26 [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
Behdad Esfahbod 047a84c5 2018-09-11T14:05:16 [ft] Towards caching slow get_h_advance results Related to https://github.com/harfbuzz/harfbuzz/pull/1082
Behdad Esfahbod 237f2153 2018-09-11T13:05:47 [ft] Add advances() callback
Behdad Esfahbod 0f520ada 2018-09-11T12:02:34 Revert "Remove unused hb_cache_t" This reverts commit 473b17af4d421f4ce7ac18c769731bb2aa4088f8. Updates to recent changes.
Behdad Esfahbod c77ae408 2018-08-25T22:36:36 Rename hb-*private.hh to hb-*.hh Sorry for the noise, downstream custom builders. Please adjust.
Emil A Eklund 7112c641 2018-08-14T13:50:24 Guard free_static function definitions with macro Add HB_USE_ATEXIT macros around free_static function definitions to avoid unused function compiler warnings/errors.
Behdad Esfahbod 7bd508a0 2018-08-12T17:19:55 [lazy] Rename free()
Behdad Esfahbod 69010909 2018-08-12T16:57:06 [lazy] Make hb_lazy_loader_t<> more usable
Behdad Esfahbod 53442be1 2018-08-12T16:20:11 [lazy] Use for ft_library
Behdad Esfahbod 7a8d4803 2018-08-12T16:00:13 [lazy] Add .free()
Behdad Esfahbod c7ca30a5 2018-08-12T13:46:53 [ot/ft] Port font_funcs statis to lazy-loader
Behdad Esfahbod 1f738094 2018-08-09T00:22:37 [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".
Behdad Esfahbod 42c183f8 2018-07-27T14:55:29 Minor
prrace 2e25d8f4 2018-07-27T13:58:27 Fix unlikely leaks
Behdad Esfahbod be458eb0 2018-07-10T14:41:04 Include more basic internal headers from hb-private.hh
Behdad Esfahbod b8e406f0 2018-06-10T17:22:38 More fixes for SunStudio 12.6 build Followup to https://github.com/harfbuzz/harfbuzz/pull/1053
Ebrahim Byagowi 24b8b9b2 2018-04-23T19:03:57 Resolve clang's used-but-marked-unused warnings
Ebrahim Byagowi f24b0b97 2018-04-12T13:40:45 Update the links and revive the dead ones
Ebrahim Byagowi 70d36543 2018-03-30T05:00:28 Make atexit callbacks threadsafe (#930)
Bruce Mitchener 90218fa9 2018-01-31T20:44:45 Fix typos.
Behdad Esfahbod 0473d95e 2018-01-08T10:07:46 [ft] Use FT_Done_MM_Var() if available
Behdad Esfahbod cb43bdbc 2018-01-05T13:06:25 [ft] If there's no variations set, don't set them on hb-font
Olivier Blin 0fd89dc6 2017-12-04T18:58:41 [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
Behdad Esfahbod 93f7c165 2017-11-14T10:59:54 Revert "[glib/ucdn/icu/ft/ot] Make returned funcs inert" This reverts commit 5daf3bd4494cce6b4fb074533be9e99c4d9e0edd. 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
Behdad Esfahbod 40ec3bbb 2017-11-03T16:57:30 Consolidate debug stuff into hb-debug.hh Part of fixing https://github.com/behdad/harfbuzz/pull/605
Behdad Esfahbod 5daf3bd4 2017-10-27T16:34:01 [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...
Behdad Esfahbod 473b17af 2017-10-15T14:10:34 Remove unused hb_cache_t
Behdad Esfahbod dbdbfe3d 2017-10-15T12:11:08 Use nullptr instead of NULL
Behdad Esfahbod 4e478131 2017-10-12T10:33:16 [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()
Behdad Esfahbod e1b6d923 2017-10-11T15:51:31 Remove cast of functions to (hb_destroy_func_t) Fixes https://github.com/behdad/harfbuzz/issues/474
Behdad Esfahbod ac8c4e56 2017-08-09T22:05:08 [ft] Fix theoretical leak
Behdad Esfahbod 68af14d5 2017-08-09T17:09:21 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
Behdad Esfahbod 7647a05a 2017-01-22T17:47:49 Minor
Behdad Esfahbod 825e4040 2017-01-22T16:41:45 [hb-ft] Remove use of variable-length array Hopefully also fixes build failure on msvc.
Behdad Esfahbod 47ee34e8 2017-01-21T18:10:08 [var] Hook up variations to FreeType face hb-view correctly renders variations with ft font-funcs now. hb-ot-font needs HVAR implementation.
Behdad Esfahbod b8376b10 2017-01-20T18:19:28 Minor
Behdad Esfahbod 42c81425 2016-09-13T23:49:46 [GX] Fix build with older FreeType
Sascha Brawer 72873cf5 2016-09-13T18:40:07 Call hb_font_set_var_coords_normalized() from FT_Face coords
Behdad Esfahbod 33317310 2016-08-08T17:24:04 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
Behdad Esfahbod 34f9aa58 2016-07-20T02:35:54 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
Birunthan Mohanathas 6bf9db4f 2016-07-11T13:38:23 [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.
Behdad Esfahbod 8b5bc141 2016-02-24T19:05:23 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.
Behdad Esfahbod 31fa3892 2015-12-10T16:38:29 [ft] Use ftface->size->metrics for font extent info
Simon Cozens 6f2e6de1 2015-10-26T16:23:22 Get font ascender and descender metrics from OS/2 table.
Behdad Esfahbod c743ec58 2015-11-05T17:33:57 [ft] Fix extents with negative scales Fixes https://github.com/behdad/harfbuzz/issues/162
Behdad Esfahbod 44f82750 2015-11-04T20:40:05 [ft] Remove font funcs that do nothing
Behdad Esfahbod 7918c261 2015-11-04T20:37:49 [ft] Port ft font funcs to allocated object
Behdad Esfahbod ca97ea7a 2015-10-15T20:20:22 [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 2a9627c5641cd000e2adff0e42a0dc687b53ec70. 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
Behdad Esfahbod edeb3dab 2015-10-08T12:47:15 [ft] Add version for new API
Behdad Esfahbod 2a9627c5 2015-10-07T17:33:20 [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.
Behdad Esfahbod b8811429 2015-09-03T15:53:22 Fix Since tags Fixes https://github.com/behdad/harfbuzz/issues/103
Sascha Brawer 01c3a885 2015-06-01T13:22:01 Fix "Since:" tags Based on data from http://upstream-tracker.org/versions/harfbuzz.html Resolves #103
Behdad Esfahbod 9df099b4 2015-05-18T18:37:06 [ft] Don't set *glyph in get_glyph() if glyph not found
Behdad Esfahbod 7888a6b0 2015-01-28T12:40:40 [ft] Handle negative scales with vertical writing
Behdad Esfahbod a319d077 2015-01-23T12:44:24 [ft] Handle negative x_scale / y_scale
Chris Peterson fb85d618 2015-01-04T19:31:10 Add #ifdef HB_USE_ATEXIT to fix -Wunused-function warnings
Behdad Esfahbod f34aaba8 2014-12-28T18:56:15 [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.
Behdad Esfahbod 350f3a02 2014-12-28T17:44:26 [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 45fd9424c723f115ca98995b8f8a25185a6fc71d, which make face destroy access font tables. Now, I fixed that issue in 395b35903e052aecc97d0807e4f813c64c0d2b0b 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
Behdad Esfahbod 9a3b7488 2014-12-28T17:27:39 Remove redundant check for FT_Face_GetCharVariantIndex We require FreeType >= 2.8.3. This symbol was introduced earlier than that.
Behdad Esfahbod affacf2f 2014-12-28T16:20:31 [ft] Open blob in READONLY mode HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE is deprecated and fairly useless now.
Behdad Esfahbod 8afaf096 2014-10-02T16:40:41 [ft] Add NO_HINTING in a couple other places
Behdad Esfahbod 38fb30d7 2014-08-06T13:34:49 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
Behdad Esfahbod 83408cf8 2013-11-06T14:46:04 Fix llvm warnings on Mac Patch from Scott Fleischman. Warnings were: harfbuzz/src/hb-font-private.hh:121:42: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int') harfbuzz/src/hb-font-private.hh:126:42: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int') harfbuzz/src/hb-font-private.hh:400:85: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int') harfbuzz/src/hb-ot-layout-common-private.hh:1115:37: Implicit conversion loses integer precision: 'long long' to 'int' harfbuzz/src/hb-ft.cc:421:97: Implicit conversion loses integer precision: 'unsigned long long' to 'int' harfbuzz/src/hb-ft.cc:422:97: Implicit conversion loses integer precision: 'unsigned long long' to 'int'
Behdad Esfahbod 755b44cc 2013-10-18T11:17:42 [ft] Round metrics instead of truncate Lohit-Punjabi has a upem of 769! We were losing one unit in our code, and FreeType is losing another one... Test with U+0A06. Has an advance of 854 in the font. We were producing 852. Now we do 853, which is what FreeType is telling us.
Behdad Esfahbod ace5c7eb 2013-09-13T20:34:42 [introspection] hb-ft annotations
Behdad Esfahbod e509d35c 2013-07-11T14:56:45 [ft] hb_ft_get_glyph_from_name fails for the name of glyph id 0 Based on patch from Jonathan Kew, as reported on the mailing list.
Behdad Esfahbod 79d1007a 2013-06-13T19:01:07 If variation selector is not consumed by cmap, pass it on to GSUB This changes the semantics of get_glyph() callback and expect that callbacks return false if the requested variant is not available, and then we will call them back with variation_selector=0 and will retain the glyph for the selector in the glyph stream. Apparently most Mongolian fonts implement the Mongolian Variation Selectors using GSUB, not cmap. https://bugs.freedesktop.org/show_bug.cgi?id=65258 Note that this doesn't fix the Mongolian shaping yet, because the way that's implemented is that the, say, 'init' feature ligates the letter and the variation-selector. However, since currently the variation selector doesn't have the 'init' mask on, it will not be matched...
Behdad Esfahbod 190e19e6 2013-03-09T20:30:22 [ft] Remove TODO items that I'm not going to fix
Behdad Esfahbod 392ee974 2013-03-09T20:27:55 [ft] Remove TODO item re FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH That flag is redundant, deprecated, and ignored since April 2011. From FreeType git log: commit 8c82ec5b17d0cfc9b0876a2d848acc207a62a25a Author: Behdad Esfahbod <behdad@behdad.org> Date: Thu Apr 21 08:21:37 2011 +0200 Always ignore global advance. This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant, deprecated, and ignored. The new behavior is what every major user of FreeType has been requesting. Global advance is broken in many CJK fonts. Just ignoring it by default makes most sense. * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics, tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph), src/truetype/ttgload.h: Implement it. * docs/CHANGES: Updated.
Behdad Esfahbod 5594c2d1 2013-03-06T19:37:31 [FT] Just return if glyph name not found The fallback happens in higher level already. No need to do here.
Behdad Esfahbod e9171af5 2013-01-29T22:45:00 Bug 60053 - hb-common.cc:181:6: warning: ‘void free_langs()’ defined but not used
Behdad Esfahbod d05ac7dc 2012-11-12T10:26:50 Fix hb-ft glyph name for broken fonts that return empty glyph names
Behdad Esfahbod 21756934 2012-08-08T01:20:45 [OT] Implement fallback positioning Implemented for Arabic, Hebrew, and generic marks. Activated if no GPOS table present.
Behdad Esfahbod 271c8f89 2012-07-13T09:32:30 Minor
Behdad Esfahbod 2023e2b5 2012-07-11T19:00:30 [ft] Disable ppem setting The calculations were wrong. FreeType makes it really hard to set size and ppem independently. For now, disable it. Need to come up with a fix later.
Behdad Esfahbod cdf74445 2012-07-11T18:52:39 [ft] Use unfitted kerning if x_ppem is zero
Behdad Esfahbod 0594a244 2012-06-05T20:35:40 Cleanup TRUE/FALSE vs true/false
Behdad Esfahbod f64b2ebf 2012-06-05T19:23:29 Remove last static initializer We're free! Lazy or immediate...
Behdad Esfahbod 04aed572 2012-06-05T18:30:19 Make hb-ft static-initializer free
Behdad Esfahbod f06ab8a4 2012-06-05T12:31:51 Better hide nil objects and make them const