Commit Graph

713 Commits

Author SHA1 Message Date
Behdad Esfahbod 3c972867b9 More s/hb_font_get_glyph_shape/hb_font_draw_glyph/ 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 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
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 b0fa40b2ec tests: More diagnostics 2022-12-23 13:37:59 -07:00
Matthias Clasen 290bb338bf Dist test result files 2022-12-23 13:37:59 -07:00
Matthias Clasen 74ccc1e76d tests: Produce useful output on failure 2022-12-23 13:37:59 -07:00
Matthias Clasen 084291108a Tests: Fix memleak pointed out by valgrind 2022-12-23 13:37:59 -07:00
Behdad Esfahbod d8cb7ceefb [test] Try fixing bots with old glib 2022-12-23 13:37:59 -07:00
Matthias Clasen 2d4678b647 Add a comment 2022-12-23 13:37:59 -07:00
Matthias Clasen 30a6fd04d0 [colr] Add some tests 2022-12-23 13:37:59 -07:00
Qunxin Liu 8eadb83640 [subset] Update hb_subset_input_override_name_table API
Override the name string for the NameRecord identified by name_id,
platform_id, encoding_id and language_ids specified by the user.
If a record with specified name_id does not exist, this API will create
a new NameRecord with provided info and insert it to the name table.
2022-12-02 18:05:53 -07:00
Behdad Esfahbod 527823ccac [unicode] Destroy user_data in set_funcs fail paths
This is what the font_funcs / draw_funcs do.
2022-11-19 15:19:08 -07:00
Qunxin Liu 6314aa7da4 [subset] add an experimental API that can override name strings for specified name_id 2022-11-08 14:10:25 -07:00
David Corbett ade87e1538 [Unicode 15] Add tests 2022-08-27 19:11:19 -04:00
Behdad Esfahbod 4ab7e579cb Make HB_BORING_EXPANSION opt-in instead of opt-out
Fixes https://github.com/harfbuzz/harfbuzz/issues/3757
2022-08-12 12:23:48 -06:00
Garret Rieger f3aff45e04 [repacker] Update call to hb_subset_repack_or_fail in tests. 2022-07-29 16:16:46 -06:00
Behdad Esfahbod 1945b400da [cpluscplus] Wrap hb-subset types as well
Also changes signature of get_user_data of hb.h types to take const
object. This is safe.
2022-07-25 10:45:55 -06:00
Frédéric Wang 32e542d6f0 try & fix build errors on the bot 2022-06-29 10:08:07 -06:00
Frédéric Wang 03d2376745 [math] Improve fuzzing coverage
Extend testing to cover parts that are missing according to the recent
oss-fuzz-coverage report:
- Retriving all constants from MathConstants.
- Retrieving entries from MathKern, MathGlyphPartRecord and
  MathGlyphAssembly.
- Retrieving italic correction from MathGlyphAssembly.
- Choosing between horizontal/vertical offset in MathVariants.

https://storage.googleapis.com/oss-fuzz-coverage/harfbuzz/reports/20220627/linux/src/harfbuzz/src/hb-ot-math-table.hh.html
https://github.com/harfbuzz/harfbuzz/issues/3688
2022-06-29 10:08:07 -06:00
Behdad Esfahbod d3308f4713 [font] Optimize font scaling further 2022-06-27 11:28:57 -06:00
Behdad Esfahbod 556e7078f0 [font] Optimize glyph scaling 2022-06-26 17:48:43 -06:00
Garret Rieger af74ab452f [repack] always run the sort in repack.
This is needed to ensure virtual link ordering constraints are respected when repack is being called from fontTools. For subset usage, repack won't be called if the graph doesn't already overflow so this change doesn't cause any extra work.
2022-06-16 15:17:58 -06:00
Behdad Esfahbod b39b5f2f31 [name] Implement approximate language matching
Very rudimentary.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3354
2022-06-03 13:00:33 +01:00
Behdad Esfahbod 7aacdd05bd [cplusplus] Test hashing shared_ptr / unique_ptr 2022-06-03 02:10:06 -06:00
Behdad Esfahbod d7785a6da0 [cplusplus] Add unique_ptr 2022-06-02 12:43:04 -06:00
Behdad Esfahbod e0f3cab246 [cplusplus] Add hb-cplusplus.hh
Fixes https://github.com/harfbuzz/harfbuzz/issues/2152
2022-06-02 18:22:05 +01:00
Garret Rieger 3472f73b79 [subset] also include no subset tables when guessing which tables are present. 2022-05-25 21:52:48 +00:00
Garret Rieger 9564d98739 [subset] fix subsetting of faces created via hb_face_create_for_tables.
Fixes #3609.
2022-05-25 21:16:37 +00:00
Garret Rieger 4e11da054d [repacker] update repacker test golden file.
Changed due to removal of Kahn sorting.
2022-05-20 09:41:18 -06:00
Behdad Esfahbod 25393288f0 [test] Fix compiler warning 2022-05-19 18:16:48 -06:00
Andrew John 0182988229
[set] Add call to export set contents to an array. (#3500)
[set] Add hb_set_next_many.
2022-03-25 09:36:44 -06:00
Behdad Esfahbod 36b8f97413 Update tests for recent changes 2022-03-21 21:50:04 -06:00
Andy John ef588ea97b Add option to insert a sorted arrays of values to sets. 2022-03-21 15:32:59 -06:00
Qunxin Liu a35757c6bc [repacker] expose hb_subset_repack() API, hb_object_t and hb_link_t structs 2022-03-10 17:26:20 -07:00
Garret Rieger f6071c16b0
[subset] Rename codepoint -> unicode in subset plan api 2022-02-28 23:45:40 +02:00
Behdad Esfahbod 222301bfa4
Merge pull request #3429 from harfbuzz/external_plan
[subset] expose subset plan in public subsetting API
2022-02-24 12:55:01 -07:00
Matthias Clasen d4cb07728c Add a missing file
The style test is using notosansitalic.ttf now,
but I forgot to add it with the test. Fix that.
2022-02-18 18:27:02 -06:00
Matthias Clasen 16b232be0e [hb-style] Fix the sign of slant ratios
We want negative slant angles to yield
positive slant ratios. Fix that.

Test included.
2022-02-18 18:10:34 -06:00
Matthias Clasen e76061a737 [hb-style] Fix synthetic slant values
When reporting the slant ratio of a font
that has synthetic slant set, we were
reporting twice the expected value.
Fix that. Test included.
2022-02-18 17:53:54 -06:00
Behdad Esfahbod f8e9e315bb
Merge pull request #3437 from matthiasclasen/synthesize-missing-baselines
[BASE] Synthesize missing baselines
2022-02-17 14:34:46 -06:00
Matthias Clasen f81578fd86 [ot-layout] Synthesize missing baselines
Add a variation of hb_ot_layout_get_baseline that
synthesizes missing baselines, using heuristics in part
taken from the CSS Inline Layout Module, Level 3.

Includes some new tests for synthesized baselines.
The base2.ttf is a subset of Noto Sans Bengali that
includes just the Bengali Ka.

New API: hb_ot_layout_get_baseline_with_fallback
2022-02-16 17:37:33 -06:00
Behdad Esfahbod d2998faad3
Merge pull request #3410 from harfbuzz/boring-expansion
[Boring Expansion] >64k loca & hmtx tables

This does two things:

The num-glyphs reported by the face now is the maximum reported by the maxp and that deduced from the length of the loca table; I think this is the right thing to do anyway; According to OpenType such loca tables are invalid.

The interpretation hmtx tables that have excessive bytes at the end, again, invalid according to OpenType, has changed. Previously we were interpreting those excessive bytes as extra lsb values. Now we interpret them as extra advance values, the last of which is repeated for all missing glyphs. Again, these are tables that are invalid according to OpenType, and the advances are for glyph indices beyond maxp table's num-glyphs.

The combined effect is that the font can have shapes and advances for gid's beyond the maxp limit of 64k. In fact, maxp table becomes optional.
2022-02-16 14:37:09 -06:00
Khaled Hosny cfa8cd7fb0 [autotools] Fix make distcheck
The test-draw.c can now optionally uses hb-ft, but automake file was not
passing FreeType cflags or libs to it.
2022-02-16 11:58:38 +02:00
Behdad Esfahbod 67eb9acf79 [config] Add HB_NO_BORING_EXPANSION 2022-02-15 17:17:49 -06:00
Behdad Esfahbod 197ed8f592 [test/api] Fix leaks 2022-02-15 14:30:12 -06:00
Behdad Esfahbod 531c27d199 Fix build 2022-02-15 14:20:54 -06:00
Behdad Esfahbod 8b7ccc41c4 [hmtx] Implement [boring-expansion] >64k expansion
This implements https://github.com/be-fonts/boring-expansion-spec/issues/7
2022-02-15 14:15:12 -06:00