Procedurally change drag:body font family for localization

Discussion of features and help with problems encountered while using libRocket

Procedurally change drag:body font family for localization

Postby pixelblender on Wed Jul 08, 2015 12:03 am

Hi,

First of all thank you so much for this great library. I'm liking it a lot.

What I'm trying to do is to have one layout design (rml+rcss) and change the font-family property depends on the active language. I couldn't make it work with the drag example. The main issue is the ad-hoc element icon:drag body. How do I change its font-family procedurally?

I can change the font-family for all items in inventory 1 during their creation but the "drag: clone" instantiates an ad-hoc element which I don't know how to change it's property. Whenever an item got dragged from its inventory the "clone" is missing its font-family.

or maybe is there a better way to deal with changing localization during runtime?

Any help would be much appreciated :)
pixelblender
 
Posts: 2
Joined: Thu Apr 30, 2015 1:10 pm

Re: Procedurally change drag:body font family for localizati

Postby wheybags on Wed Jul 08, 2015 11:03 pm

Why do you need to change font?
Can you not find a font with all the required symbols?
Also, if using the python extension, you could have a style tag, and just do tag.inner_rml = "body{ font-family: blah; }"
You could probably do that from c++ as well, but I've never tried to manipulate the dom from there so I'm not sure how.
wheybags
Rocket Engineer
Rocket Engineer
 
Posts: 13
Joined: Fri Jun 13, 2014 10:16 am

Re: Procedurally change drag:body font family for localizati

Postby pixelblender on Wed Jul 08, 2015 11:23 pm

Hi wheybags,

Consider these following scenario using drag example:
The app language is set to "english" and I have an Inventory window with the title "Inventory". During runtime the user can switch to other languages and instead of recreating the Inventory window (say, tear down and load different "inventory_japanese.rml") what I would like to do is simply set the title's innerRML and set it's font-family to different font and different charset (and tell FontDatabase to load the proper .otf).

It works on the inventory but not on the cloned icon element.

To my understanding based on digging libRocket for the past couple days I've found it it's not possible since the ad-hoc element "icon:drag:body" is generated on-the fly and it's font-family has to be defined in the RCSS?

I'm using librocket as C++ lib and not python. Is there a way to set font-family to ad-hoc element icon:drag:body during runtime using C++?

Thank you for your reply :)
pixelblender
 
Posts: 2
Joined: Thu Apr 30, 2015 1:10 pm


Return to Using libRocket