+ | hCenter : uint |
水平居中。 |
+ | hLeft : uint |
水平左对齐。 |
+ | hRight : uint |
水平右对齐。 |
+ | vBottom : uint |
垂直下对齐。 |
+ | vCenter : uint |
垂直居中。 |
+ | vTop : uint |
垂直上对齐。 |
+ | edgeColor : uint |
字体描边颜色
|
+ | glowColor : uint |
字体发光颜色
|
+ | lineSpace : uint |
行间距。
|
+ | offsetH : uint |
描边位置的的水平方向偏移,可造成字体阴影的效果。
|
+ | offsetV : uint |
描边位置的的垂直方向偏移,可造成字体阴影的效果。
|
+ | textColor : uint |
文本颜色
|
+ | blur : bool |
模糊效果。
|
+ | bold : bool |
加粗。
|
+ | edge : uint |
字体边缘大小。
|
+ | glow : uint |
发光值。
|
+ | height : uint |
字体高度。
|
+ | italic : bool |
斜体。
|
+ | resname : string |
资源文件名。
|
+ | sharpen : bool |
锐化效果。
|
+ | size : uint |
字号。
|
+ | strikeout : bool |
删除线。
|
+ | underline : bool |
下划线。
|
+ | function _Font.new(fontName : string, size : uint[, glow : uint][, edge : uint][, bold : bool][, italic : bool][, underline : bool][, strikeout : bool][, sharpen : bool][, blur : bool]) |
构造一种字体。
|
依照参数中的字体创建一个新的字体。
|
+ | function cutLines(text : string, maxlength : uint, leadspace : uint) : string [] |
在当前字体,指定行宽下,将字符串按自动换行方式,分割为多行。
|
+ | function draw3DText(x : number, y : number, z : float, s : number, text : string) |
在3d世界中渲染字符串。
|
+ | function drawText(l : int, t : int, r : int, b: int, text : string[, align : uint]) |
渲染字符串。 |
+ | function stringHeight(text : string) : int |
获取字符串的高度。
|
+ | function stringSize(text : string) : Point |
获取字符串的宽度和高度。
|
+ | function stringWidth(text : string) : int |
获取字符串的宽度。
|
str = 'hello fancyguo 你好'size = 19glow = 0edge = 0alpha = 0xfffont = _Font.new('ARIAL', size, glow, edge)textcolor,growcolor,edgecolor = _Color.White,_Color.Red,_Color.Orangefunction newfont() font = _Font.new('ARIAL', size, glow, edge) font.textColor = textcolor font.growColor = growcolor font.edgeColor = edgecolorendfunction newcolor() textcolor = _or(_and(0x00ffffff, textcolor), _and(0xff000000, alpha* 0x1000000)) edgeColor = _or(_and(0x00ffffff, edgeColor), _and(0xff000000, alpha* 0x1000000)) font.textColor = textcolor font.edgeColor = edgecolorendnewfont()_app:onKeyDown(function(key) if key == _System.KeyQ then if(size < 50) then size = size + 1 newfont() end elseif key == _System.KeyA then if(size > 2) then size = size - 1 newfont() end elseif key == _System.KeyW then if(glow < 5) then glow = glow + 1 newfont() end elseif key == _System.KeyS then if(glow > 0) then glow = glow - 1 newfont() end elseif key == _System.KeyE then if(edge < 5) then edge = edge + 1 newfont() end elseif key == _System.KeyD then if(edge > 0) then edge = edge - 1 newfont() end elseif key == _System.KeyR then if(alpha < 255) then alpha = alpha + 5 newcolor() end elseif key == _System.KeyF then if(alpha > 0) then alpha = alpha - 5 newcolor() end endend)noticefont = _Font.new('Arial', 10)noticefont.textColor = _Color.Yellow_app:onIdle(function(e) noticefont:drawText(0, 0, 'Press QA to adjust size') noticefont:drawText(0, 14, 'Press WS to adjust glow') noticefont:drawText(0, 28, 'Press ED to adjust edge') noticefont:drawText(0, 42, 'Press RF to adjust alpha') _rd:drawRect(_rd.w / 2 - 350, _rd.h / 2 - 150, _rd.w / 2, _rd.h / 2, 0xffffffff) font:drawText(_rd.w / 2 - 350, _rd.h / 2 - 150, _rd.w / 2, _rd.h / 2, str, _Font.hCenter + _Font.vCenter)end)