Text in one of a game's fonts, laid out as GameMaker's draw_text lays it out, as
draw list items naming {:glyph, font, character} pictures
(Cauldron2D.GameMaker.Pictures.table/2).
items = Cauldron2D.GameMaker.Text.items(data, "fMenu", "PRESS START", {160, 150},
halign: :center, colour: {255, 255, 255})A # or a newline starts a new line, as in GameMaker Studio 1; \# is a #; a
carriage return is dropped. Lines are as tall as the font's tallest glyph unless
:separation says otherwise. Each glyph is drawn offset pixels right of
the pen, which then moves by its advance and any kerning with the next character. A
character the font lacks advances the pen by the width of its space and draws nothing.
Options:
:halign—:left(the default),:centeror:rightofx, line by line:valign—:top(the default),:middleor:bottomofy, for the whole block:colour—{r, g, b}blended into every glyph; white by default:alpha—0.0–1.0:mode— the blend mode, as a draw list item takes it:depth— the items' depth:scale—{x, y}, multiplying every distance and glyph:angle— degrees anticlockwise the whole block turns about{x, y}, asdraw_text_transformedturns it:wrap— a width in pixels: a line wider breaks between words to fit it, asdraw_text_extdoes; a word wider on its own keeps a line to itself:separation— the distance in pixels from one line's top to the next's
width/4 and height/4 take the same options and measure what items/5 draws.
Summary
Functions
The height in pixels of string in font, unscaled: its line count times the line separation.
The draw items of string in font (a name or an index) at {x, y}.
The width in pixels of the widest line of string in font, unscaled.
Types
@type font() :: String.t() | non_neg_integer()
Functions
@spec height(Cauldron2D.GameMaker.Data.t(), font(), String.t(), keyword()) :: number()
The height in pixels of string in font, unscaled: its line count times the line separation.
@spec items( Cauldron2D.GameMaker.Data.t(), font(), String.t(), {number(), number()}, keyword() ) :: [ map() ]
The draw items of string in font (a name or an index) at {x, y}.
@spec width(Cauldron2D.GameMaker.Data.t(), font(), String.t(), keyword()) :: number()
The width in pixels of the widest line of string in font, unscaled.