SetFontSize in listalias

Forgewright
10 Apr 2020, 16:24

object.listalias = object.listalias + "(SetFontSize(10)(equipped))"
Curious as to the correct coding here. I need the (equipped) to be smaller to fit in the pane.
I could put it in the line before it but then the object would be small too.

then need to return the font to normal (14)


mrangel
10 Apr 2020, 17:23

SetFontSize only changes the font size of any future lines output by msg. It doesn't affect text outside of the main output.

If you want to format text in the listalias, you can use text processor commands; but there isn't one for font size. So the easiest way is to use HTML.

I think you want:

object.listalias = object.listalias + "<small>(equipped)</small>"

You could also do:

object.listalias = object.listalias + "<span style=\"font-size: 10pt\">(equipped)</span>"

but you don't know the user's display resolution or size. Using measurements like mm, in, or cm means that text that's a sensible size for someone playing on phone would be unreadably small on a large monitor. On the other hand, using pixel measurements (px) will make your text smaller on a higher resolution display. It's usually recommended to use percentages; 85% would make the text smaller than the rest of the line, but not by much.

If you want your game to be playable on different devices and different screen sizes (especially if you want it to work for people with impaired vision, who might have turned up the default font size on their computer), it's better to stick to percentages.

(I am aware that Quest itself is badly designed for accessibility; but still better to develop good habits so that your game doesn't suddenly become ugly if this is ever fixed)


Forgewright
10 Apr 2020, 17:58

Thanks, Mrangel. I have already decided to let people know in the heading of the game description on this site to only play on a desktop computer or lap-top as playing on the phone is to typing intensive and the graphics will be distorted.


Forgewright
11 Apr 2020, 11:31

FYI
Tried:
object.listalias = object.listalias + "<span style="font-size: 10pt">(equipped)</span>"
threw an error: unexpected token 'font' expected end of line


Dcoder
11 Apr 2020, 12:48

Maybe this:

object.listalias = object.listalias + "<span style=\"font-size:10px\">(equipped)</span>"