Commit Graph

12540 Commits

Author SHA1 Message Date
Behdad Esfahbod 7327006d68 [GSUB] Support SingleSubst in get_glyph_alternates
Fixes https://github.com/harfbuzz/harfbuzz/discussions/4146
2023-03-07 21:06:01 -07:00
Behdad Esfahbod 69183217df Add test-gsub-get-alternates.cc 2023-03-07 20:56:56 -07:00
Behdad Esfahbod ea17c7a81a [beyond-64k] Implement gvar support
https://github.com/harfbuzz/boring-expansion-spec/issues/85
2023-03-07 14:23:39 -07:00
Behdad Esfahbod f325aba561 [VarComposites] Minor rename 2023-03-06 13:07:42 -07:00
Behdad Esfahbod d165afec1d [justify-demo] Create new fonts all the time
The hb.shape_justify() call modifies the font. This was messing
up justification. Create new fonts all the time.
2023-03-04 21:09:26 -07:00
Khaled Hosny 690145fa00 [justify-demo] Rewrite in a simpler way
No need to overthink it, append text words to the line and reshape, no
need to shape the whole text first and do complicated glyph/input
mapping. Much simpler code and as fast.
2023-03-04 07:19:20 +02:00
Behdad Esfahbod e9d6f23b5d [justify-demo] Fix for LTR typesetting 2023-03-03 17:15:18 -07:00
Behdad Esfahbod 5cf54aedde [justify-demo] Guess segment properties 2023-03-03 17:01:12 -07:00
Behdad Esfahbod 5c334b9686 [justify-demo] Fix crash if font has no variation axis 2023-03-03 16:53:44 -07:00
Behdad Esfahbod ab249fd24b [justify] Fix shrink/expand conditions 2023-03-04 01:46:07 +02:00
Khaled Hosny 039ea9adda [justify] Add demo GTK app 2023-03-04 01:44:01 +02:00
Behdad Esfahbod be47182d48 [hb-cairo] Add Black Foundry copyright 2023-03-03 11:10:16 -07:00
Behdad Esfahbod ab4c321180 [justify] Set out params in more cases 2023-03-03 09:31:16 -07:00
Khaled Hosny e57defc07c [justify] Set var_value when expanding/shrinking to max
When expanding/shrinking the buffer to max (and still not fitting), we
need to also set var_value to the axis max/min otherwise client not have
the correct axis value to draw with.
2023-03-03 09:20:29 -07:00
Behdad Esfahbod a2efa5b489 [map] Another try at fixing old Mac build
https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-03 09:15:46 -07:00
Khaled Hosny bfab56d3b5 [font] Typo 2023-03-03 13:14:05 +02:00
Khaled Hosny 60841e2618 7.1.0 2023-03-03 01:05:43 +02:00
Qunxin Liu e471ef77f9 [instancer] fix a runtime error
runtime error: -1 is outside the range of representable values of type 'unsigned int'
2023-03-02 14:13:17 -07:00
Behdad Esfahbod 43dbdd9db6 [justify] Document algorithm 2023-03-02 13:42:52 -07:00
Behdad Esfahbod c98bb4cf9c [justify] Fix up after recent changes
Oops.
2023-03-02 13:18:06 -07:00
Behdad Esfahbod fe83736e26 [sanitize] Protect against an underflow 2023-03-02 11:35:42 -07:00
Behdad Esfahbod 08784baf10 [GSUB/GPOS] Fix sanitization in Format1
Fixes https://oss-fuzz.com/testcase-detail/5120727025319936
2023-03-02 10:48:30 -07:00
Behdad Esfahbod 7897173870 [justify] Fix compiler warnings 2023-03-02 10:38:12 -07:00
Behdad Esfahbod be64cae164 [map] Another try at fixing old Mac builds
Maybe fixes https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-02 09:50:38 -07:00
Behdad Esfahbod 67e01c1292 [map] Try to work around old Mac compiler bug
Maybe fixes https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-01 20:08:17 -07:00
Khaled Hosny e359f46a20 Fix build 2023-03-02 03:06:53 +02:00
Behdad Esfahbod 25c66d633d [justify] Wrap in HB_EXPERIMENTAL_API 2023-03-01 14:23:12 -07:00
Behdad Esfahbod 96d4ed0931 [justify] Document API 2023-03-01 14:23:12 -07:00
Behdad Esfahbod d29d7b7a3d [algs] Adjust solve_itp 2023-03-01 14:23:12 -07:00
Behdad Esfahbod 93252c6fc3 [justify] Debug output 2023-03-01 14:23:12 -07:00
Behdad Esfahbod b937edfb14 [justify] Add min/max target_width
Speeds up solving when some slack available.
2023-03-01 14:23:12 -07:00
Behdad Esfahbod 6e483c4061 [shape] Add hb_shape_justify() and hb-view --width 2023-03-01 14:23:12 -07:00
Behdad Esfahbod ee4822f969 [algs] Add solve_itp method
Port from kurbo.
2023-03-01 14:23:12 -07:00
Behdad Esfahbod c67c0086ef [GPOS] Fix indexing in MarkLigPos
This was broken in 8708b9e081.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4142
2023-03-01 13:32:44 -07:00
Matthias Clasen 01d34763f0 Typo fix 2023-03-01 10:11:47 -07:00
Behdad Esfahbod 5226d69733 [font] Make set_variation() respect currently-set variations
Fixes https://github.com/harfbuzz/harfbuzz/issues/4143
2023-02-28 14:50:07 -07:00
Behdad Esfahbod 91627daee2 [outline] Rename internal function 2023-02-28 14:31:25 -07:00
Behdad Esfahbod 5c46286592 Revert "."
This reverts commit 59434578cd.
2023-02-28 12:16:46 -07:00
Behdad Esfahbod 59434578cd . 2023-02-28 12:13:55 -07:00
Behdad Esfahbod bbb9d6d436 [font] Add hb_font_set_variation() 2023-02-28 12:08:11 -07:00
Qunxin Liu a975ec4842 [instancer] apply cvar deltas 2023-02-27 17:05:23 -07:00
Qunxin Liu 8b0c7b9554 [instance] Add struct definition for cvar table
Also add functions to add cvt tables with cvar deltas applied
2023-02-27 17:05:23 -07:00
Qunxin Liu 22cc73f3e9 Move common structs for TupleVariation from gvar to var-common.hh
Also added a table_base in the iterator and related function to handle
different start address for dataoffset in cvar and gvar
2023-02-27 17:05:23 -07:00
Behdad Esfahbod 62fc27f372 [ft] Enlarge glyph-cache value-size again
8bits just doesn't do it. It has caused cache-hammering and high
CPU usage when the font is hinted.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4139
2023-02-27 11:21:32 -07:00
Behdad Esfahbod 209f63b785 [TINY] Fix config issue 2023-02-24 16:03:40 -07:00
Qunxin Liu 605aed0544 [instancer] bug fix in post table applying mvar deltas 2023-02-24 13:19:37 -07:00
Garret Rieger 918193ebf9 [subset] fix a class of fuzzer timeouts caused by large shared coverage tables.
More acurately estimates the op count for CoverageFormat2 tables as the population size instead of the size in bytes.
2023-02-22 16:57:39 -07:00
Behdad Esfahbod 33cc3121d4 Comment 2023-02-22 12:03:30 -07:00
Behdad Esfahbod 5bc6ab006d Use __has_builtin for builtin checks instead of compiler versions
https://github.com/harfbuzz/harfbuzz/issues/4066#issuecomment-1439510188
2023-02-22 08:54:18 -07:00
Behdad Esfahbod 6b286cfabf [cubic-glyf] Remove stale comment 2023-02-21 16:15:45 -07:00
Behdad Esfahbod 22b9315628 [cubic-glyf] Handle wrap-around cubic off-curves 2023-02-21 15:50:55 -07:00
Behdad Esfahbod 050f5a58fe [cubic-glyf] Handle contour-initial cubic offcurves 2023-02-21 15:26:27 -07:00
Khaled Hosny 9c27fe625f Revert "[doc] Fix a couple of gtk-doc warnings"
This reverts commit ed42b2fcb5.
2023-02-21 23:25:14 +02:00
Khaled Hosny ed42b2fcb5 [doc] Fix a couple of gtk-doc warnings 2023-02-21 23:08:15 +02:00
Khaled Hosny 0575229477 [blob] Typo in documentation 2023-02-21 18:07:53 +02:00
Khaled Hosny 1d1f93a612 7.0.1 2023-02-20 15:54:12 +02:00
Behdad Esfahbod 5b50b07717 [subset-cff] Make BCD writing locale-independent 2023-02-19 20:39:01 -07:00
Behdad Esfahbod 21ff66cbd4 [subset-cff2] Round blended Private values when instancing
Hopefully no one blends BlueScale...
2023-02-19 20:39:01 -07:00
Behdad Esfahbod a4b7033d01 [cff2-subset] Blend Private values when instancing 2023-02-19 20:39:01 -07:00
Behdad Esfahbod f10a4c9d6a [cff] Rename encode_num to encode_num_cs 2023-02-19 20:39:01 -07:00
Behdad Esfahbod c65eb5a82e [cff] Specialize cff_private_dict_op_serializer_t for CFF1/2 2023-02-19 20:39:01 -07:00
Behdad Esfahbod bf4b34e87e [subset-cff2] Don't encode vsindex in Private dict 2023-02-19 20:39:01 -07:00
Behdad Esfahbod 220caa7e09 [subset-cff2] Only encode VarStore link if any varstore 2023-02-19 20:39:01 -07:00
Behdad Esfahbod 82d9940a93 [subset-cff2] Don't encode vsindex if pinned 2023-02-19 20:39:01 -07:00
Behdad Esfahbod a88f3e8d37 [subset-cff2] Don't serialize VarStore if pinned 2023-02-19 20:39:01 -07:00
Behdad Esfahbod 8c1b47d7e2 [font] Fix compiler warnings 2023-02-19 20:38:43 -07:00
Behdad Esfahbod 7c74fc9631 [CFF] Remove unused member single_val 2023-02-19 14:43:31 -07:00
Behdad Esfahbod 2746597b69 [subset-cff2] Add flush_hintmask
Fixes https://github.com/harfbuzz/harfbuzz/issues/4125
2023-02-19 12:15:22 -07:00
Behdad Esfahbod adccc5355b [MarkBase] Adjust base-finding logic
Fixes https://github.com/harfbuzz/harfbuzz/issues/4124
2023-02-17 12:29:42 -07:00
Behdad Esfahbod 946477fa54 [font] Fix a MSVC "error"
Oh well.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4122
2023-02-16 15:04:49 -07:00
Behdad Esfahbod b41efb6c4d [atomic] Use no-op asm for compiler barrier
Fixes https://github.com/harfbuzz/harfbuzz/pull/4119
2023-02-13 21:45:20 -07:00
Khaled Hosny 552f0714e8 [meson] Fix test failure with experimental_api
Pass --experimental-api to all gen-def.py when generating all .def
files, not only harfbuzz.def.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4117
2023-02-13 09:41:51 +02:00
Khaled Hosny 8bdaeddfcd 7.0.0 2023-02-11 23:52:58 +02:00
Khaled Hosny 0ea8bbd91a [doc] Use XSince for REPLACEME/EXPERIMENTAL
To hide them from gtk-doc so that we can finally enable gtkdoc-check.
2023-02-11 20:59:44 +02:00
Khaled Hosny 16dfd263b1 [subset] Remove docs for unimplemented flags
GTK-Doc does not like this.
2023-02-11 20:59:44 +02:00
Khaled Hosny 4d25941315 [doc] Fix hb_ot_name_[id|predefined]_t
Shuffle the docs around, so that the enum values appear in documentation
as they now belong to hb_ot_name_predefined_t. The Since field will be
misleading now, though.
2023-02-11 20:59:44 +02:00
Khaled Hosny 13741e68f8 [doc] Minor 2023-02-11 20:59:44 +02:00
Behdad Esfahbod ab191d9dc7 [ot-font] Minor division rounding 2023-02-11 09:31:21 -07:00
Behdad Esfahbod c6c1c6ddf1
Merge pull request #4107 from harfbuzz/cubic-glyf
[glyf] Support cubic curves
2023-02-11 09:20:51 -07:00
Behdad Esfahbod 6ddd490191 [path-builder] Comment re cubic 2023-02-10 14:24:03 -07:00
Behdad Esfahbod 91c2f098d0 [cubic-glyf] Add HB_NO_CUBIC_GLYF 2023-02-10 14:15:16 -07:00
Qunxin Liu af1e605be2 [instancer] bug fix
It's possible that length of all_points equals to 4 for non-empty
glyphs: a composite glyph which contains only one child glyph that is
empty.
2023-02-10 12:51:27 -07:00
Behdad Esfahbod 8302da8630
Merge pull request #4097 from harfbuzz/embolden
Embolden
2023-02-10 12:50:45 -07:00
Pedro J. Estébanez b1680e9143 Use proper preprocessor checks for UWP 2023-02-10 09:39:40 -07:00
Behdad Esfahbod 737b15c5a0 [embolden] Docs 2023-02-08 17:45:59 -07:00
Behdad Esfahbod 1d9dafbfd5 [glyf] Support cubic curves
https://github.com/harfbuzz/boring-expansion-spec/issues/41
2023-02-07 22:19:45 -07:00
Behdad Esfahbod 64fa5cd482 [GPOS] Fix assert fail introduced recently
Was introduced in 8708b9e081.

If these lookups are recursed to from (Chain)Context out-of-order,
it was possible that last_base > buffer->idx, in which case we
were attaching marks to a base after them... and an assertion
was failing fortunately.

Fixes https://oss-fuzz.com/testcase-detail/6377756666757120
2023-02-07 15:52:53 -07:00
Qunxin Liu 840e1b6b84 [instancer] bug fix 2023-02-07 15:49:12 -07:00
Behdad Esfahbod 3fd9311649 [indic] Use a hb_swap() 2023-02-07 14:16:24 -07:00
Behdad Esfahbod be1c14ee0a [embolden] Adjust font_h_extents 2023-02-07 13:52:53 -07:00
Behdad Esfahbod b350122fb3 [embolden] Fix glyph_extents in hb-ft 2023-02-07 13:49:16 -07:00
Behdad Esfahbod 61a1a88940 [hb-ft] Fix --font-grade 2023-02-07 13:47:04 -07:00
Behdad Esfahbod 560a65e456 [embolden] Update glyph_extents in hb-ot-font 2023-02-07 13:46:13 -07:00
Behdad Esfahbod aef002e0d9 [embolden] Add in-place option
Adds --font-grade to hb-view and hb-shape.
2023-02-07 11:52:25 -07:00
Behdad Esfahbod ce6440fceb [buffer] Speed up merge_clusters_impl 2023-02-06 16:12:03 -07:00
Behdad Esfahbod 1930760bc2 [buffer] Fix up previous commit
85be877925 (commitcomment-99547060)
2023-02-06 15:54:09 -07:00
Behdad Esfahbod 30b84faba7 [buffer] Optimize _infos_set_glyph_flags to avoid O(n^2) behavior
85be877925 (commitcomment-99547060)
2023-02-06 15:27:13 -07:00
Behdad Esfahbod 0b97ac39ac [buffer] Optimize _infos_find_min_cluster for monotone clusters 2023-02-06 15:17:09 -07:00
Behdad Esfahbod 8708b9e081 [GPOS] Avoid O(n^2) behavior in mark-attachment
Better implementation; avoids arbitrary limit on look-back.
2023-02-06 14:51:25 -07:00
Behdad Esfahbod 661050b465 Revert "[layout] Limit how far we skip when looking back"
This reverts commit 85be877925.
2023-02-06 13:09:14 -07:00
Behdad Esfahbod b29fbd16fa [gsubgpos] Refactor skippy_iter.match() 2023-02-06 13:09:14 -07:00
Behdad Esfahbod ef2a8f722f [VarComposite] Adjust for RESET_UNSPECIFIED_AXES semantic change
https://github.com/harfbuzz/boring-expansion-spec/issues/81
2023-02-06 12:04:16 -07:00
Behdad Esfahbod cf39d316d8 [outline] Add FreeType authors copyrights 2023-02-02 15:51:22 -07:00
Matthias Clasen 061f995845 [font] Document synthetic boldness APIs 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 2119eab69f [embolden] Adjust advance values 2023-02-02 15:51:22 -07:00
Behdad Esfahbod b087266e51 [ot-font] Conditionalize emboldening 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 36dcc9a432 [ot-font] Fix emboldening CFF 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 6b3fe8ac1b [embolden] Semi-handle with negative scales 2023-02-02 15:51:22 -07:00
Behdad Esfahbod e39104ba19 [font/util] Add emboldening API, --font-bold
Needs documentation.
2023-02-02 15:51:22 -07:00
Behdad Esfahbod 4247b78e31 [outline] Comment 2023-02-02 15:51:22 -07:00
Behdad Esfahbod ae522a1372 [embolden] Rename to hb-outline 2023-02-02 15:51:22 -07:00
Behdad Esfahbod fda2f6f64e [embolden] Shuffle under hb_outline_t 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 7774bccb48 [embolden] Renames 2023-02-02 15:51:22 -07:00
Behdad Esfahbod c06f95ebe1 [embolden] Move code 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 6b4a6fbedd [embolden] Add orientation detection 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 1817f18085 [embolden] Simplify recording-pen 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 70149885a7 [font] Towards implementing emboldening 2023-02-02 15:51:22 -07:00
Garret Rieger fda200658e [subset] fix missing compiled glyph cleanup when serialization succeeds. 2023-02-02 15:25:37 -07:00
Behdad Esfahbod 9bd3259335 [cairo] Fix uninitialized value
Ouch!
2023-02-02 13:36:23 -07:00
Behdad Esfahbod 85be877925 [layout] Limit how far we skip when looking back
See comments.
2023-02-01 20:00:43 -07:00
Behdad Esfahbod d18fd3f7eb [layout] Comment 2023-01-31 16:28:49 -07:00
Behdad Esfahbod 7a4bd97e4a [layout] Build lookup accelerators lazily on-demand
Reduces memory consumption for large multi-script fonts
drastically.
2023-01-31 16:19:37 -07:00
Behdad Esfahbod 83353f13f4 [layout] Reduce memory use slightly
By using raw pointer instead of vector for subtable accelerator.

To be used for more memory saving by making subtable accelerators
lazy-loaded by shape-plans for large fonts.
2023-01-31 16:19:37 -07:00
Garret Rieger 2b6d74b42e [subset] for keep everything, don't drop any tables. 2023-01-31 11:16:53 -07:00
Behdad Esfahbod 277003d553 [ft] Fit advance cache into short int 2023-01-30 22:43:01 -07:00
Behdad Esfahbod a924bbcfce [atomic/cache] Add hb_atomic_short_t 2023-01-30 14:52:22 -07:00
Behdad Esfahbod e7a71ea15b [font] Docs 2023-01-30 11:21:08 -07:00
Behdad Esfahbod cb47dca74c [object] Handle mallocation error in set_user_data
Should make bots happy.
2023-01-29 10:57:29 -07:00
Behdad Esfahbod 548bad221c [user-data] Move methods to header file
No idea why they were in hb-static.
2023-01-29 10:11:40 -07:00
Behdad Esfahbod 02f79f60f2
Merge pull request #4092 from harfbuzz/more-cmap-cache
[ot-font] Use the cmap cache more
2023-01-29 09:36:46 -07:00
Behdad Esfahbod 784fe9ac67 [cmap] Simplify caching 2023-01-29 09:26:52 -07:00
Matthias Clasen a451aa5465 Add back a null check
This was accidentally dropped in the previous commit.
2023-01-29 11:25:28 -05:00
Behdad Esfahbod 6622e04aa1 [solver] Fix unused-variable error
223abd72b9
2023-01-29 09:06:52 -07:00
Matthias Clasen 318aa10708 [ot-font] Use the cmap cache more
Use the cmap cache for get_nominal_glyph and
get_variation_glyph as well. The first of these
is used a lot in pango.
2023-01-29 09:17:17 -05:00
Behdad Esfahbod 5da829eaf5 [font] Comments 2023-01-28 22:18:53 -07:00
Behdad Esfahbod 544dd9678c [font] Fix unlikely 2023-01-28 22:06:46 -07:00
Behdad Esfahbod c1d0daf5f1 [font] unlikely 2023-01-28 22:05:24 -07:00
Behdad Esfahbod 30ee7a21e1 [font] Typo 2023-01-28 21:48:52 -07:00
Matthias Clasen 04056d44e2 [layout] Optimize more buffer message calls
Continuation of da7b66c1f8.
2023-01-28 21:35:20 -07:00
Behdad Esfahbod f8a744d9d5 [ot-font] Add a cmap cache
Speeds up Roboto shaping by 7%, for 1kb per face.
2023-01-28 13:38:07 -07:00
Behdad Esfahbod 1b53ed3c41 [cache] Remove empty fini() 2023-01-28 13:38:07 -07:00
Behdad Esfahbod 115d572571 [cache] Add constructor 2023-01-28 13:38:07 -07:00
Khaled Hosny ae96295d67 Delete commented out include 2023-01-28 22:12:33 +02:00
Matthias Clasen 09b7fce857 Make includes relative 2023-01-28 12:09:45 -07:00
Matthias Clasen e25e4c9a52 Move GDEF table to src/OT/Layout/GDEF 2023-01-28 12:09:45 -07:00
Matthias Clasen f89fa6dcfe Move name table to src/OT/name 2023-01-28 12:09:45 -07:00
Matthias Clasen b8193357c1 [OT::Color] Drop unused includes 2023-01-28 09:54:30 -07:00
Behdad Esfahbod da7b66c1f8 [layout] Optimize buffer message calls
Those aren't exactly free. They were showing up in profiles.
2023-01-27 16:39:06 -07:00
Behdad Esfahbod 49d75ef331 [gsubgpos] Fix bug in cached ChainContextFormat2 application 2023-01-27 15:37:11 -07:00
Behdad Esfahbod d2279a204f [gsubgpos] Avoid a copy into the vector 2023-01-27 13:09:49 -07:00