gpforge
An advanced bitmap font editor
Loading...
Searching...
No Matches
lint.h File Reference

The lint checks. More...

#include "font.h"

Go to the source code of this file.

Data Structures

struct  gpf_lint_finding
 A linter finding. More...

Enumerations

enum  gpf_lint_severity { GPF_LINT_ERROR , GPF_LINT_WARN }
 Linter severity. More...

Functions

struct gpf_lint_finding * gpf_lint (struct gpf_font *font)
 Runs linter on a font.
int gpf_lint_glyph (struct gpf_font *font, enum gpf_variant_id id, uint32_t code, struct gpf_lint_finding *out)
 Runs a linter for a single glyph.
const char * gpf_lint_severity_name (enum gpf_lint_severity sev)
 Returns severity name.

Detailed Description

The lint checks.

Linter checks for the glyphs. E.g. ink that leaves a monospace cell, an advance that disagrees with the variant, a glyph the base variant has not got.

Definition in file lint.h.

Enumeration Type Documentation

◆ gpf_lint_severity

Linter severity.

Enumerator
GPF_LINT_ERROR 

The font renders wrong.

GPF_LINT_WARN 

Probably a slip. May be deliberate.

Definition at line 21 of file lint.h.

Function Documentation

◆ gpf_lint()

struct gpf_lint_finding * gpf_lint ( struct gpf_font * font)

Runs linter on a font.

Every finding in the font, as a gp_vec sorted by variant and then by codepoint. Free it with gp_vec_free().

Parameters
fontA font to run linter for.
Returns
A gp_vec of linter findings, NULL on an allocation failure.

Definition at line 244 of file lint.c.

References GPF_VARIANTS.

◆ gpf_lint_glyph()

int gpf_lint_glyph ( struct gpf_font * font,
enum gpf_variant_id id,
uint32_t code,
struct gpf_lint_finding * out )

Runs a linter for a single glyph.

The first finding for one glyph, or non zero when it has none.

Parameters
fontA font to run the linter for.
idA glyph variant to run the linter for.
codeA unicode code point of the glyph.
outWhere to store the finding, if there was one.
Returns
Zero if a finding was stored into out, non-zero otherwise.

Definition at line 232 of file lint.c.

◆ gpf_lint_severity_name()

const char * gpf_lint_severity_name ( enum gpf_lint_severity sev)

Returns severity name.

Parameters
sevA severity level.
Returns
A name for the severity level.

Definition at line 288 of file lint.c.

References GPF_LINT_ERROR, GPF_LINT_WARN, and gpf_lint_finding::sev.