gpforge
An advanced bitmap font editor
Loading...
Searching...
No Matches
compose.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 */
17#ifndef GPFORGE_COMPOSE_H
18#define GPFORGE_COMPOSE_H
19
20#include <stdint.h>
21
22#include "font.h"
23#include "resolve.h"
24
36
42 uint32_t code;
44 uint32_t base_code;
51 uint32_t draw_base;
60 uint32_t mark;
67 uint32_t accent;
70};
71
77extern const struct gpf_decomposition gpf_decompositions[];
78
92unsigned int gpf_decompose_accented(uint32_t base_code, uint32_t *codes,
93 unsigned int max);
94
109unsigned int gpf_decompose_by_accent(uint32_t accent, uint32_t *codes,
110 unsigned int max);
111
122uint32_t gpf_decompose_base(uint32_t code);
123
130const struct gpf_decomposition *gpf_decompose(uint32_t code);
131
148void gpf_accent_offset(const struct gpf_font *font,
149 const struct gpf_glyph *base,
150 const struct gpf_glyph *accent,
151 enum gpf_accent_place place, int *dx, int *dy);
152
165int gpf_compose(struct gpf_glyph *dst, const struct gpf_glyph *base,
166 const struct gpf_glyph *accent, int dx, int dy);
167
179int gpf_compose_remainder(const struct gpf_glyph *glyph,
180 const struct gpf_glyph *base, struct gpf_glyph *rem);
181
195int gpf_draw_base(struct gpf_font *font, enum gpf_variant_id id,
196 const struct gpf_decomposition *decomp,
197 struct gpf_resolved *res);
198
216int gpf_accent_ink(struct gpf_font *font, enum gpf_variant_id id,
217 const struct gpf_decomposition *decomp,
218 struct gpf_glyph *out);
219
220#endif /* GPFORGE_COMPOSE_H */
int gpf_compose_remainder(const struct gpf_glyph *glyph, const struct gpf_glyph *base, struct gpf_glyph *rem)
Subtracts the base ink from a glyph.
Definition compose.c:543
unsigned int gpf_decompose_accented(uint32_t base_code, uint32_t *codes, unsigned int max)
Returns all accented forms of a letter.
Definition compose.c:372
int gpf_accent_ink(struct gpf_font *font, enum gpf_variant_id id, const struct gpf_decomposition *decomp, struct gpf_glyph *out)
The accent of a decomposition, as this font draws it.
Definition compose.c:725
int gpf_draw_base(struct gpf_font *font, enum gpf_variant_id id, const struct gpf_decomposition *decomp, struct gpf_resolved *res)
The letter a new accented letter is drawn from.
Definition compose.c:660
uint32_t gpf_decompose_base(uint32_t code)
Looks up the base letter of an accented letter.
Definition compose.c:411
int gpf_compose(struct gpf_glyph *dst, const struct gpf_glyph *base, const struct gpf_glyph *accent, int dx, int dy)
Composes the base ink with the accent ink.
Definition compose.c:494
unsigned int gpf_decompose_by_accent(uint32_t accent, uint32_t *codes, unsigned int max)
Looks up all glyphs for a given accent.
Definition compose.c:392
void gpf_accent_offset(const struct gpf_font *font, const struct gpf_glyph *base, const struct gpf_glyph *accent, enum gpf_accent_place place, int *dx, int *dy)
The default offset for an accent on a base.
Definition compose.c:418
const struct gpf_decomposition * gpf_decompose(uint32_t code)
Looks up the decomposition of an accented letter.
Definition compose.c:357
gpf_accent_place
Accent location in the glyph rectangle.
Definition compose.h:28
@ GPF_ACCENT_ABOVE
Centred over the ink, one blank row above it.
Definition compose.h:30
@ GPF_ACCENT_BELOW
Centred under the ink, right below it.
Definition compose.h:32
@ GPF_ACCENT_OGONEK
Right aligned with the ink, right below it.
Definition compose.h:34
The in-memory font model.
gpf_variant_id
Font face variant.
Definition font.h:34
The glyph variant lattice.
A glyph decomposition.
Definition compose.h:40
uint32_t draw_base
What a new one is drawn from.
Definition compose.h:51
enum gpf_accent_place place
Where the accent is placed in the glyph rectangle.
Definition compose.h:69
uint32_t accent
The spacing accent, the one that gets typed.
Definition compose.h:67
uint32_t mark
The combining mark unicode decomposes the letter into.
Definition compose.h:60
uint32_t base_code
The letter this is an accented form of, e.g. 'i' for 'í'.
Definition compose.h:44
uint32_t code
A unicode code point of the accented letter.
Definition compose.h:42
A font family.
Definition font.h:274
A glyph.
Definition font.h:80
A resolved glyph and where it was drawn from.
Definition resolve.h:36