dsb_textformat seems wierd?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

dsb_textformat seems wierd?

Post by kaypy »

The way this works seems wierd?

It looks like it has global effects, so if I ever use it for formatting my own text, then the main system UI goes wonky?

dsb_bitmap_textout is used all over the system UI, but dsb_textformat is only used in the default subrenderer, so everything in the system is relying on default values?

(current plan: back slowly away from the strange misbehaving system call and avoid making eye contact)
Friends don't let friends eat worm round
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_textformat seems wierd?

Post by Gambit37 »

I can't check any of my notes right now, but from memory, dsb-textformat is only used to format the text on the message area below the viewport.
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

Re: dsb_textformat seems wierd?

Post by kaypy »

Had another look around. What I had missed was that it only affects dsb_bitmap_textout with the MULTILINE flag set.

It still also breaks the main message area if you actually try to use it. But it wont affect most instances of dsb_bitmap_textout.

Oh, and if you try to use it to format the main message area on purpose, it will get reverted if the party ever looks at something with a long description field. (Or if you use it on a MULTILINE field as above)
Friends don't let friends eat worm round
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: dsb_textformat seems wierd?

Post by Sophia »

It isn't misbehaving; it is working as designed, but that design could use an update.

As you noted, dsb_textformat is used to set global formatting info for all further instances of MULTILINE text, and only those. The object renderer always reasserts its own settings, so you'll have to (and this was also by design) assert your own settings before you want to render something different.

Where you're running into trouble is that the console uses the line height given by the last instance of dsb_textformat as its own line height. This is perfectly fine if everything is using the FTL font and isn't doing anything too fancy, but it isn't very flexible.

For 0.82, I've added a property to gui_info.console (which didn't exist back when I wrote the text formatting code) to set the console's line height directly, so this weird side effect won't happen any more and you can use dsb_textformat without messing up the console.
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

Re: dsb_textformat seems wierd?

Post by kaypy »

Cool. Like I implied I wasn't planning on using it but it having that side effect was wierd and unsettling...
Friends don't let friends eat worm round
Post Reply