The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
bragi_internal.h File Reference

what the bragi sources share: the font, the face and the glyph. More...

#include "bragi.h"
#include "../stb/stb_truetype.h"

Go to the source code of this file.

Data Structures

struct  bragi_font
struct  bragi_glyph
 one glyph image in a face's cache. More...
struct  bragi_face

Macros

#define STBTT_assert(x)
#define BRAGI_UNITS   64
#define BRAGI_SUBPIXELS   4
#define BRAGI_HASH_SIZE   256

Typedefs

typedef struct bragi_glyph bragi_glyph_t
 one glyph image in a face's cache.

Functions

bragi_face_t * bragi_find_glyph (bragi_face_t *face, uint32_t codepoint, int *glyph)
 find the face (this one or a fallback) and the glyph for a character.
int32_t bragi_advance (const bragi_face_t *face, int glyph)
 the advance of a glyph in 1/64 pixels.
int32_t bragi_kerning (const bragi_face_t *face, int left, int right)
 the kerning between two glyphs of the same face, in 1/64 pixels.
const bragi_glyph_t * bragi_glyph (bragi_face_t *face, int glyph, int subpixel)
 a glyph image from the cache, made if it is not there.
void bragi_blend_mask (gfx_buffer_t *buf, int32_t x, int32_t y, const uint8_t *mask, int32_t width, int32_t height, int32_t stride, gfx_color_t color)
 blend a coverage mask in a colour over buf (in sRGB, as browsers do).

Detailed Description

what the bragi sources share: the font, the face and the glyph.

Macro Definition Documentation

◆ STBTT_assert

#define STBTT_assert ( x)
Value:
((void)0)

◆ BRAGI_UNITS

#define BRAGI_UNITS   64

◆ BRAGI_SUBPIXELS

#define BRAGI_SUBPIXELS   4

◆ BRAGI_HASH_SIZE

#define BRAGI_HASH_SIZE   256

Typedef Documentation

◆ bragi_glyph_t

typedef struct bragi_glyph bragi_glyph_t

one glyph image in a face's cache.

Function Documentation

◆ bragi_find_glyph()

bragi_face_t * bragi_find_glyph ( bragi_face_t * face,
uint32_t codepoint,
int * glyph )

find the face (this one or a fallback) and the glyph for a character.

with no face that has it, the face itself and glyph 0 (the "missing glyph" box).

◆ bragi_advance()

int32_t bragi_advance ( const bragi_face_t * face,
int glyph )

the advance of a glyph in 1/64 pixels.

◆ bragi_kerning()

int32_t bragi_kerning ( const bragi_face_t * face,
int left,
int right )

the kerning between two glyphs of the same face, in 1/64 pixels.

◆ bragi_glyph()

const bragi_glyph_t * bragi_glyph ( bragi_face_t * face,
int glyph,
int subpixel )

a glyph image from the cache, made if it is not there.

Parameters
subpixel0 to BRAGI_SUBPIXELS - 1.
Returns
the glyph, or NULL when out of memory.

◆ bragi_blend_mask()

void bragi_blend_mask ( gfx_buffer_t * buf,
int32_t x,
int32_t y,
const uint8_t * mask,
int32_t width,
int32_t height,
int32_t stride,
gfx_color_t color )

blend a coverage mask in a colour over buf (in sRGB, as browsers do).

Parameters
colorpremultiplied; its alpha scales the coverage.