FontHandler
Moderator: Moderators
FontHandler
1. Could fontTexture tool be made available somewhere around here? I am sorry in advance if it's here already, I can't seem to find it atm, and was looking at making a few custom fonts for UI stuff.
2. Could Spring just load up and auto-create font-sets for new fonts in a game's /fonts directory?
3. The behavior of this area of Spring has changed since 0.79.2, and the :n: parameter is now required.
That breaks a lot of UI mods, better let people know about it on release, if not before (i.e., I just found this while testing, fixed it, and there we are).
2. Could Spring just load up and auto-create font-sets for new fonts in a game's /fonts directory?
3. The behavior of this area of Spring has changed since 0.79.2, and the :n: parameter is now required.
That breaks a lot of UI mods, better let people know about it on release, if not before (i.e., I just found this while testing, fixed it, and there we are).
Re: FontHandler
1. lua fontsystem is deprecated, don't use it
2+3. the commit messages comprehensively explain everything, read them (fonthandler update were 2-4 commits)
(and when you are doing so you could write an extensive changelog for 77->79
)
2+3. the commit messages comprehensively explain everything, read them (fonthandler update were 2-4 commits)
(and when you are doing so you could write an extensive changelog for 77->79

Re: FontHandler
I'm saying that between 0.79.2 and where we are now, something's gotten changed that broke the previous behavior, is all.
As for no. 1... so what is the favored path for using new fonts from here on out? All I wanted to know was how to use new TTF fonts for certain things...
As for no. 1... so what is the favored path for using new fonts from here on out? All I wanted to know was how to use new TTF fonts for certain things...
Re: FontHandler
nothing has changed. the 'n' param isn't even processed at all since 79.Argh wrote:I'm saying that between 0.79.2 and where we are now, something's gotten changed that broke the previous behavior, is all.
read the commit messagesArgh wrote:As for no. 1... so what is the favored path for using new fonts from here on out? All I wanted to know was how to use new TTF fonts for certain things...
Re: FontHandler
If somebody would explain to me how I'm supposed to view them, when the RSS feed from Git only shows the last few entries, I'll do that. I've been going here:
http://github.com/feeds/spring/commits/spring/master
And I'd really like to see a blow-by-blow that I can go back through, like I could with WebSVN, but I haven't had time to figure out how to get that overview again... this situation makes it really hard to follow what's going on, let alone document anything
http://github.com/feeds/spring/commits/spring/master
And I'd really like to see a blow-by-blow that I can go back through, like I could with WebSVN, but I haven't had time to figure out how to get that overview again... this situation makes it really hard to follow what's going on, let alone document anything

Re: FontHandler
github doesn't have a nice in commit search afaik (like websvn).
So you need to get git itself and download the repro, so you can use gitk. (there is a thread about using git with spring here on the forum)
So you need to get git itself and download the repro, so you can use gitk. (there is a thread about using git with spring here on the forum)
Re: FontHandler
So, in order to go back and see what you're referring to, I have to use Git?
That's... rather lame
Why can't the RSS feed simply be configured to allow us to view previous entries on GitHub?
That's... rather lame

Re: FontHandler
seems you can just look at commits individually
http://github.com/spring/spring/commits/master
http://github.com/spring/spring/commits/master
Re: FontHandler
That'll work. Certainly better than what I was using before. I don't mind having to wade through commits, I just couldn't find a blow-by-blow that would allow me to walk back through time.
So... jK... when did you do this, approximately?
So... jK... when did you do this, approximately?
Re: FontHandler
check history of the files? http://github.com/spring/spring/tree/master
PS: one of the files is LuaOpengl.cpp
PS: one of the files is LuaOpengl.cpp
Re: FontHandler
he said 2-4 months ago.
i think he means commit 1d191877b614c730c990a50d173e456e5e925d2c
i still recommend using gitk, all you need is initial git setup, and then git pull && gitk every time you want to check something.
i think he means commit 1d191877b614c730c990a50d173e456e5e925d2c
i still recommend using gitk, all you need is initial git setup, and then git pull && gitk every time you want to check something.
Re: FontHandler
OK... so... this is the documentation:
If we're supposed to use that instead of fontHandler, do we still have to use the bzFlag font tool? And if so, does anybody know where it can be found atm, or am I going to have to look at bzFlag's source?
And if not... is there a working example of this in CA atm? Or is nobody using this at all yet?
That doesn't really answer my questions, though.lua interface for the new FontSystem:
gl.LoadFont( fontfile , size = 14, outlinewidth = 2, outlineweight = 15) ->
lua_font
gl.DeleteFont( lua_font )
lua_font userdata object:
font:Begin() -> nil
font:End() -> nil
font:Print( text, x, y, size, options ) -> nil
options is a string which can contain a combination of:
'c' := horizontal centered
'r' := right aligned
't' := top ..
'v' := vertical centered
'b' := bottom
'a' := ascender
's' := shadowed
'o'|'O' := outlined
font:WrapText( text, maxWidth, [maxHeight, [size]]) -> string wrappedText,
number lines
font:GetTextWidth( text ) -> norm_width
font:GetTextHeight( text ) -> height, descender
font:SetTextColor({r,g,b[,a]} || r,g,b[,a]) -> nil
font:SetOutlineColor({r,g,b[,a]} || r,g,b[,a]) -> nil
font:SetAutoOutlineColor( bool enable ) -> nil
By default the renderer auto adjust the outline color to the textColor,
but sometimes this is unwanted for inlined colorcodes,
so you can turn it off here.
font:BindTexture() -> nil
read-only properties:
font.size
font.height || font.lineheight
font.descender
font.outlinewidth
font.outlineweight
font.path
font.family
font.style
font.texturewidth
font.textureheight
If we're supposed to use that instead of fontHandler, do we still have to use the bzFlag font tool? And if so, does anybody know where it can be found atm, or am I going to have to look at bzFlag's source?
And if not... is there a working example of this in CA atm? Or is nobody using this at all yet?
Re: FontHandler
fontfile := ttf,otf,... files
and no nothing is using it yet, but it's tested.
and no nothing is using it yet, but it's tested.
Re: FontHandler
OK... so basically we just load up a TTF, and it's now a named font object?
So...
local myNiftyFont = gl.LoadFont(myNifty.TTF,size = 14, outlinewidth = 2, outlineweight = 15)
Then...
myNiftyFont:Print(parameters)?
Sorry, but it's not entirely clear to me what the use case is based on what I'm reading. If it's that easy, that would be super-cool- it'd get rid of the need for gl.Text entirely...
So...
local myNiftyFont = gl.LoadFont(myNifty.TTF,size = 14, outlinewidth = 2, outlineweight = 15)
Then...
myNiftyFont:Print(parameters)?
Sorry, but it's not entirely clear to me what the use case is based on what I'm reading. If it's that easy, that would be super-cool- it'd get rid of the need for gl.Text entirely...
Re: FontHandler
o_O
1. fontfile is a string (thought this is obvious, and yeah it checks the vfs, too)
2. "size = 14" means there is a number param which defines the wanted size and its default is 14
1. fontfile is a string (thought this is obvious, and yeah it checks the vfs, too)
2. "size = 14" means there is a number param which defines the wanted size and its default is 14
Re: FontHandler
So this is correct?
local myNiftyFont = gl.LoadFont("fonts/myNifty.TTF",size = 14, outlinewidth = 2, outlineweight = 15)
Sorry, it's late and I'm tired. If that's all there is to it, I'll have P.U.R.E. retrofitted this afternoon, after I get some sleep, and give out some working source using it, so that it won't be sitting around any more.
local myNiftyFont = gl.LoadFont("fonts/myNifty.TTF",size = 14, outlinewidth = 2, outlineweight = 15)
Sorry, it's late and I'm tired. If that's all there is to it, I'll have P.U.R.E. retrofitted this afternoon, after I get some sleep, and give out some working source using it, so that it won't be sitting around any more.
Re: FontHandler
you should have worked with lua long enough to see that your code isn't valid at all ...
to speed it up:
local myNiftyFont = gl.LoadFont("fonts/myNifty.TTF")
local myNiftyFont2 = gl.LoadFont("fonts/myNifty.TTF", 20) --glyphtexture is rendered with a fontsize of 20 (you can always use a different size with :Print(), but it would get interpolated)
local myNiftyFont3 = gl.LoadFont("fonts/myNifty.TTF", 10, 10, 10) --huge outline :x
to speed it up:
local myNiftyFont = gl.LoadFont("fonts/myNifty.TTF")
local myNiftyFont2 = gl.LoadFont("fonts/myNifty.TTF", 20) --glyphtexture is rendered with a fontsize of 20 (you can always use a different size with :Print(), but it would get interpolated)
local myNiftyFont3 = gl.LoadFont("fonts/myNifty.TTF", 10, 10, 10) --huge outline :x
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: FontHandler
What do font:Begin and font:End do?
Re: FontHandler
it saves unneeded opengl state changes, try always to collect as many as possible of your text printings between such 'begin .. end's
Re: FontHandler
Tested this. It's not exactly working right yet.
First test resulted in a crash upon initialization.
Second test resulted in the fonts loading, but it flickered on and off.
Third test resulted in a crash upon initialization.
Infolog attached.
Also... looking at it... how are we supposed to have different colors / properties for text in the same string?
That's one thing that fontHandler does that's pretty useful, and frankly I don't think this is an improvement unless it's there. Maybe a special character or characters that allow for new colors / options, so that long strings can be something like this:
myVal1#${1.0,1.0,0.5,0.5}..myVal2#${0.0,1.0,1.0,1.0}
That would be nifty, because it'd be a lot simpler to use. I'd happily get rid of every use of gl.Text and fontHandler in a heartbeat, if it worked that way.
First test resulted in a crash upon initialization.
Second test resulted in the fonts loading, but it flickered on and off.
Third test resulted in a crash upon initialization.
Infolog attached.
Also... looking at it... how are we supposed to have different colors / properties for text in the same string?
That's one thing that fontHandler does that's pretty useful, and frankly I don't think this is an improvement unless it's there. Maybe a special character or characters that allow for new colors / options, so that long strings can be something like this:
myVal1#${1.0,1.0,0.5,0.5}..myVal2#${0.0,1.0,1.0,1.0}
That would be nifty, because it'd be a lot simpler to use. I'd happily get rid of every use of gl.Text and fontHandler in a heartbeat, if it worked that way.
- Attachments
-
- infolog.txt
- (28.81 KiB) Downloaded 182 times
Last edited by Argh on 26 Jul 2009, 06:37, edited 1 time in total.