gpforge
An advanced bitmap font editor
Loading...
Searching...
No Matches
resolve.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2026 Cyril Hrubis <metan@ucw.cz>
4 */
9#ifndef GPFORGE_RESOLVE_H
10#define GPFORGE_RESOLVE_H
11
12#include "font.h"
13
32
48
55const char *gpf_provenance_name(enum gpf_provenance prov);
56
68int gpf_resolve(struct gpf_font *font, enum gpf_variant_id id, uint32_t code,
69 struct gpf_resolved *res);
70
86int gpf_resolve_derived(struct gpf_font *font, enum gpf_variant_id id,
87 uint32_t code, struct gpf_resolved *res);
88
96void gpf_resolved_clear(struct gpf_resolved *self);
97
109
124enum gpf_entry_form gpf_entry_form(struct gpf_font *font,
125 enum gpf_variant_id id,
126 const struct gpf_glyph *glyph,
127 struct gpf_glyph *out);
128
140void gpf_font_simplify(struct gpf_font *font);
141
142/*
143 * The composition that defines a glyph in a variant, from the variant itself
144 * or inherited from a parent, or NULL when the glyph is not composed. A
145 * composition is inherited as a definition, so that a variant which redraws
146 * the base redraws everything composed from it.
147 */
148struct gpf_glyph *gpf_compose_def(struct gpf_font *font,
149 enum gpf_variant_id id, uint32_t code);
150
162
173int gpf_measure(struct gpf_font *font, enum gpf_variant_id id,
174 enum gpf_measure what, int *val);
175
176#endif /* GPFORGE_RESOLVE_H */
The in-memory font model.
gpf_variant_id
Font face variant.
Definition font.h:34
const char * gpf_provenance_name(enum gpf_provenance prov)
Returns provenance name.
Definition resolve.c:25
void gpf_font_simplify(struct gpf_font *font)
Simplifies a font.
Definition resolve.c:489
gpf_entry_form
The smallest form an entry can be written in on save.
Definition resolve.h:101
@ GPF_ENTRY_METRICS
The ink is the parent's, only numbers differ.
Definition resolve.h:105
@ GPF_ENTRY_INK
The ink differs, it has to be saved.
Definition resolve.h:107
@ GPF_ENTRY_NONE
Identical to what the variant would derive, no entry needed.
Definition resolve.h:103
int gpf_resolve_derived(struct gpf_font *font, enum gpf_variant_id id, uint32_t code, struct gpf_resolved *res)
Resolves a derived glyph variant metric and ink.
Definition resolve.c:412
gpf_measure
The family metrics that are measured off the glyphs.
Definition resolve.h:154
@ GPF_MEASURE_CH_WIDTH
The advance of the '0' glyph.
Definition resolve.h:160
@ GPF_MEASURE_CAP_HEIGHT
The top of the 'H' ink above the baseline.
Definition resolve.h:158
@ GPF_MEASURE_X_HEIGHT
The top of the 'x' ink above the baseline.
Definition resolve.h:156
void gpf_resolved_clear(struct gpf_resolved *self)
Clears the resolved glyph.
Definition resolve.c:30
int gpf_resolve(struct gpf_font *font, enum gpf_variant_id id, uint32_t code, struct gpf_resolved *res)
Resolves a glyph variant metric and ink.
Definition resolve.c:521
gpf_provenance
Glyph provenance.
Definition resolve.h:20
@ GPF_PROV_EMBOLDENED
The parent's ink, emboldened.
Definition resolve.h:28
@ GPF_PROV_COMPOSED
Built from a base glyph and an accent.
Definition resolve.h:24
@ GPF_PROV_BOLD_MONO
Bold taking a hand fixed glyph from bold-mono.
Definition resolve.h:30
@ GPF_PROV_INHERITED
The parent's ink, the metrics may still be overridden.
Definition resolve.h:26
@ GPF_PROV_STORED
The ink is stored in the variant itself.
Definition resolve.h:22
A font family.
Definition font.h:274
A glyph.
Definition font.h:80
uint32_t code
Unicode code point.
Definition font.h:84
A resolved glyph and where it was drawn from.
Definition resolve.h:36
enum gpf_variant_id ink_from
The variant the ink came from.
Definition resolve.h:46
enum gpf_provenance prov
Where the glyph came from.
Definition resolve.h:44
struct gpf_glyph glyph
Freshly allocated glyph with copied/generated ink.
Definition resolve.h:42