aboutsummaryrefslogtreecommitdiffstats
path: root/text/shape-build.h
blob: dd931774c25fa78280a9e9d3cbe752aa1b2af2ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef VEGA_SHAPE_BUILD_H
#define VEGA_SHAPE_BUILD_H
#include "shape.h"
#include <hb.h>
#include <stdio.h>

/* Building a shaping section (text/shape.h), and checking it, with
 * HarfBuzz: only the build tool links this. */

typedef struct { unsigned char *bytes; size_t size; } VegaSection;

/* A section for face: plans for each script (ISO 15924 tags) and both
 * directions, compiled as
 * HarfBuzz's planner compiles it. Refuses a script HarfBuzz shapes with a
 * shaper other than the default, Arabic and Hebrew ones, or a font that
 * needs what those do without GPOS (fallback positioning, 'kern' tables,
 * AAT). glyphs, when given, gets every glyph shaping can reach from codes
 * (for their outlines). */
bool vega_shaping_compile(hb_face_t *face, const uint32_t *scripts, size_t script_count, const uint32_t *codes,
                          size_t code_count, VegaSection *out, hb_set_t *glyphs, char *error, size_t error_size);

typedef struct {
    size_t runs, characters, glyphs, differences;
    double vega_seconds, harfbuzz_seconds; /* shaping alone, each */
} VegaShapeCheck;
/* Shape runs random runs of script (in its plan's direction) made of codes
 * with both the section and HarfBuzz, and count the runs that differ (the
 * first few are written to report). */
void vega_shaping_check(hb_font_t *font, const VegaShaping *s, uint32_t script, int direction, const uint32_t *codes,
                        size_t code_count, uint64_t seed, size_t runs, VegaShapeCheck *out, FILE *report);
#endif