Skip to content

Commit

Permalink
[test] Build with HB_MINI
Browse files Browse the repository at this point in the history
Also add CONFIG.md instructions for building configs with meson.

Fixes #4760
  • Loading branch information
behdad committed Jun 20, 2024
1 parent 106e406 commit 49c8493
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ The pre-defined configurations are:
disabling thread-safety and debugging, and use even more size-optimized data
tables.

To setup the build with these options use something like:
```
$ meson setup build -Dcpp_args=-DHB_MINI -Dc_args=-DHB_MINI
```

## Tailoring configuration

Expand All @@ -155,4 +159,4 @@ Note that the config option `HB_NO_CFF`, which is enabled by `HB_LEAN` and
`HB_TINY` does *not* mean that the resulting library won't work with CFF fonts.
The library can shape valid CFF fonts just fine, with or without this option.
This option disables (among other things) the code to calculate glyph extents
for CFF fonts, which many clients might not need.
for CFF fonts or draw them, which many clients might not need.
4 changes: 2 additions & 2 deletions src/hb-subset-plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ _collect_base_variation_indices (hb_subset_plan_t* plan)
base->collect_variation_indices (plan, varidx_set);
const OT::ItemVariationStore &var_store = base->get_var_store ();
unsigned subtable_count = var_store.get_sub_table_count ();


_remap_variation_indices (var_store, varidx_set,
plan->normalized_coords,
Expand Down Expand Up @@ -731,7 +731,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
plan->codepoint_to_glyph->alloc (unicodes->get_population () + glyphs->get_population ());

auto &gid_to_unicodes = plan->accelerator->gid_to_unicodes;

for (hb_codepoint_t gid : *glyphs)
{
auto unicodes = gid_to_unicodes.get (gid);
Expand Down
6 changes: 6 additions & 0 deletions test/api/test-aat-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
static hb_face_t *face;
static hb_face_t *sbix;

#ifndef HB_NO_AAT

static void
test_aat_get_feature_types (void)
{
Expand Down Expand Up @@ -114,15 +116,19 @@ test_aat_has (void)
hb_face_destroy (trak);
}

#endif

int
main (int argc, char **argv)
{
unsigned int status;
hb_test_init (&argc, &argv);

#ifndef HB_NO_AAT
hb_test_add (test_aat_get_feature_types);
hb_test_add (test_aat_get_feature_selectors);
hb_test_add (test_aat_has);
#endif

face = hb_test_open_font_file ("fonts/aat-feat.ttf");
sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf");
Expand Down
2 changes: 2 additions & 0 deletions test/api/test-ot-face.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ test_font (hb_font_t *font, hb_codepoint_t cp)
hb_ot_color_has_png (face);
hb_blob_destroy (hb_ot_color_glyph_reference_png (font, cp));

#ifndef HB_NO_AAT
{
hb_aat_layout_feature_type_t feature = HB_AAT_LAYOUT_FEATURE_TYPE_ALL_TYPOGRAPHIC;
unsigned count = 1;
Expand All @@ -87,6 +88,7 @@ test_font (hb_font_t *font, hb_codepoint_t cp)
hb_aat_layout_feature_type_get_selector_infos (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, 0, &count, &setting, &default_index);
result += count + feature + setting.disable + setting.disable + setting.name_id + setting.reserved + default_index;
}
#endif

hb_set_t *lookup_indexes = hb_set_create ();
hb_set_add (lookup_indexes, 0);
Expand Down
2 changes: 2 additions & 0 deletions test/fuzzing/hb-fuzzer.hh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <hb-config.hh>

#include <hb.h>
#include <stddef.h>

Expand Down

0 comments on commit 49c8493

Please sign in to comment.