[SOLVED]Customizing vbox/hbox font...

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
UselessCoder
Regular
Posts: 96
Joined: Sun Jan 24, 2016 6:51 am
Projects: undisclosed...
Contact:

[SOLVED]Customizing vbox/hbox font...

#1 Post 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... :|
Last edited by UselessCoder on Mon Jul 18, 2016 9:17 am, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Customizing vbox/hbox font...

#2 Post by trooper6 »

here is the answer in the documentation:
https://www.renpy.org/doc/html/text.html#text-tag-font
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

UselessCoder
Regular
Posts: 96
Joined: Sun Jan 24, 2016 6:51 am
Projects: undisclosed...
Contact:

Re: Customizing vbox/hbox font...

#3 Post 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:

Code: Select all

font="fonts/blabla.ttf"
I know I'm approaching to this as if it was html, sorry... :lol:
Last edited by UselessCoder on Mon Jul 18, 2016 9:06 am, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Customizing vbox/hbox font...

#4 Post 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"
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

UselessCoder
Regular
Posts: 96
Joined: Sun Jan 24, 2016 6:51 am
Projects: undisclosed...
Contact:

Re: Customizing vbox/hbox font...

#5 Post 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...
Last edited by UselessCoder on Mon Jul 18, 2016 9:13 am, edited 2 times in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Customizing vbox/hbox font...

#6 Post by xavimat »

Delete the quotes:
{font=fonts/myfont.ttf}
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

UselessCoder
Regular
Posts: 96
Joined: Sun Jan 24, 2016 6:51 am
Projects: undisclosed...
Contact:

Re: Customizing vbox/hbox font...

#7 Post by UselessCoder »

xavimat wrote:Delete the quotes:
{font=fonts/myfont.ttf}
Omg, I thought I've tried that already! :(

it worked, thanks!

Post Reply

Who is online

Users browsing this forum: piinkpuddiin