2025-08-11 23:49 CEST

spring: develop 1d191877 Diff ] Back to Repository ]
Author Committer Branch Timestamp Parent
-jk- -jk- develop 2009-05-05 14:01:21 develop 411647d0
Changeset 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
add - rts/Lua/LuaFonts.cpp Diff ] File ]
add - rts/Lua/LuaFonts.h Diff ] File ]
mod - rts/Lua/LuaOpenGL.cpp Diff ] File ]