Commit Graph

12502 Commits

Author SHA1 Message Date
Behdad Esfahbod 1a716bad03 [subset-plan] Simplify gsub_features and gpos_features allocation 2023-01-11 10:51:48 -07:00
Behdad Esfahbod 78aa9f1e9c [subset-plan] Simplify name_ids allocation 2023-01-11 10:47:40 -07:00
Behdad Esfahbod cfb48f91da [subset-plan] Simplify name_languages allocation 2023-01-11 10:45:26 -07:00
Behdad Esfahbod e4ca0fe436 [subset-plan] Simplify layout_features allocation 2023-01-11 10:43:01 -07:00
Behdad Esfahbod 4de66eec57 [subset-plan] Simplify layout_scripts allocation 2023-01-11 10:40:54 -07:00
Behdad Esfahbod 5f51dd276b [ft-colr] Minor use false instead of 0 2023-01-10 22:57:07 -07:00
Behdad Esfahbod f84a8e3289 [ft-colr] Comment 2023-01-10 22:43:42 -07:00
Behdad Esfahbod bf16dad55a [paint-extents] Return unbounded on memory allocation failure 2023-01-10 17:29:25 -07:00
Behdad Esfahbod 3e1c524e64 [bit-page] Comment 2023-01-10 17:18:34 -07:00
Behdad Esfahbod 626def03f8 [hmtx] Remove TODO items 2023-01-10 17:12:50 -07:00
Behdad Esfahbod adf0bd6dcd [test-map] Add a test 2023-01-10 17:05:19 -07:00
Behdad Esfahbod 4fd0354067 [font] Docs 2023-01-10 14:32:08 -07:00
Behdad Esfahbod bfd7548e24 [aat] Optimize feature-range application 2023-01-10 13:31:58 -07:00
Behdad Esfahbod dd42939e31 [aat] Reduce unsafe_to_concat calls 2023-01-10 13:23:19 -07:00
Behdad Esfahbod fecce62a45 [ft] Docs 2023-01-10 13:13:43 -07:00
Behdad Esfahbod cb509d9c89 [face] Docs 2023-01-10 13:11:48 -07:00
Behdad Esfahbod 8a2efbd8a1 [upem] More docs 2023-01-10 13:10:36 -07:00
Behdad Esfahbod ccffce58cc [scale] More docs 2023-01-10 13:09:30 -07:00
Behdad Esfahbod c4580d8670 [scale] More docs 2023-01-10 12:56:02 -07:00
Behdad Esfahbod f0e695a3a9 [scale] Comment 2023-01-10 12:55:17 -07:00
Behdad Esfahbod 8c47580ac8 [scale] Document 2023-01-10 12:53:54 -07:00
Behdad Esfahbod 8b17c6ca30 [aat] Comment 2023-01-10 12:17:38 -07:00
Behdad Esfahbod 0e11d317ee [aat] Optimize feature application 2023-01-10 12:16:04 -07:00
Behdad Esfahbod a70543daf3 [aat] Always unsafe-to-concat in state machine 2023-01-10 11:49:48 -07:00
Behdad Esfahbod 62383315fa [aat] Try fix leak on memory allocation failure 2023-01-10 11:29:04 -07:00
Behdad Esfahbod e122fe2acf [aat] Adjust last range
Otherwise a user cluster value of -1 would have tripped us.
2023-01-10 11:08:21 -07:00
Behdad Esfahbod e28c158c35 [aat] Run subtable across ranges if flags match 2023-01-10 11:08:21 -07:00
Behdad Esfahbod 2c9c49fd32 [aat] Support ranges in NonContextual subtable as well 2023-01-10 11:08:21 -07:00
Behdad Esfahbod c08308a83c [aat] Always generate a feature range 2023-01-10 11:08:21 -07:00
Behdad Esfahbod db4c874758 Revert "Revert "[aat] Support feature ranges""
This reverts commit 6a7a38521f.
2023-01-10 11:08:21 -07:00
Behdad Esfahbod 0728098e45 [Coverage] Speed up subset for too-large Coverage tables
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54980
2023-01-10 10:19:00 -07:00
Behdad Esfahbod 6a7a38521f Revert "[aat] Support feature ranges"
This reverts commit 1b7994cb3a.

Broke Zapfino with partial ligature disabling. Debugging.
2023-01-09 21:29:39 -07:00
Behdad Esfahbod adfd5dd7a9 Fix TINY build 2023-01-09 21:18:12 -07:00
Behdad Esfahbod 1b7994cb3a [aat] Support feature ranges
The hard way...

A bit uglier than I liked it to be, but is proper at least.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4020
2023-01-09 21:16:20 -07:00
Behdad Esfahbod 622a686952 Revert "Revert "Revert "[aat] Allow disable feature ranges"""
This reverts commit 5202053c2c.
2023-01-09 21:16:20 -07:00
Behdad Esfahbod 5202053c2c Revert "Revert "[aat] Allow disable feature ranges""
This reverts commit 82b3e8af69.

Another try.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4020
2023-01-09 17:59:09 -07:00
Behdad Esfahbod 82b3e8af69 Revert "[aat] Allow disable feature ranges"
This reverts commit 24a4d397ba.

This was broken.
2023-01-09 17:28:52 -07:00
Behdad Esfahbod 24a4d397ba [aat] Allow disable feature ranges
Fixes https://github.com/harfbuzz/harfbuzz/issues/4020

This is a hack.

To implement this properly we need to treat runs with different features
as independent runs for running the state machine, as the subtable flags
might be different. That would be a significant change to our internal
implementation.
2023-01-09 17:26:48 -07:00
Behdad Esfahbod 3ff713ab80 [coretext] Remove unused variable 2023-01-09 14:19:25 -07:00
Behdad Esfahbod 4148487556 [ft] Comment 2023-01-09 13:47:59 -07:00
Behdad Esfahbod d2aa2397ba Optimize non-slant extents code 2023-01-09 13:44:44 -07:00
Behdad Esfahbod 73dab7f784 [ft] Fix slanting code 2023-01-09 13:44:44 -07:00
Behdad Esfahbod 0275151490 [paint] Align deptch/edge count conditions across two backends 2023-01-09 12:27:09 -07:00
Behdad Esfahbod 839f4b6494 [ft] Fix slanting clip box 2023-01-09 12:01:46 -07:00
Behdad Esfahbod 30adbc22d9 hb-font: Fix scale_glyph_extents() again
And better fix this time.
2023-01-09 11:54:44 -07:00
Behdad Esfahbod 6c1a4bed4a Better rounding clip boxes 2023-01-09 11:37:39 -07:00
Behdad Esfahbod f46dcf147b [paint/COLR] Fix clip transform
Sigh. So complicated.
2023-01-08 14:35:42 -07:00
Behdad Esfahbod f283d4d366 [paint] Try to adjust both renderers to use same clip order 2023-01-08 12:42:34 -07:00
Behdad Esfahbod 5d94eb61b8 [hb-cairo] Fix hb_cairo_glyphs_from_buffer() when utf8 missing
Fixes https://github.com/harfbuzz/harfbuzz/issues/4016
2023-01-08 11:56:01 -07:00
Behdad Esfahbod 5bd6fc1ace Comment 2023-01-07 16:32:50 -07:00
Behdad Esfahbod 432afa9dff [paint] Fix paint_extents usage
It was broken all this time :(.

The two backends do this slightly differently...
2023-01-07 16:25:30 -07:00
Behdad Esfahbod a63d329261 [paint-extents] Simplify transform_extents 2023-01-07 16:05:24 -07:00
Behdad Esfahbod e062f98260 [paint-extents] Fix transform_extents
Ouch!
2023-01-07 16:02:21 -07:00
Behdad Esfahbod 823a9b18d9 [cairo] Return COMPOSITE mode CLEAR for unknown values
As per the spec.
2023-01-07 14:50:30 -07:00
Behdad Esfahbod 65c3cde5da [COLRv1] Fix scale variation 2023-01-07 14:29:18 -07:00
Behdad Esfahbod 004cdc10f8 [open-type] More tweaks to fixed types
Add set_int().
2023-01-07 14:27:15 -07:00
Behdad Esfahbod c8486b6301 [open-type] Add to_int to fixed types
To make sure we don't accidentally forget to_float().
As we did recently in COLRv1 code.
2023-01-07 14:15:17 -07:00
Behdad Esfahbod dfd9bf8a50 [COLRv1] Fix a couple of missing to_float() calls
Ouch!
2023-01-07 14:05:02 -07:00
Behdad Esfahbod d045de78c1 [paint] Optimize PAINT_COMPOSITE
At the start of each paint call the current group is clear.
So we don't need to start a new group for the backdrop paint.

A paint composite really needs one group push, not two.
2023-01-07 13:56:43 -07:00
Behdad Esfahbod 5ea5aacda9 [ft-colr] Adjust for FreeType master color-stop change
Part of https://github.com/harfbuzz/harfbuzz/issues/4013
2023-01-07 13:25:11 -07:00
Qunxin Liu 1eb5445e75 [subset] Fix issue in hb_subset_input_override_name_table()
If a nameRecord with provided name_id/platform_id/encoding_id/lang_id
is not retained after subsetting, create it and insert it to
the name table. So we need to check against retained name_records
rather than name_record in the original name table.
2023-01-06 19:17:14 -07:00
Khaled Hosny 02948263f9 [subset] Document that CFF2 instancing is now supported 2023-01-06 13:58:29 -07:00
Behdad Esfahbod 82c863a50b Whitespace 2023-01-06 12:51:58 -07:00
Behdad Esfahbod 76879c5763 [subset-cff] Minor hide num_coords again 2023-01-06 11:47:04 -07:00
Behdad Esfahbod 576b36a31b [cff2] Undo rounding change in draw() codepath 2023-01-06 11:40:21 -07:00
Behdad Esfahbod 4867e0b192 [subset-cff2] Faster instancing
Instantiate blends during parsing. Dedups code as well.
2023-01-06 11:39:13 -07:00
Behdad Esfahbod 3757baab2c [subset-cff2] Better condition
Previous condition wasn't working for dropping axes.
2023-01-06 11:23:37 -07:00
Behdad Esfahbod acc6c13f05 [subset-cff] Round numbers when instancing 2023-01-06 11:20:41 -07:00
Behdad Esfahbod 2f174f23c3 Rename 2023-01-06 11:11:14 -07:00
Behdad Esfahbod a59116cd8f Oops 2023-01-06 11:09:09 -07:00
Behdad Esfahbod c632a164b9 [subset/cff] Support instancing 2023-01-06 11:01:25 -07:00
Behdad Esfahbod 5153218b41 [set] Add hb_set_is_inverted() 2023-01-05 16:26:41 -07:00
Behdad Esfahbod e8ac0ef2fd [face] Minor rename a variable 2023-01-05 16:20:59 -07:00
Behdad Esfahbod 14ff747024 [set] Add tests for inverted set range iteration 2023-01-05 16:20:59 -07:00
Matthias Clasen 381ac2fd78 docs: Fix a typo 2023-01-05 15:55:57 -07:00
Behdad Esfahbod 2764a61691 Revert "[gsubgpos] Use swap instead of move"
This reverts commit 8a17cc4ecf.
2023-01-05 15:14:54 -07:00
Behdad Esfahbod 167b7c6046 Revert "[gsubgpos] Reduce hb_set_t allocations"
This reverts commit 0b7f6d6cf0.

Not much benefit as the main allocations come from other places.
2023-01-05 14:48:20 -07:00
Behdad Esfahbod 3947cedd09 Revert "[gsubgpos] Cache pos_glyphs allocation in closure"
This reverts commit 3961cc46bf.

This was wrong...
2023-01-05 14:47:47 -07:00
Behdad Esfahbod 097fb8b8aa [priority-queue] Use resize instead of shrink
To avoid reallocation of smaller array. Not desirable here.
2023-01-05 14:38:10 -07:00
Behdad Esfahbod 8a17cc4ecf [gsubgpos] Use swap instead of move
Move is wrong when we want to reuse the object.
2023-01-05 14:15:38 -07:00
Behdad Esfahbod 4401dd2482 [gsubgpos] Minor use ->clear() directly 2023-01-05 14:13:57 -07:00
Behdad Esfahbod 207ae11ab9 [set] Allocate first page exact 2023-01-05 14:08:47 -07:00
Behdad Esfahbod 0b7f6d6cf0 [gsubgpos] Reduce hb_set_t allocations 2023-01-05 14:05:11 -07:00
Behdad Esfahbod 3961cc46bf [gsubgpos] Cache pos_glyphs allocation in closure
Saves some 3% in Gulzar-Regular subsetting.
2023-01-05 13:58:57 -07:00
Behdad Esfahbod a90f149e1b [gsubgpos] Minor drop an allocation 2023-01-05 13:52:11 -07:00
Behdad Esfahbod c54debc76d [face] Add hb_face_collect_nominal_glyph_mapping
Fixes https://github.com/harfbuzz/harfbuzz/issues/3973
2023-01-05 11:57:48 -07:00
Behdad Esfahbod ec70a3f797 [map] Include 2023-01-05 11:52:12 -07:00
Behdad Esfahbod 8b12c19573 [face] Split hb-face-builder.cc 2023-01-05 11:42:21 -07:00
Behdad Esfahbod dc7b3a627d [test-map] Another test 2023-01-05 10:49:10 -07:00
Behdad Esfahbod a8df5cb07d [test-map] Test keys() / values() 2023-01-05 10:47:47 -07:00
Konstantin Käfer a349eef6a6 Disable hb_paint_extents_* functions if HB_NO_PAINT is defined 2023-01-05 10:18:47 -07:00
Behdad Esfahbod 9420966f5b [map] Fix next() 2023-01-05 10:17:24 -07:00
Behdad Esfahbod 35f46e74d1 [map] Add hb_map_keys() and hb_map_values() 2023-01-04 17:12:08 -07:00
Behdad Esfahbod 07f2d8d538 Comment 2023-01-04 15:42:56 -07:00
Behdad Esfahbod 4f6079138d [map] Add hb_map_update() 2023-01-04 13:58:46 -07:00
Behdad Esfahbod c350458539 [subset-plan] Relax const return type of a few functions
Fixes https://github.com/harfbuzz/harfbuzz/issues/4003
2023-01-04 13:25:03 -07:00
Behdad Esfahbod dbf0964a0f [map] Doc 2023-01-04 13:17:14 -07:00
Behdad Esfahbod 0875a420f7 [map] Doc 2023-01-04 13:11:37 -07:00
Behdad Esfahbod ffafcf9633 [map] Add hb_map_next() 2023-01-04 12:56:42 -07:00
Behdad Esfahbod 3e471bbc08 [vector] Better test 2023-01-04 11:53:49 -07:00
Behdad Esfahbod 45fc919a10 [bit-set] Minor setting length on allocation failure 2023-01-04 11:35:44 -07:00
Behdad Esfahbod d8509061e6 [vector] It's okay if shrinking fails 2023-01-04 11:33:54 -07:00
Behdad Esfahbod 6c272b920d [set] Don't discard allocation in operator=
That had caused memory thrashing.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54789
2023-01-03 13:00:41 -07:00
Behdad Esfahbod e6bbf112ea [buffer] Better document set_content_type
Fixes https://github.com/harfbuzz/harfbuzz/issues/4000
2023-01-03 12:35:48 -07:00
Behdad Esfahbod 8f2345ca36 Use more vector resize_exact 2023-01-02 18:08:45 -07:00
Behdad Esfahbod b6be455020 [vector] Add resize_exact() 2023-01-02 18:05:43 -07:00
Behdad Esfahbod a516ce97e0 [subset-cff] Add a few exact-allocation calls 2023-01-02 17:58:51 -07:00
Behdad Esfahbod 4a435dc024 [subset-cff] Remove an unlikely 2023-01-02 17:41:31 -07:00
Behdad Esfahbod f8c578fd93 [subset-cff] Remove commented-out line 2023-01-02 17:33:04 -07:00
Behdad Esfahbod d5e1748f31 [cff] Simplify add_op() 2023-01-02 12:26:43 -07:00
Behdad Esfahbod 27531d853e [subset-cff] Move code around 2023-01-02 12:05:11 -07:00
Behdad Esfahbod 9afe5f973e [vector] Fix leak
Discovered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54767
2023-01-02 11:46:45 -07:00
Behdad Esfahbod 4f013c42f0 [subset-cff] Always compact charstrings
Reduces non-preprocessed subsetting memory footprint significantly.
2023-01-02 10:39:14 -07:00
Behdad Esfahbod d3ed6eed43 [cff] Initialize a member variable
For good hygiene.
2023-01-02 10:39:14 -07:00
Behdad Esfahbod 55a7d81740 [vector] Allocate exact size in operator= 2023-01-01 23:07:42 -07:00
Behdad Esfahbod 449910d431 [vector] Allocate exact size in constructor 2023-01-01 19:27:10 -07:00
Behdad Esfahbod 4dda1f7881 [cff-subset] Compact charstrings just after parsing
Massive peak-memory saving when processing face.
2023-01-01 19:00:04 -07:00
Behdad Esfahbod a7617c3cf1 [cff-subset] Drop hints just after parsing charstring
In prep for next commit.
2023-01-01 18:58:08 -07:00
Behdad Esfahbod b1c4cb0cae [cff2] Use a shrink instead of resize
Such that we can free the allocation.
2023-01-01 18:41:19 -07:00
Behdad Esfahbod b87360763e [vector] Support shrinking storage if exact size provided
Only do it if requested size is less than quarter of allocated size.

This has massive benefit during CFF subset preprocessing.
2023-01-01 18:38:28 -07:00
Behdad Esfahbod 1119e60296 [subset-cff] Tweak another storage allocation 2023-01-01 18:31:32 -07:00
Behdad Esfahbod f0b5286b36 [features] Sort 2023-01-01 17:04:59 -07:00
Behdad Esfahbod 4a5bd7a926 [subset] Add hb_subset_input_keep_everything()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3998

New API:
+ hb_subset_input_keep_everything()
2023-01-01 16:53:28 -07:00
Behdad Esfahbod 52110f13b0 [subset-input] Refactor copy-pasta code 2023-01-01 16:22:02 -07:00
Matthias Clasen 4adc748b13 Move Color tables to src/OT/Color/ 2023-01-01 14:57:53 -07:00
Behdad Esfahbod a5f1f3a05c [ft] Conditionalize all COLOR code on >= 2.11.1
Fixes https://github.com/harfbuzz/harfbuzz/issues/3994
2023-01-01 13:14:04 -07:00
Matthias Clasen dc5179d465 Drop hb-ot-color-colr-table.cc
Move everything into the .hh file.
2023-01-01 20:18:33 +02:00
Khaled Hosny 27684f14be [introspection] Skip sources not usable with GObject Introspection
There is no point in generating GIR for code interfacing with libraries
without introspection integration. This fixes spurious warnings on macOS
when g-ir-scanner mistakenly tries to scan system headers.
2023-01-01 20:08:19 +02:00
Matthias Clasen f60e7e3f8c Drop an unused file 2023-01-01 09:51:03 -05:00
Behdad Esfahbod 3ff91c449f [paint] Optimize transform operations again 2022-12-31 14:49:41 -07:00
Behdad Esfahbod 1a0dd49f1e
Merge pull request #3991 from harfbuzz/paint-optimize-transform
Paint optimize transform
2022-12-31 14:38:06 -07:00
Behdad Esfahbod edb812345a [subset-cff] Another exact allocation 2022-12-31 13:55:41 -07:00
Behdad Esfahbod 54dd01b865 [set] Use exact-allocation in copying
Significantly reduces memory consumption.
2022-12-31 13:33:40 -07:00
Behdad Esfahbod 2c64048bc4 [subset] Another exact-allocation 2022-12-31 13:26:00 -07:00
Behdad Esfahbod 0ec0214f10 [cff-subset] Adjust pre-allocation
Reduces memory use significantly.
2022-12-31 13:19:38 -07:00
Behdad Esfahbod b88ca81814 [paint-extents] Minor reorder 2022-12-31 12:53:00 -07:00
Behdad Esfahbod 0c6a721337 [set] Another exact-size allocation 2022-12-31 12:42:29 -07:00
Behdad Esfahbod b803024caf [cff2] Another exact-size allocation 2022-12-31 12:40:07 -07:00
Behdad Esfahbod 3d4659beaa [cff2] Use exact-size vector allocation for blends 2022-12-31 12:38:58 -07:00
Behdad Esfahbod 92e5933ee6 [vector] A couple more exact-size allocations 2022-12-31 12:35:30 -07:00
Behdad Esfahbod 2eacc37e08 [vector] Add internal API for exact-size allocation
Use it from a couple of places.
2022-12-31 12:30:31 -07:00
Behdad Esfahbod a0b46f3f6b [machinery] Refactor shared code into a macro 2022-12-31 12:15:14 -07:00
Behdad Esfahbod ebb475bae7 [multimap] Add consts 2022-12-31 12:11:14 -07:00
Behdad Esfahbod 9e3ff0e9f0 [paint] Fixup 2022-12-31 11:55:45 -07:00
Behdad Esfahbod 6b47fcb17a [paint] Add internal push_skew/pop_skew API 2022-12-31 11:40:12 -07:00
Behdad Esfahbod 46adf31b4c [paint] Add internal push_rotate/pop_rotate API 2022-12-31 11:35:39 -07:00
Behdad Esfahbod ce7835124a [paint] Add internal push_scale/pop_scale API 2022-12-31 11:32:15 -07:00
Behdad Esfahbod 7363eb373a [paint] Add internal push_translate/pop_translate 2022-12-31 11:24:42 -07:00
Behdad Esfahbod df91677997 [paint] Call internal API internally 2022-12-31 11:12:02 -07:00
Behdad Esfahbod 99da0e6cc3 [paint] Avoid div-by-zero 2022-12-31 11:04:40 -07:00
Behdad Esfahbod 4e94b65cff [paint-extents] Const-correctness 2022-12-31 10:53:40 -07:00
Behdad Esfahbod f6dc4698ef [paint-extents] Minor move variable 2022-12-31 10:52:32 -07:00
Behdad Esfahbod 4e7807a090 [paint-extents] Rename variable 2022-12-31 10:50:30 -07:00
Behdad Esfahbod c86d1892ad [paint-extents] Move code around 2022-12-31 10:46:46 -07:00
Behdad Esfahbod d9a9bd8fa8 [paint-extents] Add HB_UNUSED 2022-12-31 10:41:30 -07:00
Behdad Esfahbod 37e90c64c1 [cairo] Fix warnings 2022-12-30 15:41:40 -07:00
Behdad Esfahbod 04464c55b2 [pool] Change chunk-len from 16 to 32 2022-12-30 14:55:32 -07:00
Behdad Esfahbod d7941e04df [paint-extents] Unlikely 2022-12-30 14:47:47 -07:00
Behdad Esfahbod ca844b6975 [paint-extents] Whitespace 2022-12-30 14:47:24 -07:00
Behdad Esfahbod 62ca2be39d [paint-extents] Implement quadratic callback 2022-12-30 14:41:36 -07:00
Behdad Esfahbod 7389efd8e0 [post] Pre-alloc name index array 2022-12-30 13:58:52 -07:00
Behdad Esfahbod 36bef5dccf [gsubgpos] Prealloc subtables vector 2022-12-30 13:58:52 -07:00
Behdad Esfahbod a45bf5b04c [ft-colr] Require FreeType >= 2.11.1
Fixes https://github.com/harfbuzz/harfbuzz/issues/3989
2022-12-30 11:19:36 -07:00
Behdad Esfahbod ceba6c9a90 [config] Sort 2022-12-30 10:44:34 -07:00
Behdad Esfahbod f2a6643fc1 [cairo] Docs 2022-12-29 18:00:39 -07:00
Behdad Esfahbod bfce4a6046 [cairo] Remove error path
Assume cairo API always returns non-NULL.
2022-12-29 10:43:37 -07:00
Behdad Esfahbod b1de87b7f1 [cairo] Document get_glyphs() arguments as inout 2022-12-29 10:41:35 -07:00
Matthias Clasen 89bd7f64ae [hb-cairo] Small docs fixes 2022-12-29 10:09:50 -07:00
Khaled Hosny c9206df166 [hb-cairo] Fix warnings 2022-12-29 10:07:59 -07:00
Khaled Hosny 723e7a48e2 [docs] Small fixes 2022-12-29 15:49:21 +02:00
Matthias Clasen 67456a7a02 [ft] Some more docs clarifications 2022-12-28 11:14:12 -07:00
Matthias Clasen c612d068e8 [ft] Clarify docs around faces too 2022-12-28 11:14:12 -07:00
Matthias Clasen 4dc955bb46 [ft] Clarify docs
Add some clarifications on what fonts these apis
work with.
2022-12-28 11:14:12 -07:00
Matthias Clasen ef20b5e66f Typo fix 2022-12-28 08:51:27 -05:00
Behdad Esfahbod 81c04b0c21 [cairo] Add separate x/y scale factors 2022-12-27 17:46:25 -07:00
Behdad Esfahbod 50b7fff0c6 [cairo] Fix text_to_glyphs scale factor 2022-12-27 17:37:42 -07:00
Behdad Esfahbod 8f62b8c6bb [cairo] Fix cluster conversion 2022-12-27 17:26:39 -07:00
Behdad Esfahbod 326db329f8 [directwrite] Simplify delete
Fixes https://github.com/harfbuzz/harfbuzz/issues/3981
2022-12-27 14:38:17 -07:00
Behdad Esfahbod 7b0f9abc89 [paint] Add back "remote-control" API
This reverts commit f146299a40.
2022-12-27 12:38:49 -07:00
Behdad Esfahbod 43b0364eda [paint] Document composition modes 2022-12-27 12:29:53 -07:00
Behdad Esfahbod ec9e8a5993 [paint] Document extend modes. 2022-12-27 12:22:56 -07:00
Behdad Esfahbod fa3fa9422d [cairo] Doc 2022-12-27 11:54:23 -07:00
Behdad Esfahbod bbf6f42d3b [cairo] TODO 2022-12-27 11:50:06 -07:00
Behdad Esfahbod f9fc13287b [hb-cairo] Return hb_font_t* from init-func 2022-12-27 11:08:55 -07:00
Matthias Clasen d18903e443 Add def files for libharfbuzz-cairo 2022-12-27 11:00:23 -07:00
Behdad Esfahbod d88787b6ca [cairo] Add func to init fonts on creation
To set, for example, font-funcs.
2022-12-27 10:59:17 -07:00
Behdad Esfahbod c52bff2d61 [cairo] Hide internal symbols 2022-12-27 10:42:13 -07:00
Behdad Esfahbod 34aa8b0148 [cairo] Add to library tests 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 5fdfe6ae5d [cairo] Use hb_qsort 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 21573265e9 [cairo] More namespacing 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 84d1b00cd4 [cairo] More namespacing 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 8f16e98c1b [cairo] Namespace types 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 488be52467 [cairo] Try fix msvc build 2022-12-26 17:01:08 -07:00
Behdad Esfahbod c652e8e1b7 [cairo] Docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 23980d3cb2 [cairo] Docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod f5fd46aa3d [cairo] Docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 36482b684b [cairo] Err, utf8_clusters 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 48cb25dd36 [cairo] Implement (untested) text_to_glyphs callback 2022-12-26 17:01:08 -07:00
Behdad Esfahbod c38abcb3fb [cairo] Add x,y args to get_glyphs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 847ed69547 [cairo] Reorder arguments of a call 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 726cfffc0d [cairo] Doc fix 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 0fe0cdf066 [cairo] Document scale-factor business 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 4e3e879c1c [cairo] Add [sg]et_scale_factor 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 186bfa99f5 [cairo] Make scale_factor a double 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 120419e180 [hb-view] Fix autotools build 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 650a46d919 [cairo] Fix autotools build 2022-12-26 17:01:08 -07:00
Matthias Clasen b417ac8a19 Try to fix autotools build 2022-12-26 17:01:08 -07:00
Matthias Clasen 8d0e18b51d [cairo] More details in the docs
Mention slant as well.
2022-12-26 17:01:08 -07:00
Matthias Clasen 30605e09b9 [cairo] Mention variations in the docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod c4f7563f81 [cairo] Fix build 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 7a52ac4bbe [cairo] Set variations 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 4be4e017fc [cairo] Make font immutable 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 70babda6ad [cairo] docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 1c67180d6d [cairo] Add typed destroy funcs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 43da222e6d [cairo] Rename 2022-12-26 17:01:08 -07:00
Behdad Esfahbod cf001f6ec7 [cairo] Add constructor from hb_face_t 2022-12-26 17:01:08 -07:00
Matthias Clasen 2e897cc90b Add a pc file for harfbuzz-cairo 2022-12-26 17:01:08 -07:00
Matthias Clasen ddb52e4a30 [cairo] Add docs 2022-12-26 17:01:08 -07:00
Behdad Esfahbod dc2bf2664d [cairo] Set scaled-font extents 2022-12-26 17:01:08 -07:00
Behdad Esfahbod d6ecda36bf [cairo] Renames 2022-12-26 17:01:08 -07:00
Behdad Esfahbod ffa45f243c [cairo] #ifdef HAVE_CAIRO 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 9e61fd7705 [hb-cairo] Lazy-load funcs thread-safe 2022-12-26 17:01:08 -07:00
Matthias Clasen 306645503d Work on proper build integration
Install hb-cairo.h and define HB_HAS_CAIRO.
2022-12-26 17:01:08 -07:00
Behdad Esfahbod a7c2e839e1 [hb-cairo] Prefix internal methods 2022-12-26 17:01:08 -07:00
Behdad Esfahbod bb640d4031 [hb-cairo] Use nullptr instead of NULL 2022-12-26 17:01:08 -07:00
Behdad Esfahbod b3a3656683 [hb-cairo] Minor 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 3a11a09f54 [hb-cairo] Rename cairo_extend 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 20a50acc91 [hb-cairo] Make hb_cairo_glyphs_from_buffer public 2022-12-26 17:01:08 -07:00
Behdad Esfahbod bf52386cfa [cairo] Silence warning 2022-12-26 17:01:08 -07:00
Behdad Esfahbod e594780e28 [hb-cairo] Some header tweaks 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 1ad24421a6 [hb-cairo] Rename files to C++ 2022-12-26 17:01:08 -07:00
Behdad Esfahbod 5c3da76a43 [hb-cairo] Change API again
We need to work with a hb-font for variations and font-funcs
to be fetched properly.
2022-12-26 17:01:08 -07:00
Behdad Esfahbod 9f7538c260 [hb-cairo] Change API 2022-12-26 17:01:08 -07:00
Matthias Clasen 767bdd43a6 wip: Add libharfbuzz-cairo
This library will provide integration with cairo
for font rendering.
2022-12-26 17:01:08 -07:00
Behdad Esfahbod c3a8c6bb8b [paint] More docs 2022-12-26 15:38:24 -07:00
Behdad Esfahbod ae208963df Add hb-limits.hh 2022-12-26 12:30:39 -07:00
Matthias Clasen 5f5fa4b219 [ft-colr] Limit the size of the graph we follow
This adds the same check that we already do in
the native implementation.
2022-12-26 12:20:04 -07:00
Matthias Clasen ea2892c30e [paint] Limit the size of the graph we follow
In addition to checking the depth, also count
the number of edges in the graph we've followed,
and give up after 1024.
2022-12-26 12:20:04 -07:00
Matthias Clasen 5dd69d81b0 Fix hb_ot_color_has_paint
We must no access v1 data without checking that
version is 1. A bit of a trap.
2022-12-26 11:29:26 -07:00
Matthias Clasen b8f2281c6c Add hb_ot_color_glyph_has_paint 2022-12-26 11:29:26 -07:00
Behdad Esfahbod 79c5bb92ce [ft] Work around a freetype bug 2022-12-24 12:57:33 -07:00
Behdad Esfahbod fa1cf15e5d [ft-colr] Whitespace 2022-12-24 11:56:23 -07:00
Behdad Esfahbod 5343eac161 [ft-colr] Minor use context instead of direct access 2022-12-24 11:53:43 -07:00
Behdad Esfahbod 0b6468b820 [ft-colr] Minor 2022-12-24 11:50:57 -07:00
Behdad Esfahbod 1c595ec17f [paint-extents] Lazy-load paint_extents funcs 2022-12-24 11:40:44 -07:00
Behdad Esfahbod 4280ed290d [paint-extents] Add missing file 2022-12-24 11:38:32 -07:00
Behdad Esfahbod 2c0ab34d03 [paint-extents] Lazy-load draw-funcs 2022-12-24 11:37:59 -07:00
Behdad Esfahbod 11036ed71e [paint] Add hb-paint-extents.cc 2022-12-24 11:30:45 -07:00
Behdad Esfahbod 959996d709 [paint-extents] Namespace 2022-12-24 11:22:16 -07:00
Behdad Esfahbod 62bd26dda3 [ft] Pick largest bitmap size 2022-12-24 11:01:32 -07:00
Behdad Esfahbod d35dff020f [cbdt] Remove extra clip 2022-12-24 10:59:17 -07:00
Behdad Esfahbod f70c5d6f0d [paint] Continue returning bool from paint_image()
6ccbfabd4f (commitcomment-94127307)
2022-12-24 10:56:06 -07:00
Behdad Esfahbod 6ccbfabd4f [paint] Return bool from paint_image()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3974
2022-12-24 10:44:25 -07:00
Behdad Esfahbod 346331d375 [ft] Fix negative xscale 2022-12-24 10:35:26 -07:00
Behdad Esfahbod 9376e7a930 [ft] Remove stale TODO 2022-12-24 10:31:30 -07:00
Behdad Esfahbod a7fd48c408 [ft] Comment 2022-12-24 10:28:41 -07:00
Behdad Esfahbod bb45ba2f9f [ft] Fix negative y-scale 2022-12-24 10:25:43 -07:00
Behdad Esfahbod aba2063c22 [paint-extents] Comments 2022-12-24 10:15:47 -07:00
Behdad Esfahbod 988ca459f3 [paint-extents] Minor refactor 2022-12-24 10:12:35 -07:00
Behdad Esfahbod f8bf98798d [paint-extents] Refactor code 2022-12-24 10:11:04 -07:00
Matthias Clasen 4816be9ab5 Work around cairo limitations
If we just draw an image, cairos recording surface
complains that it is unbounded. Its not true of course.

To make things work, clip to the extents.
2022-12-24 09:16:29 -05:00
Behdad Esfahbod f7eebc397c [paint-extents] Shorten enum addressing 2022-12-23 18:52:46 -07:00
Behdad Esfahbod 0110bdb3ea [paint-extents] Streamline extents_t more 2022-12-23 18:17:05 -07:00
Behdad Esfahbod 9f3e050b99 [paint-extents] Streamline extents_t 2022-12-23 18:15:21 -07:00
Behdad Esfahbod 0d129ae308 Fix warning 2022-12-23 18:00:38 -07:00
Behdad Esfahbod 73e48b9357 [colr] Push clipbox or computed clip 2022-12-23 17:55:09 -07:00
Behdad Esfahbod 02684751bd [paint-extents] Clean up 2022-12-23 17:33:13 -07:00
Behdad Esfahbod dbea503a38 [colr] Return true extents 2022-12-23 17:28:46 -07:00
Behdad Esfahbod f9c2e30e01 [paint-extents] Better handle empty glyphs 2022-12-23 17:13:35 -07:00
Matthias Clasen 885dbcfba0 Skip empty outlines 2022-12-23 19:07:32 -05:00
Behdad Esfahbod bd61e645ff [paint-extents] Use hb_min/hb_max 2022-12-23 16:59:12 -07:00
Behdad Esfahbod 56a48f8b0a [paint] Don't use extents in hb-view
Let the clipbox do its magic. Currently works for ft backend only.
2022-12-23 16:45:04 -07:00
Matthias Clasen 79229cea17 Get outline extents manually 2022-12-23 18:41:24 -05:00
Behdad Esfahbod 47c896f004 [paint-extents] Hook it up, kinda 2022-12-23 16:25:36 -07:00
Behdad Esfahbod 7fbaaebe8b [paint-extents] Finish off
Untested and unused.
2022-12-23 15:57:05 -07:00
Behdad Esfahbod 8ca78d1520 [paint-extend] More 2022-12-23 15:21:48 -07:00
Behdad Esfahbod 23a2d4dbab [paint-extents] More 2022-12-23 15:11:45 -07:00
Behdad Esfahbod d7435b1009 [paint-extents] Flesh out more 2022-12-23 15:05:30 -07:00
Behdad Esfahbod c37a1eadef [paint-extents] Flesh out some more 2022-12-23 14:57:12 -07:00
Behdad Esfahbod 268d8b7ded [paint-extents] Start out 2022-12-23 14:45:56 -07:00
Behdad Esfahbod d9875ddc9d [ft-colr] Add depth counter 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 583f010b05 [ft] Move lock only around clip_glyph 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 2762903909 [ft-colr] Minor 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 3a1385f019 [ft-colr] Simplify color-stop callback 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 1cc3b10008 [ft-colr] Ifdef build for older freetype 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 882c2bca2d [ft-colr] Add a paint context 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 7a4b4c64f2 [ft-colr] Minor macro 2022-12-23 13:37:59 -07:00
Behdad Esfahbod c453c2fce9 [ft-colr] Fix color-stop iteration 2022-12-23 13:37:59 -07:00
Matthias Clasen bbb89e62aa [paint] Document color lines as transient
Just so people don't get ideas.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 15582d5fc1 [ft-colr] Apply slant to clipbox 2022-12-23 13:37:59 -07:00
Matthias Clasen 7abd5dcf10 [ft-paint] Fix handling of colorstop iters 2022-12-23 13:37:59 -07:00
Matthias Clasen 393bab4ba1 [ft-paint] Apply ClipBox to all glyphs 2022-12-23 13:37:59 -07:00
Matthias Clasen c11ae85cbf [ft-paint] Apply root transform 2022-12-23 13:37:59 -07:00
Matthias Clasen 7fc3fdac76 [ft-paint] Optimize away some transforms 2022-12-23 13:37:59 -07:00
Matthias Clasen 586d1758c1 [ft-paint] Fix an oversight 2022-12-23 13:37:59 -07:00
Matthias Clasen 092637f94c [ft-paint] Fix rounding 2022-12-23 13:37:59 -07:00
Matthias Clasen fe08e956e0 [ft-paint] Fix a case of x/y confusion 2022-12-23 13:37:59 -07:00
Matthias Clasen 0d5256e5a7 [ft-paint] Fix some fixed->float conversions 2022-12-23 13:37:59 -07:00
Matthias Clasen 07ba5be393 [paint] Documentation tweaks 2022-12-23 13:37:59 -07:00
Matthias Clasen 21f78c8774 [paint] Document that colors are unpremultiplied
And mention that gradient interpolation must happen
in premultiplied space.
2022-12-23 13:37:59 -07:00
Matthias Clasen b6e98cf758 [colr] Add more docs
State explicitly that palette entries are
unpremultipled, and link to the spec.
2022-12-23 13:37:59 -07:00
Matthias Clasen a634f6b486 [colr] Add more docs
State explicitly that palette entries are
unpremultipled, and link to the spec.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod a02c2a911c [ft-paint] Apply alpha correctly 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 6ebcc9d2e1 [ft-paint] Hook up gradients 2022-12-23 13:37:59 -07:00
Behdad Esfahbod fe4e9bd930 [colr] Add public vtable for hb_color_line_t 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 7c9e42ed92 [colr] Fix transform hell 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 569d5b436c [ft-paint] Remove dead code 2022-12-23 13:37:59 -07:00
Behdad Esfahbod cfdc34b44d [ft-paint] Implement FT_COLR_PAINTFORMAT_SKEW 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 64cf17ec8b [ft-paint] Fix center translation 2022-12-23 13:37:59 -07:00
Behdad Esfahbod ddbe4e52ec [ft-paint] Implement FT_COLR_PAINTFORMAT_ROTATE 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 16598e024b [ft-paint] Default 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a0f7f9e61c [ft-paint] Implement FT_COLR_PAINTFORMAT_COMPOSITE 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 0ec201446b [ft] Implement FT_COLR_PAINTFORMAT_COLR_GLYPH 2022-12-23 13:37:59 -07:00
Behdad Esfahbod ac2682c610 [ft] Start of a COLRv1 renderer 2022-12-23 13:37:59 -07:00
Behdad Esfahbod e2546f5ab0 [ft] Add hb-ft-colr.hh 2022-12-23 13:37:59 -07:00
Matthias Clasen 5bd3c07b54 [colr] Don't access baseGlyphList unless v1
This was showing up sporadic crashes due to
invalid reads.
2022-12-23 13:37:59 -07:00
Matthias Clasen 6909701b36 [paint] Update docs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 381d410b1e [paint] Add HB_PAINT_IMAGE_FORMAT_BGRA and use it in hb-ft
Now hb-ft can render color emoji as well.

Just left COLRv2.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c5f903872f [paint] Add bitmap width/height to paint_image callback
Such that we can add raw data as well.
2022-12-23 13:37:59 -07:00
Matthias Clasen eef47f2379 [paint] Fix the docs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 3c972867b9 More s/hb_font_get_glyph_shape/hb_font_draw_glyph/ 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 72a169c846 [ft] Paint COLRv0 glyphs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod bb807f47d2 [ft] Implement paint_glyph() for outline glyphs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 91c880503e [ft] Use new name for draw API 2022-12-23 13:37:59 -07:00
Behdad Esfahbod c27eefec1d Revert "Drop the deprecation"
This reverts commit 3904e66777339a3d420ece1c2b7d550949aa3946.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod f3985d9482 [paint] Fix drawing non-color glyphs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 237955dffc [paint] Add slant to image() callback
And slant images in hb-view.
2022-12-23 13:37:59 -07:00
Matthias Clasen c221933977 [paint] Preserve foreground information 2022-12-23 13:37:59 -07:00
Matthias Clasen f146299a40 [paint] Drop unnecessary api 2022-12-23 13:37:59 -07:00
Matthias Clasen 6387004cad [paint] Simplify api
Drop the hb_paint_context_t struct from the API, and
only pass the font where we need it.
2022-12-23 13:37:59 -07:00
Matthias Clasen 71bd5a0dfc [paint] Resolve colors
We don't need to pass the index/alpha pairs to
client callbacks, and can just resolve the colors
internally.

Update test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9be01b6bff [paint] Pass hb_paint_context_t along
Replace the font argument with a hb_paint_context_t
that carries the font, the palette index and the
foreground color.

The hb_font_paint_glyph() api now takes the palette
index and the foreground color as extra arguments.

Update all callers and regenerate test results.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 6c71c530ca [paint] Rename hb_paint_context_t to hb_ot_paint_context_t 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 8495395397 [paint] Fix slant 2022-12-23 13:37:59 -07:00
Matthias Clasen 97224f3b63 [paint] Pass font to all callbacks
This will lead to easier implementations.

At the same time, we change the push_clip_glyph
callback to use the font as-is, no unscaling needed.

Update all callers and expected test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 32ce29f99e [font] Move hb_font_t typedef
This is needed to avoid circular header dependencies.
2022-12-23 13:37:59 -07:00
Matthias Clasen 8364d9130f Document hb_font_set_draw_glyph_func 2022-12-23 13:37:59 -07:00
Matthias Clasen a20999b9df [font] Fix a few documentation mistakes 2022-12-23 13:37:59 -07:00
Matthias Clasen 2333a566ed Drop the deprecation
No need to drop hb_font_get_glyph_shape, just
because hb_font_draw_glyph does the same.

Its fine to keep both around.
2022-12-23 13:37:59 -07:00
Matthias Clasen 14b026ff86 [draw] Add hb_font_draw_glyph
hb_font_draw_glyph(), hb_font_draw_glyph_func_t and
hb_font_funcs_set_draw_glyph_func() are just alternative
names for hb_font_get_glyph_shape and friends, to better
align with hb_font_paint_glyph.
2022-12-23 13:37:59 -07:00
Matthias Clasen 08da126523 [docs] Linkify links 2022-12-23 13:37:59 -07:00
Matthias Clasen 9437f719a7 [paint] Document hb_paint_extend_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 3a2634e27c [paint] Document hb_font_paint_glyph_func_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 0f287e75ec [paint] Rename hb_font_get_glyph_paint_func_t
The 'get' was just there due to implementation
choices. Work around that and call the vfunc
what it should be: hb_font_paint_glyph_func_t.
2022-12-23 13:37:59 -07:00
Matthias Clasen ddd2039265 [paint] Improve the docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 3a219cfa6a [config] Make HB_LEAN imply HB_NO_PAINT 2022-12-23 13:37:59 -07:00
Matthias Clasen 0ef2dc9be5 Drop a TODO
This was addressed in 61bd602791d801
2022-12-23 13:37:59 -07:00
Matthias Clasen 96cda3886c [paint] Clarify docs
Spell out where the different datas originate.
2022-12-23 13:37:59 -07:00
Matthias Clasen 0800d1879c Try to fix autotools build 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 5ac218865a [paint] A doc fix 2022-12-23 13:37:59 -07:00
Matthias Clasen 7c12db46ff Try to fix msvc build 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 5d1fc9ee9d [paint] Fix annotations 2022-12-23 13:37:59 -07:00
Behdad Esfahbod ee2204469e [paint] Add get_empty / [sg]et_user_data 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 21a9db875e [draw] Add get_empty / [sg]et_user_data 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 9a7422c5fb [font] Minor doc fix 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a9b37206eb [font] Minor rename 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 815544a1f7 [font] Adapt paint_glyph to parent transform 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 85917e5b21 [paint] Fix docs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 14bf3aaa8d [colr] Make paint_image work again 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 7accbe97d8 [util] Fix argument order and root transform PNGs 2022-12-23 13:37:59 -07:00
Matthias Clasen f1f8d1e855 Small documentation addition 2022-12-23 13:37:59 -07:00
Matthias Clasen 021618e91a [colr] Add hb_ot_color_has_paint
This is a counterpart to hb_ot_color_has_layers
for COLRv1 data.
2022-12-23 13:37:59 -07:00
Matthias Clasen 63fcb26c9b Add some more docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 451414a27e [paint] Documentation fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 0c77f1d9ab [paint] Documentation tweaks 2022-12-23 13:37:59 -07:00
Matthias Clasen 0a2f3673b9 [paint] Use tags for image formats
This fits better with the rest of the
HarfBuzz API.
2022-12-23 13:37:59 -07:00
Matthias Clasen 4c728e952b [colr] Add a todo 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 4b0285bae6 [colr] Use slant_xy 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b9314400ec [colr] Hook up color-line variation 2022-12-23 13:37:59 -07:00
Matthias Clasen a935e4b0c2 [paint] Add synthetic slant to root transform 2022-12-23 13:37:59 -07:00
Behdad Esfahbod edf2738263 [colr] Try fixing bot build
I don't get the error. Let's see.

../../src/harfbuzz/src/hb-ot-color-colr-table.hh:574:66: error: incomplete definition of type 'OT::NoVariable<OT::ColorLine<OT::NoVariable>>'
2022-12-23 13:37:59 -07:00
Matthias Clasen 686e627bdf [paint] Set up root transform in one place
Instead of spreading this in all the tables,
make hb_paint_funcs_t provide a push/pop_root_transform
that does all the setup.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c6dd56cc64 [colr] Simplify color-stop handling 2022-12-23 13:37:59 -07:00
Matthias Clasen 485ba9beb3 [paint] Spell out rectangle in the API
No need to abbreviate this.
2022-12-23 13:37:59 -07:00
Matthias Clasen 37f3f0fcc2 [paint] Change the image callback
Instead of passing the glyph ID, give
it the image blob, a mimetype, and
glyph extents (if available).

Update all callers.
2022-12-23 13:37:59 -07:00
Matthias Clasen ea48d6c292 Move hb_glyph_extents_t definition 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b722039c48 [colr] Simplify 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 452cfb9599 [colr] Simplify loop using iterators
Or complexify?!
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 601a596ca0 [paint] Fix include path 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 8a9069d55f [colr] Fix radial gradient
Broke it when adding variations.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod e799c33bb5 [paint] Fix function prototype 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 1953d26a8a [colr] Limit recursion depth 2022-12-23 13:37:59 -07:00
Matthias Clasen 378bbeea01 Add more docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 6079173a52 Try paint_glyph for more tables
If the COLR table does not paint the glyph,
try SVG, CBDT and sbix too, before giving up
on color.
2022-12-23 13:37:59 -07:00
Matthias Clasen e6c5a616aa SVG Implement paint-glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 23c60fd9b2 sbix: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 7996ae4c3d CBDT: Implement paint glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 82e23f322a paint: Add a paint-image callback
This will be used for image blobs like pngs and svgs.

FIXME: nail down and document sizing.
2022-12-23 13:37:59 -07:00
Matthias Clasen 56b02b6599 Update the docs
Mention that the color index will always be 0xFFFF
when using hb_paint API with fonts that don't have
color palettes.

And add an outline about which kinds of glyphs
require which callbacks.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9461ab7088 Try paint_glyph for more tables
If the COLR table can't paint the glyph,
try glyf, cff1 and cff2 too.
2022-12-23 13:37:59 -07:00
Matthias Clasen 3e39dd492b cff2: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen df89b52130 cff1: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 2edd771cf5 glyf: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 0b33b35eb0 COLRv1: Return bool from paint_glyph
This will let hb_ot_font_paint_glyph() try
multiple tables in turn.
2022-12-23 13:37:59 -07:00
Matthias Clasen 0d890061d1 Rename 'solid' to 'color'
'solid' does not really describe well what
the function does, and there is no strong
reason to stick 1:1 to the terminology used
in the spec.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 46286275f7 [colr] More dispatch functionality 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 81f232afb5 [colr] Use dispatch machinery for paint_glyph context 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a96300d42c [colr] Hide internal symbols 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b4cab86d94 Fix autotools build 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 0757519092 [colr] Add variation to rest of the paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 5bce005346 [colr] Flesh out variations for a few paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 9d3440b742 [colr] Add variation infrastructure to paint_glyph
No paint applies variations yet.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5c6329555e Apply root transform
This commit applies scale, slant is still missing.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5afca91ff2 Add some docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 44c68594f1 Some docs 2022-12-23 13:37:59 -07:00
Matthias Clasen d7c2eacf45 Handle COLRv0 layers in paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 55ca6ed230 minor fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 1880e54753 Assorted fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 684df8a82a add some todos 2022-12-23 13:37:59 -07:00
Matthias Clasen a6f813b680 Implement hb_color_line_get_extend 2022-12-23 13:37:59 -07:00
Matthias Clasen 3937d6b0aa Implement hb_color_line_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 64f1b55d01 api fixes: use floats consistently 2022-12-23 13:37:59 -07:00
Matthias Clasen 627c857f8b rename pop_group_and_composite 2022-12-23 13:37:59 -07:00
Matthias Clasen c9350838c7 assorted fixes and changes 2022-12-23 13:37:59 -07:00
Matthias Clasen 42324aef2b hb-paint: annotation fix 2022-12-23 13:37:59 -07:00
Matthias Clasen 8377341b28 wip: implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen efe13a191d fix introspection 2022-12-23 13:37:59 -07:00
Matthias Clasen 6a48ac42f4 COLR implementation 2022-12-23 13:37:59 -07:00
Matthias Clasen 71efa0dcf1 wip: hb_font_paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 83d0a49f71 wip: hb-paint 2022-12-23 13:37:59 -07:00
Matthias Clasen 30c5402e3d Make hb-features.h usable standalone
The intended use for hb-features.h is to
be included standalone, so we can't put
the single-include guards in here.
2022-12-23 12:33:28 -07:00
Behdad Esfahbod d628aff9db [ft] Apply slant in get_glyph_extents 2022-12-22 10:53:37 -07:00
Behdad Esfahbod 9a0ebd2b2a [glyf] Fix slant-scaling in GlyphHeader too 2022-12-22 10:21:50 -07:00
Behdad Esfahbod 392463bff5 [cff] Fix extent rounding
I broke it in b0abbfd868.
2022-12-22 08:34:01 -07:00
Behdad Esfahbod 897c102703 [font] Fix scale_glyph_extents 2022-12-22 08:15:01 -07:00
Behdad Esfahbod 9194e13e25 [font] Apply slant to glyph extents
Fixes https://github.com/harfbuzz/harfbuzz/issues/3952

hb-ft not fixed since doesn't use this code.
2022-12-22 07:32:29 -07:00
Behdad Esfahbod b0abbfd868 [font] Centralize glyph-extents scaling
Needs more testing...

Some rounding was removed, namely in cff1 and cff2.
2022-12-22 07:32:15 -07:00
Behdad Esfahbod 97b8ada865 [varc] Reset component coordinates to that of the font
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/78
2022-12-21 19:52:20 -07:00
Garret Rieger 40342c9437 [subset] check for addition overflow in hdmx size calculation.
Fixes https://oss-fuzz.com/testcase-detail/4877336988483584.
2022-12-21 16:44:06 -07:00
Garret Rieger d77fca997e [subset] when subsetting preprocessor fails, reference the returned face.
The caller of the method is expected to destroy the returned result.
2022-12-21 15:04:27 -07:00
Behdad Esfahbod 9b5b4da0e4 [varc] Set coordinates as absolute values 2022-12-20 09:58:04 -07:00
Behdad Esfahbod 80e68f09c5 [VarC] Change rotation/skew representation
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/77
2022-12-19 19:17:04 -07:00
Garret Rieger 1840b02e6a [subset] Don't gate access to the table repacker.
Any table with an object graph should repack correctly.
2022-12-19 17:57:33 -07:00
Behdad Esfahbod 03a1685693 [VarC] Change representation of scale from 4.12 to 6.10
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/76
2022-12-19 17:12:09 -07:00
Matthias Clasen c292e577ff Fix a typo 2022-12-19 20:04:36 +02:00
Matthias Clasen b795246fff [draw] Clarify the docs
Disambiguate the origin of draw_data and user_data,
this had me confused a few times.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/3955
2022-12-19 20:04:36 +02:00
Matthias Clasen eddb408f9c [draw] Small doc fix 2022-12-19 20:03:57 +02:00
Khaled Hosny bc4c290b75 [doc] Workaround gtk-doc limitation with HB_DEPRECATED_FOR
See https://github.com/harfbuzz/harfbuzz/issues/3957#issuecomment-1356890525
2022-12-19 00:59:50 +02:00
Khaled Hosny f9e1192d58 [ot-tag] Document two deprecated symbols
See https://github.com/harfbuzz/harfbuzz/issues/3957
2022-12-18 23:58:36 +02:00
Khaled Hosny 947e01a7c1 [subset] Suppress gtk-doc warning 2022-12-18 23:40:01 +02:00
Nirbheek Chauhan 7be06f6377 meson: Override dependencies to improve usage as a subproject
With this change, harfbuzz can be consumed as a subproject without
making any changes to the build files of a project. All you need to do
is provide a wrap file with a `[provide]` section:

https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section

This is also necessary because otherwise projects need to hard-code
the subproject name, which might be `harfbuzz` when using `wrap-git` or
`harfbuzz-6.0.0` when using `wrap-file` (to build from a release
tarball). This can cause conflicts between different subprojects that
consume harfbuzz differently.

Other projects like glib, cairo, pango, etc already do this.
2022-12-18 08:28:55 +02:00
Behdad Esfahbod 206957aee4 [COLR] Change recursion limit back to 128 2022-12-17 08:57:56 -07:00
Khaled Hosny afcae83a06 6.0.0 2022-12-16 23:35:26 +02:00
Matthias Clasen a98c6fdd92 Mark an argument as unused 2022-12-16 13:23:01 -07:00
Matthias Clasen 601d3806c9 COLRv1: Revamp extents variation
Try to do this a cleaner way.
2022-12-16 13:23:01 -07:00
Behdad Esfahbod 51a17201a7 [open-type] In to_float() take offset as float 2022-12-16 12:28:50 -07:00
Behdad Esfahbod f252cf80e1 [open-type] Allow passing an offset to to_float() 2022-12-16 12:03:51 -07:00
Behdad Esfahbod 6ae35365f8 Fix build 2022-12-16 11:43:38 -07:00
Behdad Esfahbod e957391efe [colr] Add NoVariable::varIdxBase 2022-12-16 11:33:04 -07:00
Behdad Esfahbod e06de98c36 [var-common] Make VarInstancer take an offset 2022-12-16 11:31:00 -07:00