Commit Graph

177 Commits

Author SHA1 Message Date
Behdad Esfahbod fc4d42ff99 [ft] Add API to notify that hb_font_t changed
New API:
- hb_ft_hb_font_changed()

Mostly reverts 56e0ff9ea1

Related https://github.com/harfbuzz/harfbuzz/issues/2270

Fixes https://github.com/harfbuzz/harfbuzz/issues/3619
2022-06-01 14:12:38 +01:00
Behdad Esfahbod 80c49933c6 [hb-ft] Adjust serial signature 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 56e0ff9ea1 [ft] If hb_font changed, update FT_Face
Fixes https://github.com/harfbuzz/harfbuzz/issues/2270

Rather untested.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 8629df188a [ft] Discard advance cache if font changed
Uses newly added font serial API.

Part of https://github.com/harfbuzz/harfbuzz/issues/2270

But doesn't set new coords on the FT_Face. That's a lot more
work :(.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 05e82aa12e [ft] Add missing lock to kerning function 2022-05-20 17:36:59 -06:00
Behdad Esfahbod 55804e8d68 [hb-ft] Minor rearrange of struct members
To make clear what members the lock protects.
2022-05-20 11:40:44 -06:00
Behdad Esfahbod 6d0e67dee0 [ot-font] Only use vmtx side-bearing if table exists
Part of fixing https://github.com/harfbuzz/harfbuzz/issues/537
2022-03-21 21:07:28 -06:00
Behdad Esfahbod 59067db9f4 [font/draw] Slant drawings
Need to update hb_font_set_synthetic_slant() docs now that we do this.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 6d5b998f25 [ft/draw] Implement hb-draw for hb-ft 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 002a1f70b8 [ft] Disable vertical funcs if HB_NO_VERTICAL 2021-12-08 10:45:30 -08:00
Behdad Esfahbod ed1163208d Call atexit() via hb_atexit()
Part of https://github.com/harfbuzz/harfbuzz/issues/3197
2021-09-14 07:11:46 -04:00
Behdad Esfahbod 2337f0d047 Internally use hb_malloc/.../hb_free instead of malloc/.../free
Redefining those stock names as macros was conflicting with gcc 10
headers.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Behdad Esfahbod 12a283d513 m[ft] No need to use atomic ops for cached_x_scale
We have added a mutex since, so no need for atomicity.
2021-02-22 12:51:09 -07:00
Khaled Hosny 9936490c04 [docs] Invalid use of "optional" annotation
It is valid only for out and inout parameters.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1787
2020-12-30 19:21:49 -08:00
Khaled Hosny a31a51cdec [docs] Complete hb-ft docs a bit 2020-12-30 19:21:49 -08:00
Khaled Hosny c7b2e64c6d [docs] make it clear that FT_Face must have size
Fixes https://github.com/harfbuzz/harfbuzz/issues/2590
2020-12-30 11:50:49 -08:00
Khaled Hosny 22468c8a90 [docs] Give destroy callbacks have (optional) annotation 2020-12-24 22:38:06 +02:00
Behdad Esfahbod 26b9670d99 [ft] Better handle allocation failures
Fixes https://github.com/harfbuzz/harfbuzz/issues/2513
2020-06-28 14:52:15 -07:00
Sebastian Rasmussen 2267da4ee0
[ft] Do not deference ft_font if it is nullptr (#2502) 2020-06-27 20:18:16 -07:00
Sebastian Rasmussen dbf9896e7a
[ft] Handle nullptr when destroying freetype font (#2494) 2020-06-27 19:57:34 -07:00
Behdad Esfahbod a11db0b9d4
Merge branch 'master' into usermanual-integration 2020-04-23 15:32:43 -07:00
Ebrahim Byagowi f9bc373381 2.6.5 2020-04-17 23:49:56 +04:30
n8willis b57b904242
Add detail to hb_ft_font_create inline comments
Providing lengthier explanation for how the destroy function works on the hb_font_t but that destroying the FT_Face (and not destroying it too early) remains the client's responsibility.
2020-04-15 18:46:31 +01:00
n8willis 1bca2be256
Rewrite hb_ft_font_set_funcs inline explanation 2020-04-15 18:30:47 +01:00
n8willis 80c01d7687
Update hb-ft.cc 2020-04-15 18:08:55 +01:00
n8willis 9b91669cb4
Update hb-ft.cc 2020-04-13 16:40:15 +01:00
Behdad Esfahbod d5338ba189 [ft] Add locking FT_Face API
Now that we mutex our internal FT_Face, share it with clients.

New API:
- hb_ft_font_lock_face()
- hb_ft_font_unlock_face()
2019-11-22 16:22:27 -05:00
Behdad Esfahbod e4a101ed38 [ft] Fix for HB_NO_VAR build 2019-11-19 20:04:00 -05:00
Ebrahim Byagowi bb41b74fd1 Don't rely on undefined left shift of negative value behavior
Fixes this -fno-sanitize-recover=undefined check,

hb-ft.cc:869:27: runtime error: left shift of negative value -16384
    #0 0x7ff8f47da843 in hb_ft_font_set_funcs /home/ebrahim/Desktop/harfbuzz/src/hb-ft.cc:869:27
    #1 0x55f20a66c7d6 in font_options_t::get_font() const /home/ebrahim/Desktop/harfbuzz/util/options.cc:731:3
    #2 0x55f20a668c1f in shape_consumer_t<output_buffer_t>::init(hb_buffer_t*, font_options_t const*) /home/ebrahim/Desktop/harfbuzz/util/./shape-consumer.hh:47:42
    #3 0x55f20a668441 in main_font_text_t<shape_consumer_t<output_buffer_t>, 2147483647, 0>::main(int, char**) /home/ebrahim/Desktop/harfbuzz/util/./main-font-text.hh:75:14
    #4 0x55f20a667f91 in main /home/ebrahim/Desktop/harfbuzz/util/hb-shape.cc:180:21
    #5 0x7ff8f3df7ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
    #6 0x55f20a6427ad in _start (/home/ebrahim/Desktop/harfbuzz/util/.libs/lt-hb-shape+0xd7ad)
2019-09-18 23:16:52 +04:30
Khaled Hosny 0954c8f7a0 [ft] Prefer symbol cmap subtable if found (#1948)
Similar to commit d304d60e4d for ot-font.
2019-09-01 10:09:07 -05:00
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Ebrahim Byagowi 9fea6b4dd4
[amalgam] Use it in cmake port and fix conflicts (#1812) 2019-07-05 18:46:41 +04:30
Behdad Esfahbod aa3450cac1 [config] Don't compile disabled features
This makes it possible to include all .cc files into build, even if not
building CoreText, Uniscribe, etc.

This was mostly to help custom builders.  But also means that we can
include all files in our own build system.  Not sure if we should.
Definitely simplifies things, but slightly only.
2019-06-17 22:41:49 -07:00
Behdad Esfahbod bfb5569d53 Disable non-OpenType kerning with hb-ft in HB_TINY 2019-06-17 14:06:04 -07:00
Behdad Esfahbod 896416bd4c Partially revert "[ft/ot] Remove implementation of deprecated kerning funcs"
This reverts commit 47030b1855.

Reverts only the hb-ft part, to reinstate non-OpenType kerning with
FreeType.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1682
2019-06-17 13:39:49 -07:00
Nathan Willis 9126a5ff07 [Docs] Add gtk-doc comments to hb-ft. 2019-05-20 17:37:56 +01:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod 54ece299bc Use type aliasing for meta-functions, ie. those returning a type 2019-04-16 16:45:53 -04:00
Behdad Esfahbod b986c6a321 [C++11] Remove IntType::set() in favor of operator= 2019-03-29 20:21:21 -07:00
Behdad Esfahbod 447323b85a Better fix for -Wcast-align errors 2019-01-22 12:50:12 +01:00
Behdad Esfahbod 81ec543d80 More -Wcast-error fixes 2019-01-22 12:43:12 +01:00
Behdad Esfahbod 8d05bf7dc0 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); }
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-22 12:34:05 +01:00
Behdad Esfahbod b900f78088 [pragma] More cast-align whitelist 2019-01-18 10:08:23 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod f99abcc379 Add template-function convenience macros 2018-11-24 00:24:01 -05:00
Behdad Esfahbod b89c7fd3dc Allow defining HB_USE_ATEXIT to 0
That's better use of that value than requiring extra macro HB_NO_ATEXIT
2018-11-21 12:32:48 -05:00
HinTak 7ec694ddf2 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
2018-11-07 08:19:36 -05:00
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