Commit Graph

244 Commits

Author SHA1 Message Date
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
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
Michiharu Ariza 32d291ae89 Merge branch 'master' into cff-subset 2018-11-28 16:27:45 -08: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
Michiharu Ariza 892ab37e7c Merge branch 'master' into cff-subset 2018-11-14 13:54:07 -08:00
Ebrahim Byagowi 7867c2bad0
[STAT] Add table parsing (#1384) 2018-11-14 22:13:50 +03:30
Michiharu Ariza 43ee0e4d00 Merge branch 'master' into cff-subset 2018-11-06 09:57:17 -08:00
Behdad Esfahbod 9198de7b9b [ot-font] Remove ensure 2018-11-05 23:10:37 -05:00
Behdad Esfahbod 0fe7a745c9 [ot-face] Simplify more table access 2018-11-05 23:10:18 -05:00
Behdad Esfahbod 914b595f25 [ot-face] Include hb-ot-face directly in hb_face_t
Simplifying access coming next.
2018-11-05 23:10:12 -05:00
Behdad Esfahbod 56ba998cdd [cmap] Push get_nominal_glyphs down into cmap accelerator 2018-11-05 19:49:54 -05:00
Behdad Esfahbod 03348ce005 Minor 2018-11-05 12:59:32 -05:00
Michiharu Ariza e600e5440b Merge branch 'master' into cff-subset 2018-11-01 16:13:56 -07:00
Ebrahim Byagowi c929ccfcea [ot-color/png] Consider strike ppem on scaling 2018-10-28 22:40:40 -07:00
Behdad Esfahbod 01c7d53fb7 [sbix] Select best strike based on ppem 2018-10-28 18:33:10 -07:00
Behdad Esfahbod f9f26bff4c [sbix] Move code around. Add get_extents() 2018-10-28 18:33:10 -07:00
Ebrahim Byagowi 632e9af862 [ot-color] Implement PNGHeader and test it, it doesn't work however 2018-10-28 18:33:10 -07:00
Ebrahim Byagowi 38706a0746 [ot-color] Preparation for setting PNG width/height in extents 2018-10-28 18:33:10 -07:00
Behdad Esfahbod d6d6f3bc22 [docs] Add comment 2018-10-28 18:33:10 -07:00
Behdad Esfahbod 80d9a427cf [docs] Document remaining sections 2018-10-27 04:58:32 -07:00
Michiharu Ariza e1241636d6 Merge branch 'master' into cff-subset 2018-10-23 11:25:51 -07:00
Behdad Esfahbod 48ed598a35 [VORG] Hook up to hb-ot-font's v_origin
Fixes https://github.com/harfbuzz/harfbuzz/issues/544

Test added with NotoSansCJK, eg. with U+FF38.
2018-10-23 02:21:27 -07:00
Michiharu Ariza 9ade3e7bb8 Merge branch 'master' into cff-subset 2018-10-15 14:03:23 -07:00
Behdad Esfahbod 8dc6296818 [ot-font] Implement TrueType v_origin
Fixes https://github.com/harfbuzz/harfbuzz/issues/537
2018-10-15 01:09:05 -07:00
Michiharu Ariza c06a5dff0b Merge branch 'master' into cff-subset 2018-10-09 22:00:10 -07:00
Behdad Esfahbod 5515355367 [ot-font] Don't pre-load cmap table
Now that we have get_h_advances() and get_nominal_glyphs() implemented, the
overhead of doing a proper atomic load would be once per run, NOT once per
glyph.  So, no need to pre-load the tables to avoid that overhead.

As such, hb_ot_font_set_funcs() has become really cheap.  Can *finally* make
it be default font functions on all newly created fonts!
2018-10-09 15:12:09 -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
Michiharu Ariza f5f505b512 Merge branch 'master' into cff-subset 2018-10-09 10:10:35 -07:00
Behdad Esfahbod bee93e2697 Add const to get_*_advances API
Ouch!
2018-10-09 08:02:25 -04:00
Michiharu Ariza 8b349040e9 Merge branch 'master' into cff-subset 2018-10-08 21:46:23 -07:00
Behdad Esfahbod 47030b1855 [ft/ot] Remove implementation of deprecated kerning funcs 2018-10-09 00:30:45 -04:00
Michiharu Ariza a90fd8b9fe Merge branch 'master' into cff-subset 2018-10-08 15:07:58 -07:00
Michiharu Ariza b51418f596 added CFF2 get_extents
added source hb-ot-cff2-table.cc
augmented VariationData to return scalars
misc bug fixes, renaming, cleanup
2018-10-08 15:05:36 -07:00
Behdad Esfahbod 13da3be0b3 [ot-font] Load hmtx/vmtx lazily
Since we have get_*_advanes() API now, the overhead is once per shape,
not once per glyph.

Only cmap is warmed-up at set_funcs() time now.
2018-10-07 18:25:41 +02:00
Behdad Esfahbod 856db4c918 Minor 2018-10-07 18:21:15 +02:00
Michiharu Ariza 3dd43f0234 Merge branch 'master' into cff-subset 2018-10-01 10:22:06 -07:00
Behdad Esfahbod 8a31e40629 [font] Make *_advance() fallback to *_advances
And remove redundant implementations.
2018-09-30 06:08:11 -04:00
Michiharu Ariza c0c85b852d implemented get_glyph_extents with CFF1
Implemented path operators in a new struct PathProc hooked up to CSOpSet
Added current point to CSInterpEnv
2018-09-17 11:14:56 -07:00
Michiharu Ariza 45e564a519 Merge branch 'master' into cff-subset 2018-09-11 09:46:37 -07:00
Behdad Esfahbod cbea7d49ab [ot-font] Rename 2018-09-11 12:57:41 +02:00
Behdad Esfahbod d8a67dac2a [ot-font] Add advances() callbacks 2018-09-11 12:55:54 +02:00
Michiharu Ariza 8af9690ac7 Merge branch 'master' into cff-subset
Renamed cff "private" source/headers without the suffix
2018-08-29 13:26:17 -07:00
Behdad Esfahbod a268068010 [ot-face] Remove tables_t. The face_data_t is what tables_t was 2018-08-26 15:18:46 -07:00
Behdad Esfahbod 3a0b3a29cc Free up hb-ot-face.hh from includes
There might be a better way to do this, but I couldn't find...
2018-08-26 15:11:24 -07:00
Behdad Esfahbod e6cb938065 [ot-face] Unify accelerators and tables 2018-08-26 00:21:29 -07:00
Behdad Esfahbod 59bca0d2cb [ot-font] Rename 2018-08-26 00:06:12 -07:00
Behdad Esfahbod 1c48a7ef06 [ot-font] Cache tables on face, not font 2018-08-25 23:57:16 -07:00
Behdad Esfahbod 71f8893eff [ot-font] Use init0 2018-08-25 23:27:45 -07:00
Behdad Esfahbod f36ae6f8a8 [ot-font] Make everything (cmap/metrics) lazy 2018-08-25 23:26:45 -07:00
Behdad Esfahbod 62fc54725a [ot-font] Fallback vertical advance to UPEM
Used to be ascent+descent.  Whatever. This is more convenient for
upcoming changes.
2018-08-25 23:15:52 -07: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
Michiharu Ariza fdbfa1848b renamed CFF version 1 structs and sources to CFF1 from CFF
"CFF" is used for shared structs & sources between CFF1 & CFF2
except OT:cff is for CFF version 1 table
2018-08-16 00:13:09 -07:00
Michiharu Ariza 25b8310b2a Merge branch 'master' into cff-subset 2018-08-15 15:00:55 -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