Page 1 of 1
[SOLVED]Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 5:47 am
by UselessCoder
Ok, now this is so embarassing because I know it's a stupid question about an overly discussed issue, but still...
How do I change the font of a specific hbox/vbox:
Code: Select all
hbox:
spacing 10 xpos 1170 ypos 20
text "{color=#FFFFFF}{size=-3} Cr. [money]{/size}{/color}"
As of now, it of course takes the "default" font as specified in options.rpy.
I've tried to define a new "vbox_style"...style: nothing.
I've tried to style.say_vbox.font="font.ttf" but nothing: it says there is no say_vbox.
I've red the docs but either I've missed out something or I've tried customizations that had no effect at all.
Please point me in the right direction...
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 8:51 am
by trooper6
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 9:05 am
by UselessCoder
Thanks trooper... :facepalm:
The only thing is, it only works if I put the font into the main game folder, as it doesn't accept it in the format:
I know I'm approaching to this as if it was html, sorry...
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 9:06 am
by xavimat
Use style_group
You can't define the font of the boxes because the boxes are only containers, they dont have the font property.
With style_group you can define the font (and size, color, etc.) of the text elements contained inside a box.
If you have only one text element inside the box, dont need the style, apply the properties directly:
Code: Select all
text "bla bla" size 14 color "#f00" font "myfont.ttf"
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 9:08 am
by UselessCoder
xavimat wrote:
If you have only one text element inside the box, dont need the style, apply the properties directly:
Code: Select all
text "bla bla" size 14 color "#f00" font "myfont.ttf"
Yes that's what I meant and what I needed, sorry for not being more specific.
This works:
Code: Select all
hbox:
spacing 10 xpos 940 ypos 73
text "{font=font.ttf}{color=#FFFFFF}{size=-6} bla font {/size}{/color}{/font}"
...while this is not:
Code: Select all
hbox:
spacing 10 xpos 940 ypos 73
text "{font="fonts/font.ttf"}{color=#FFFFFF}{size=-6} bla font {/size}{/color}{/font}"
Chances are that I'm gonna use style_group, tho. There is more than one text line and I'd better apply some style at once...
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 9:11 am
by xavimat
Delete the quotes:
{font=fonts/myfont.ttf}
Re: Customizing vbox/hbox font...
Posted: Mon Jul 18, 2016 9:14 am
by UselessCoder
xavimat wrote:Delete the quotes:
{font=fonts/myfont.ttf}
Omg, I thought I've tried that already!
it worked, thanks!