Sidechair

box.set_text_font_family()

Browse the reference

Chooses a proportional or a monospace typeface for the text inside a box.

Try it in the editor

font.family_monospace gives every character the same width, so columns of numbers line up; font.family_default is the regular face.

Only the text of that box changes. Size and color are separate settings.

Syntax

Pine Script
box.set_text_font_family(id: series box, text_font_family: series string) -> void
box.set_text_font_family(text_font_family: series string) -> void

Arguments

NameTypeDefaultDescription
idseries boxrequiredThe box whose text typeface changes.
text_font_familyseries stringrequiredfont.family_default (default) or font.family_monospace, which gives every character the same width.

Returns

Nothing.

Remarks

  • On Sidechair: typefaces are not applied yet, so a call reports a warning and the text keeps the default face.

Example

Pine ScriptMonospace high and low readoutOpen in editor
//@version=6
indicator("box.set_text_font_family: aligned digits", overlay = true)
if barstate.islast
    z = box.new(bar_index - 10, high, bar_index, low, bgcolor = color.new(color.gray, 85), text = "H " + str.tostring(high, "#.00") + " L " + str.tostring(low, "#.00"), text_color = color.white)
    box.set_text_font_family(z, font.family_monospace)

See also

Not on Sidechair yet