5 Struct SYNTAX_RUN
gullradriel edited this page 2026-10-09 00:55:18 +02:00

SYNTAX_RUN

draw a run of text and advance the pen x by its width. More...

Public Attributes

Name
float y
pen y, constant for the whole line
float x_min
left edge of the visible area
float x_max
right edge of the visible area
ALLEGRO_FONT * font
font every run of the line is drawn with
int done
1 once the pen passed x_max, so the tokenizer stops walking the line
float cx
pen x, advanced by the width of each run

Detailed Description

struct SYNTAX_RUN;

draw a run of text and advance the pen x by its width.

Runs longer than the stack buffer are drawn in successive chunks rather than cut short, which a whole-line mode (plain text, a diff line) would otherwise do to any long line. Chunks never split a UTF-8 sequence.

the horizontal window one syntax line is drawn into, plus the pen carried between its coloured runs. A run that ends left of x_min is measured but not drawn, and the run that takes the pen past x_max ends the line. Without that a single very long line costs one al_draw_text plus one uncached measurement per 511 bytes on every frame, nearly all of it off screen: measured on a 1 MB line, 151 ms per frame before, 0.5 ms after.

Public Attributes Documentation

variable y

float y;

pen y, constant for the whole line

variable x_min

float x_min;

left edge of the visible area

variable x_max

float x_max;

right edge of the visible area

variable font

ALLEGRO_FONT * font;

font every run of the line is drawn with

variable done

int done;

1 once the pen passed x_max, so the tokenizer stops walking the line

variable cx

float cx;

pen x, advanced by the width of each run