Skip to content

Commit 063662c

Browse files
committed
Added support for a default size setting
Fixes #61
1 parent 2dfd0ae commit 063662c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ The `settings` table can contain the following values:
157157

158158
* `width` (number) - Maximum width of a line of text. Omit this value to present the entire text on a single line
159159
* `position` (vector3) - The position that the text aligns to (refer to the `align` setting for details). Defaults to 0,0 if not specified.
160+
* `size` (number) - Default size of any created node. Same as using a `<size=2>` tag in the text. Defaults to 1 if not specified.
160161
* `parent` (node) - GUI nodes will be attached to this node if specified.
161162
* `fonts` (table) - Table with fonts, keyed on font name. See separate section below. If no `fonts` table is provided the font used will be the one passed to `richtext.create()`.
162163
* `layers` (table) - Table with font, texture and spine scene mappings to layer names. See separate section below.

richtext/richtext.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ function M.create(text, font, settings)
331331
settings = settings or {}
332332
settings.align = settings.align or M.ALIGN_LEFT
333333
settings.valign = settings.valign or M.VALIGN_TOP
334+
settings.size = settings.size or 1
334335
settings.fonts = settings.fonts or {}
335336
settings.fonts[font] = settings.fonts[font] or { regular = hash(font) }
336337
settings.layers = settings.layers or {}
@@ -369,7 +370,7 @@ function M.create(text, font, settings)
369370
shadow = settings.shadow,
370371
outline = settings.outline,
371372
font = font,
372-
size = 1
373+
size = settings.size
373374
}
374375
local words = parser.parse(text, word_settings)
375376
local text_metrics = {

0 commit comments

Comments
 (0)