Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::text Namespace Reference

Classes

struct  Glyph
class  BitmapFont

Functions

static std::string extractValue (const std::string &line, const std::string &key)
static i32 extractInt (const std::string &line, const std::string &key)
void sdfFromAlpha (const u8 *alpha, u8 *out, u32 width, u32 height, f32 spread)
 Signed distance field from an antialiased alpha coverage bitmap.
constexpr u32 nextCodepoint (const char *data, usize length, usize &pos)

Variables

constexpr u32 kReplacementCodepoint = 0xFFFD

Function Documentation

◆ extractInt()

i32 esengine::text::extractInt ( const std::string & line,
const std::string & key )
static

Definition at line 36 of file BitmapFont.cpp.

References extractValue().

◆ extractValue()

std::string esengine::text::extractValue ( const std::string & line,
const std::string & key )
static

Definition at line 12 of file BitmapFont.cpp.

Referenced by extractInt().

◆ nextCodepoint()

u32 esengine::text::nextCodepoint ( const char * data,
usize length,
usize & pos )
constexpr

◆ sdfFromAlpha()

void esengine::text::sdfFromAlpha ( const u8 * alpha,
u8 * out,
u32 width,
u32 height,
f32 spread )

Signed distance field from an antialiased alpha coverage bitmap.

Exact Felzenszwalb–Huttenlocher squared-distance transform with coverage-derived fractional seeds: partially covered texels place the edge at sub-texel accuracy, so magnified glyphs keep smooth edges instead of the source rasterization's pixel staircase.

Parameters
alphawidth*height coverage bytes (antialiased coverage is used, not thresholded).
outwidth*height output bytes. 128 encodes the edge; values above 128 are inside, below are outside. The mapping is linear with spread pixels spanning half the [0,255] range, matching what the SDF text shader expects.
spreaddistance in pixels mapped to half the byte range (the SDF "range"/padding). Larger = softer falloff / more outline room.

Definition at line 102 of file SdfGenerator.cpp.

Variable Documentation

◆ kReplacementCodepoint

u32 esengine::text::kReplacementCodepoint = 0xFFFD
inlineconstexpr

Definition at line 9 of file Utf8.hpp.

Referenced by nextCodepoint().