tinyimg 1.1.1
Lightweight image manipulation library for WebAssembly
Loading...
Searching...
No Matches
TinyTextStyle Struct Reference

How a run of text is set. More...

#include <text.h>

Public Attributes

float size
 Em size in pixels. Ignored by a bitmap face, which has one size.
float tracking
float line_height
float stroke
 Outline width in pixels, or zero for none.
float shadow_x
float shadow_y
float shadow_blur
 Shadow softness in pixels, or zero for a hard offset copy.
uint8_t kerning
uint8_t stroke_color [4]
 The outline's color, as many channels as the image has.
uint8_t shadow_color [4]
 The shadow's color, as many channels as the image has.

Detailed Description

How a run of text is set.

A zeroed structure is usable and means the same as passing NULL: the face's own em size, no tracking, single line spacing and no kerning. tiny_text_style fills one in with the defaults instead, which differ in one place – kerning on – and are what a caller should start from.

Member Data Documentation

◆ kerning

uint8_t TinyTextStyle::kerning

Non-zero to apply the face's kern pairs.

◆ line_height

float TinyTextStyle::line_height

Multiple of the face's own line height. Zero reads as one.

◆ shadow_blur

float TinyTextStyle::shadow_blur

Shadow softness in pixels, or zero for a hard offset copy.

Three box passes over the coverage, which is the usual approximation of a gaussian and is within a level of one at this radius.

◆ shadow_color

uint8_t TinyTextStyle::shadow_color[4]

The shadow's color, as many channels as the image has.

Read only when a shadow is asked for, which is any non-zero offset or blur. An alpha below 255 in the fourth channel is honored on an image that has alpha.

◆ shadow_x

float TinyTextStyle::shadow_x

Horizontal shadow offset in pixels. Negative is left.

◆ shadow_y

float TinyTextStyle::shadow_y

Vertical shadow offset in pixels. Negative is up.

◆ size

float TinyTextStyle::size

Em size in pixels. Ignored by a bitmap face, which has one size.

Zero means the face's own em, so a zeroed style draws. A negative size is a caller error and reports TINYIMG_ERR_RANGE.

◆ stroke

float TinyTextStyle::stroke

Outline width in pixels, or zero for none.

A dilation of the glyph's coverage rather than an offset of its outline, which is what makes it one pass over a small mask instead of a second rasterization. The difference shows at a sharp interior corner, where a true offset curve would extend the two edges to a point and this rounds it. At the one to four pixels an OG card uses it is not visible; at twenty it is.

Drawn under the fill for the whole run, so a stroke never prints over a neighboring glyph's fill.

◆ stroke_color

uint8_t TinyTextStyle::stroke_color[4]

The outline's color, as many channels as the image has.

Read only when stroke is above zero. A zeroed style therefore needs no color at all.

◆ tracking

float TinyTextStyle::tracking

Extra space between glyphs, in pixels. Negative tightens.


The documentation for this struct was generated from the following file: