-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Font escape sequence for nametags #14968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@cx384 rebase needed |
Why creating another DSL? Could we use hypertext directly here? |
8d0045f
to
5a95b1b
Compare
rebased Hm, I haven't really considered it, since hypertext is currently only applicable for formspecs and the API still says that |
i concur that this should use hypertext |
I'm afraid I disagree, or at the very least I don't see strong reasons to use hypertext here. About the only "pro" is that we get to "reuse" a (somewhat intuitive) DSL. There are multiple "cons" however (I vaguely remember stating (some of?) these already somewhere, in that case let me reiterate):
What we want here is something that applies (or should eventually apply) to text rendering as universally as possible, as is the case for translations. I see little reason for this to be hypertext; in fact the Either way I think modders can definitely live with such font escape sequences. If you're not happy with it, it's easy to turn it into a DSL yourself, both via parsing and by just using Lua tables and syntactic sugar. Arguably, if this is to be about nametags specifically, it could be considered to use hypertext, including the layouting features and all other bells and whistles, making it more powerful for nametags specifically (e.g. allowing alignment of text) but less powerful in general since we can't just put hypertext rendering in everywhere we render text (or can we?). I have not yet looked into how feasible that is from a development standpoint. |
@cx384 rebase needed |
5a95b1b
to
6a1afc7
Compare
6a1afc7
to
bb71268
Compare
Goal of the PR
minetest.{bold|italic}(text:string):strrng
likeminetest.colorize()
for tooltips via node.description #14913 and similar.How does the PR work?
nametag_color
basically acts like as a prefixed color escape sequence.EnrichedString
like the colors, because internally the way how text is drawn is coupled very closely together with the used font (seeGUITTFont
orCGUITTFont
), so it makes no sense to draw it as a single string without completely changing what aGUITTFont
is and drawing it separately shouldn't make a big difference.StaticText
can't be reused for this feature, because it works with only one BrokenText per line.To do
This PR is Ready for Review.
How to test
testentities:nametag
,testentities:nametag_enriched_text
, andtestentities:nametag_ascii_art
.