|
gpforge
An advanced bitmap font editor
|
The glyph variant lattice. More...
#include "font.h"Go to the source code of this file.
Data Structures | |
| struct | gpf_resolved |
| A resolved glyph and where it was drawn from. More... | |
Enumerations | |
| enum | gpf_provenance { GPF_PROV_STORED , GPF_PROV_COMPOSED , GPF_PROV_INHERITED , GPF_PROV_EMBOLDENED , GPF_PROV_BOLD_MONO } |
| Glyph provenance. More... | |
| enum | gpf_entry_form { GPF_ENTRY_NONE , GPF_ENTRY_METRICS , GPF_ENTRY_INK } |
| The smallest form an entry can be written in on save. More... | |
| enum | gpf_measure { GPF_MEASURE_X_HEIGHT , GPF_MEASURE_CAP_HEIGHT , GPF_MEASURE_CH_WIDTH } |
| The family metrics that are measured off the glyphs. More... | |
Functions | |
| const char * | gpf_provenance_name (enum gpf_provenance prov) |
| Returns provenance name. | |
| 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. | |
| 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. | |
| void | gpf_resolved_clear (struct gpf_resolved *self) |
| Clears the resolved glyph. | |
| enum gpf_entry_form | gpf_entry_form (struct gpf_font *font, enum gpf_variant_id id, const struct gpf_glyph *glyph, struct gpf_glyph *out) |
| Computes what should be saved to disk for a glyph variant. | |
| void | gpf_font_simplify (struct gpf_font *font) |
| Simplifies a font. | |
| int | gpf_measure (struct gpf_font *font, enum gpf_variant_id id, enum gpf_measure what, int *val) |
| Measures a font metric. | |
The glyph variant lattice.
Definition in file resolve.h.
| enum gpf_entry_form |
| enum gpf_measure |
| enum gpf_provenance |
Glyph provenance.
Where the ink of a resolved glyph came from. The editor shows this per glyph, it answers "why does this glyph look like that".
| enum gpf_entry_form gpf_entry_form | ( | struct gpf_font * | font, |
| enum gpf_variant_id | id, | ||
| const struct gpf_glyph * | glyph, | ||
| struct gpf_glyph * | out ) |
Computes what should be saved to disk for a glyph variant.
Compares the entry against gpf_resolve_derived(). Only an ink entry in a variant with a parent can shrink, anything else is GPF_ENTRY_INK.
| font | A font. |
| id | A glyph variant e.g. GPF_REGULAR, GPF_MONO, etc. |
| glyph | A glyph entry to be saved. |
| out | A numbers only entry, filled with the numbers that differ, meaningful for GPF_ENTRY_METRICS. |
Definition at line 436 of file resolve.c.
References gpf_glyph::advance, gpf_glyph::base, gpf_glyph::bearing_x, gpf_glyph::bearing_y, gpf_glyph::bits, gpf_glyph::code, GPF_ENTRY_INK, GPF_ENTRY_METRICS, GPF_ENTRY_NONE, GPF_GLYPH_INK, GPF_GLYPH_METRICS, GPF_NO_PARENT, gpf_variant_parent(), gpf_glyph::has_advance, gpf_glyph::has_shift, gpf_glyph::height, gpf_glyph::kind, gpf_glyph::shift_x, and gpf_glyph::width.
| void gpf_font_simplify | ( | struct gpf_font * | font | ) |
Simplifies a font.
Rewrites every overlay entry into the smallest form that is true, the same decision the writer makes.
Editing materializes glyphs as ink, so this is what makes the editor say "inherited" again after a metrics only edit instead of "stored".
| font | A font. |
Definition at line 489 of file resolve.c.
References gpf_glyph::bits, gpf_glyph::code, gpf_variant::glyphs, GPF_ENTRY_INK, GPF_ENTRY_METRICS, GPF_ENTRY_NONE, GPF_NO_PARENT, gpf_variant_glyph_del(), gpf_variant_glyphs(), gpf_variant_parent(), GPF_VARIANTS, and gpf_font::variants.
| int gpf_measure | ( | struct gpf_font * | font, |
| enum gpf_variant_id | id, | ||
| enum gpf_measure | what, | ||
| int * | val ) |
Measures a font metric.
| font | A font. |
| id | A glyph variant e.g. GPF_REGULAR, GPF_MONO, etc. |
| what | Which metric to measure. |
| val | Where to store the result to. |
Definition at line 536 of file resolve.c.
References gpf_glyph::advance, gpf_glyph::bearing_y, gpf_resolved::glyph, GPF_MEASURE_CAP_HEIGHT, GPF_MEASURE_CH_WIDTH, GPF_MEASURE_X_HEIGHT, gpf_resolve(), gpf_resolved_clear(), and gpf_glyph::height.
| const char * gpf_provenance_name | ( | enum gpf_provenance | prov | ) |
| 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.
| font | A font. |
| id | A variant id e.g. GPF_MONO, GPF_BOLD, etc. |
| code | An unicode codepoint to resolve. |
| res | A resolved struct to store the result into. |
Definition at line 521 of file resolve.c.
References gpf_glyph::code, and gpf_resolved::glyph.
Referenced by gpf_accent_ink(), gpf_bdf_write(), gpf_cell_draw(), gpf_cell_draw_glyph(), gpf_deps_draw(), gpf_deps_input(), gpf_gui_accented(), and gpf_measure().
| 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.
What the glyph would be if this variant had no entry for it — the thing an overlay entry is an override of. Used when saving to write the smallest form an entry can take.
| font | A font. |
| id | A variant id e.g. GPF_MONO, GPF_BOLD, etc. |
| code | An unicode codepoint to resolve. |
| res | A resolved struct to store the result into. |
Definition at line 412 of file resolve.c.
References gpf_glyph::code, GPF_GLYPH_METRICS, gpf_variant_glyph(), gpf_variant::id, gpf_glyph::kind, and gpf_font::variants.
| void gpf_resolved_clear | ( | struct gpf_resolved * | self | ) |
Clears the resolved glyph.
Frees the ink and clears the gpf_resolved::glyph structure.
| self | A resolved glyph. |
Definition at line 30 of file resolve.c.
References gpf_glyph::bits, and gpf_resolved::glyph.
Referenced by gpf_accent_ink(), gpf_bdf_write(), gpf_cell_draw(), gpf_cell_draw_glyph(), gpf_deps_input(), gpf_gui_accented(), and gpf_measure().