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

The BMP part of unicode block table and the blocks of a font. More...

#include <stdint.h>
#include "font.h"

Go to the source code of this file.

Data Structures

struct  gpf_ucode_block
 A unicode block description. More...

Functions

const char * gpf_ucode_block_sample (const char *name)
 Looks up the preview sample text for a unicode block.
struct gpf_ucode_block * gpf_blocks_build (struct gpf_font *font)
 Builds a list of blocks for a font.
int gpf_blocks_find (const struct gpf_ucode_block *blocks, uint32_t code)
 Looks up a block by a codepoint.
static uint32_t gpf_block_glyphs (const struct gpf_ucode_block *block)
 Counts number of codepoints in a unicode block.

Variables

const struct gpf_ucode_block gpf_ucode_blocks []
 A NULL name terminated array of unicode blocks.

Detailed Description

The BMP part of unicode block table and the blocks of a font.

The global table lists every unicode block, a font's block list is made of copies of its entries with the coverage filled in.

Definition in file unicode_blocks.h.

Function Documentation

◆ gpf_block_glyphs()

uint32_t gpf_block_glyphs ( const struct gpf_ucode_block * block)
inlinestatic

Counts number of codepoints in a unicode block.

Parameters
blockA unicode block.
Returns
A number of codepoints in a unicode block.

Definition at line 78 of file unicode_blocks.h.

◆ gpf_blocks_build()

struct gpf_ucode_block * gpf_blocks_build ( struct gpf_font * font)

Builds a list of blocks for a font.

The blocks the font has glyphs in, the ones declared in the font family and Basic Latin when that leaves the list empty.

Parameters
fontA font.
Returns
A gp_vec of gpf_ucode_block structures sorted by codepoints.

Definition at line 277 of file unicode_blocks.c.

References gpf_ucode_block::max, and gpf_ucode_block::min.

Referenced by gpf_gui_blocks().

◆ gpf_blocks_find()

int gpf_blocks_find ( const struct gpf_ucode_block * blocks,
uint32_t code )

Looks up a block by a codepoint.

Parameters
blocksA gp_vec of unicode blocks.
codeA codepoint to lookup a block for.
Returns
An index into the list, or -1 when the codepoint is in none of its blocks.

Definition at line 326 of file unicode_blocks.c.

References gpf_ucode_block::max, and gpf_ucode_block::min.

◆ gpf_ucode_block_sample()

const char * gpf_ucode_block_sample ( const char * name)

Looks up the preview sample text for a unicode block.

Parameters
nameA unicode block name, as in gpf_ucode_blocks.
Returns
A sample text in UTF-8, or NULL for a block we have no sample for, which the preview fills with the font's own glyphs instead.

Definition at line 265 of file unicode_blocks.c.