Sidechair

label.set_text_font_family()

Browse the reference

Chooses a proportional or a monospace typeface for a label's text.

Try it in the editor

font.family_monospace gives every character the same width, which keeps digits in columns when the label holds several lines of numbers. font.family_default is the ordinary proportional face.

Only the typeface of that label changes; size and color stay as set. Other labels keep their own family.

Syntax

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

Arguments

NameTypeDefaultDescription
idseries labelrequiredThe label whose typeface changes. Its size, color and words are unchanged.
text_font_familyseries stringrequiredfont.family_default for the ordinary face or font.family_monospace for equal-width characters, which suits columns of numbers.

Returns

Nothing.

Remarks

  • On Sidechair: the font family is not applied yet. The call warns that it isn't supported, the label keeps its font, and the rest of the script runs.

Example

Pine ScriptMonospaced price and volume rowsOpen in editor
//@version=6
indicator("label.set_text_font_family: monospace", overlay = true)
var label l = label.new(bar_index, high, "123.45")
label.set_xy(l, bar_index, high)
label.set_text(l, "px  " + str.tostring(close, "#.00") + "\nvol " + str.tostring(volume, "#"))
label.set_text_font_family(l, font.family_monospace)

See also

Not on Sidechair yet