Commit Graph

198 Commits

Author SHA1 Message Date
Behdad Esfahbod a719e67887 [ot-font] Use atomic ops for cache serial number
This guarantees the cache is coherent.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 5248b2567b [ot-font/h-advance] Adjust varStore cache condition
This gives best performance for short strings, now that we have a h-advance cache as well.
The en-words benchmark in particular, now ot-font is faster than ft.

Second to last line is of interest:

Before:
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      29.8 ms         29.8 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.4 ms         30.4 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.5 ms         16.5 ms           42
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       18.0 ms         18.0 ms           39
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39

After:
behdad@Behdads-MacBook-Pro harfbuzz % ninja -Cbuild && build/perf/benchmark-shape --benchmark_filter=en-words
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      30.0 ms         30.0 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.3 ms         30.3 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.4 ms         16.4 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       17.6 ms         17.6 ms           40
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 12fff976b6 [ot-var] Use atomic int for cached-serial 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 0919eaa6e8 [ot-font] Remove lock around cache
Not needed.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 3548b6025f [ot-font] Cache h-advances for variable fonts 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 39a07bf3eb [ot-font] Rename cache to varStore_cache 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 970e03ecae [ot-font] Add a hb_ot_font_t struct 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 3eb7eff487 Remove varstore cache use if HB_NO_VAR 2022-05-21 15:25:53 -06:00
Behdad Esfahbod 099482a37a [ot-font] Cache v_advance varstore as well 2022-05-21 15:24:23 -06:00
Behdad Esfahbod 5336ba70f6 [HVAR] Cache VarStore region scalars 2022-05-21 15:12:14 -06:00
Behdad Esfahbod 1449498e1d [ot-font] Vertically center glyph in vertical writing fallback
Fixes https://github.com/harfbuzz/harfbuzz/issues/537
2022-03-21 21:40:07 -06:00
Behdad Esfahbod bf03d7e962 [ot-font] Use ascent+descent for fallback vertical advance
This matches what FreeType does.

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/537
2022-03-21 21:27:31 -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 370bec938b [draw] Rename internal draw_session_t to hb_draw_session_t 2022-02-13 13:21:14 -06:00
Behdad Esfahbod c681331c3f [draw] Rename internal draw_helper_t to draw_session_t 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 8b4f429000 [draw] Virtualize hb_font_draw_glyph() into hb_font_get_glyph_shape()
To be implemented in hb-ft.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 53eebc7cd2 [CONFIG] Add HB_NO_VERTICAL 2021-12-08 08:34:20 -08:00
Behdad Esfahbod 9bc5d2903a [TINY] Don't disable VORG table in any config profile
Is needed for vertical layout of CFF fonts.

Fixes https://github.com/harfbuzz/harfbuzz/discussions/3294#discussioncomment-1770313
2021-12-08 08:16:17 -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
Nathan Willis eb10ef46aa [Docs] Add GTK-Doc comments for hb-ot-font and hb-ot-shape. 2020-09-26 09:46:15 +02:00
blueshade7 82545c5e2b more coding style fixes 2019-11-26 18:34:06 +00:00
blueshade7 2e7c1239c8 minor: coding style 2019-11-26 18:34:06 +00:00
blueshade7 ff87465b40 add get_glyph_from_name & test. use hb_string_array 2019-11-26 18:34:06 +00:00
blueshade7 7b49042ef4 add cff1::get_glyph_name 2019-11-26 18:34:06 +00:00
Ebrahim Byagowi b068e25f8f [glyf] Address Behdad's reviews
Addresses https://github.com/harfbuzz/harfbuzz/pull/1999#issuecomment-539298559
* Don't check against Null pool
* Remove cryptic _tt suffix
2019-10-08 16:29:19 +03:30
Ebrahim Byagowi d73cdcf361 [ot-font] Apply font scaling before turning to int 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi 5752863640 [glyf][gvar] Make HB_NO_VAR buildable 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi ee7610181c [hmtx] Use more conventional internal API style 2019-10-06 08:59:12 +03:30
Michiharu Ariza b9ff43c162 Implement gvar table and variable glyf
Split from Ariza's "[subset] TrueType/CFF2 variable font" work on #1594
2019-10-06 08:58:40 +03:30
Ebrahim Byagowi 79ec65ae10 [ot-font] Use var vmtx side bearing in calculating v-origin 2019-10-03 14:27:51 +03:30
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 20072a2eca [metrics] Make values match their enum type naming 2019-07-30 03:48:23 +04:30
Behdad Esfahbod 77141dff7d [metrics] _-prefix internal symbol 2019-07-22 07:48:32 -04:00
Ebrahim Byagowi 772e62688c Make HB_TINY builds work again by separating the always needed part 2019-07-20 12:09:26 -07:00
Ebrahim Byagowi 29444d7e9f Don't cache ascender/descender metrics 2019-07-20 12:09:26 -07:00
Behdad Esfahbod 230adf2c41 [config] Add HB_NO_OT_FONT_GLYPH_NAMES
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-06-19 18:49:52 -07:00
Behdad Esfahbod 1432df102e [config] Disable hb-ot-font code if HB_NO_OT_FONT
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-06-19 18:32:40 -07:00
Behdad Esfahbod d7e27cd65a [config] Don't use VORG table if HB_NO_OT_FONT_CFF
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-06-18 14:38:05 -07:00
Behdad Esfahbod eb2825c7f1 Minor 2019-06-17 13:42:53 -07:00
Behdad Esfahbod a6048e4cd0 Fix build 2019-05-11 12:11:22 -07:00
Behdad Esfahbod 32d3c06b61 Disable sbix if no-color or no-ot-font-bitmap
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-05-11 11:59:18 -07:00
Behdad Esfahbod 227d85e138 Minor 2019-05-10 23:16:14 -07:00
Behdad Esfahbod 60a58aa61c Add HB_NO_OT_FONT_BITMAP
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-04-12 14:58:53 -04:00
Behdad Esfahbod 160c4d8b2d Add HB_NO_OT_FONT_CFF
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-04-12 14:57:49 -04:00
Evgeniy Reizner d29c8424c8 Typo (#1588)
Fixed a small typo.
[skip ci]
2019-02-19 20:05:00 +03:30
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