Text font_size property¶
This page explains the text-related font_size
property.
What property is this?¶
The font_size
property updates or gets the instance’s font size (text size).
Basic usage¶
The getter and setter interfaces’ type becomes an ap.Int
value.
import apysc as ap
stage: ap.Stage = ap.Stage(
background_color=ap.Color("#333"),
stage_width=350,
stage_height=400,
stage_elem_id="stage",
)
font_size_16_text: ap.MultiLineText = ap.MultiLineText(
text="Example of font-size = 16. Lorem ipsum dolor sit amet, "
"consectetur adipiscing elit, sed do eiusmod tempor incididunt "
"ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
width=300,
fill_color=ap.Color("#00aaff"),
x=25,
y=25,
)
font_size_16_text.font_size = ap.Int(16)
font_size_32_text: ap.MultiLineText = ap.MultiLineText(
text="Example of font-size = 32. Lorem ipsum dolor sit amet, consectetur.",
width=300,
fill_color=ap.Color("#00aaff"),
x=25,
y=190,
)
font_size_32_text.font_size = ap.Int(32)
ap.save_overall_html(dest_dir_path="./text_font_size_basic_usage/")
font_size property API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface summary]
Get a text’s font size.
[Returns]
font_size
: IntA text font size.
[Examples]
>>> import apysc as ap
>>> stage: ap.Stage = ap.Stage(
... background_color=ap.Color("#333"),
... stage_width=350,
... stage_height=250,
... stage_elem_id="stage",
... )
>>> text: ap.MultiLineText = ap.MultiLineText(
... text="Example of font-size = 32. Lorem ipsum dolor sit amet, "
... "consectetur adipiscing elit, sed do eiusmod tempor incididunt.",
... width=300,
... fill_color=ap.Color("#00aaff"),
... x=25,
... y=25,
... )
>>> text.font_size = ap.Int(32)
>>> text.font_size
Int(32)