Special text formatting/markup/bbcode

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Special text formatting/markup/bbcode

Post by Gunroar:Cannon() »

Is that what it's called?
Is there a way to make a special format option to change text colors (and fonts? Fints aren't that inportant) on the fly, in a function that overwrites love.graphics.print/printf?

Image
Yeah right!

https://kivy.org/doc/stable/api-kivy.co ... arkup.html
Last edited by Gunroar:Cannon() on Fri Jan 14, 2022 4:04 pm, edited 1 time in total.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

Re: Special text formatting/markup/bbcode

Post by Nikki »

in https://love2d.org/wiki/love.graphics.printf there are already options to change text colors within a single call

Code: Select all

 love.graphics.printf({{1,0,0},"red pill " , {0,0,1}, " blue pill"}, 25,25, 200)
there are more options to that call:

Code: Select all

limit, align, angle, sx, sy, ox, oy, kx, ky 
but they will be applied to all the text in the call

edit: seems https://love2d.org/wiki/Text:addf could be uses to add newly formatted text onto existing
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Re: Special text formatting/markup/bbcode

Post by Gunroar:Cannon() »

Oh, ok. Thank you. It's not as fancy as others but I guess it will do :)
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
Froyok
Prole
Posts: 27
Joined: Tue Nov 16, 2021 4:53 pm
Contact:

Re: Special text formatting/markup/bbcode

Post by Froyok »

Gunroar:Cannon() wrote: Fri Jan 14, 2022 12:43 pm Is that what it's called?
To answer you first question, in case you want to dive further into the subject, in UI terminology this is called "rich text".

Some examples:
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Re: Special text formatting/markup/bbcode

Post by Gunroar:Cannon() »

Ahhh, yes.
Image
*rich*

But, really, thanks. I should have pieced that together (from rich text editors, rich text files, etc.) :ultrahappy:
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests