diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/renderer.lua | 57 | ||||
| -rw-r--r-- | docs/api/utf8extra.lua (renamed from docs/api/utf8.lua) | 46 |
2 files changed, 42 insertions, 61 deletions
diff --git a/docs/api/renderer.lua b/docs/api/renderer.lua index 7a9b636d..8738a7c1 100644 --- a/docs/api/renderer.lua +++ b/docs/api/renderer.lua @@ -6,7 +6,9 @@ renderer = {} --- ----Represents a color used by the rendering functions. +---Array of bytes that represents a color used by the rendering functions. +---Note: indexes for rgba are numerical 1 = r, 2 = g, 3 = b, 4 = a but for +---documentation purposes the letters r, g, b, a were used. ---@class renderer.color ---@field public r number Red ---@field public g number Green @@ -17,7 +19,7 @@ renderer.color = {} --- ---Represent options that affect a font's rendering. ---@class renderer.fontoptions ----@field public antialiasing "'grayscale'" | "'subpixel'" +---@field public antialiasing "'none'" | "'grayscale'" | "'subpixel'" ---@field public hinting "'slight'" | "'none'" | '"full"' -- @field public bold boolean -- @field public italic boolean @@ -39,6 +41,16 @@ renderer.font = {} function renderer.font.load(path, size, options) end --- +---Combines an array of fonts into a single one for broader charset support, +---the order of the list determines the fonts precedence when retrieving +---a symbol from it. +--- +---@param fonts renderer.font[] +--- +---@return renderer.font +function renderer.font.group(fonts) end + +--- ---Clones a font object into a new one. --- ---@param size? number Optional new size for cloned font. @@ -81,25 +93,6 @@ function renderer.font:get_size() end function renderer.font:set_size(size) end --- ----Assistive functionality to replace characters in a ----rendered text with other characters. ----@class renderer.replacements -renderer.replacements = {} - ---- ----Create a new character replacements object. ---- ----@return renderer.replacements -function renderer.replacements.new() end - ---- ----Add to internal map a character to character replacement. ---- ----@param original_char string Should be a single character like '\t' ----@param replacement_char string Should be a single character like 'ยป' -function renderer.replacements:add(original_char, replacement_char) end - ---- ---Toggles drawing debugging rectangles on the currently rendered sections ---of the window to help troubleshoot the renderer. --- @@ -141,29 +134,13 @@ function renderer.set_clip_rect(x, y, width, height) end function renderer.draw_rect(x, y, width, height, color) end --- ----Draw text. ---- ----@param font renderer.font ----@param text string ----@param x number ----@param y number ----@param color renderer.color ----@param replace renderer.replacements ----@param color_replace renderer.color ---- ----@return number x_subpixel -function renderer.draw_text(font, text, x, y, color, replace, color_replace) end - ---- ----Draw text at subpixel level. +---Draw text and return the x coordinate where the text finished drawing. --- ---@param font renderer.font ---@param text string ---@param x number ---@param y number ---@param color renderer.color ----@param replace renderer.replacements ----@param color_replace renderer.color --- ----@return number x_subpixel -function renderer.draw_text_subpixel(font, text, x, y, color, replace, color_replace) end +---@return number x +function renderer.draw_text(font, text, x, y, color) end diff --git a/docs/api/utf8.lua b/docs/api/utf8extra.lua index d4dff5a9..1ff4dcb6 100644 --- a/docs/api/utf8.lua +++ b/docs/api/utf8extra.lua @@ -1,19 +1,23 @@ ---@meta +---Additional utf8 support not provided by lua. +---@class utf8extra +utf8extra = {} + ---UTF-8 equivalent of string.byte ---@param s string ---@param i? integer ---@param j? integer ---@return integer ---@return ... -function utf8.byte(s, i, j) end +function utf8extra.byte(s, i, j) end ---UTF-8 equivalent of string.char ---@param byte integer ---@param ... integer ---@return string ---@return ... -function utf8.char(byte, ...) end +function utf8extra.char(byte, ...) end ---UTF-8 equivalent of string.find ---@param s string @@ -23,14 +27,14 @@ function utf8.char(byte, ...) end ---@return integer start ---@return integer end ---@return ... captured -function utf8.find(s, pattern, init, plain) end +function utf8extra.find(s, pattern, init, plain) end ---UTF-8 equivalent of string.gmatch ---@param s string ---@param pattern string ---@param init? integer ---@return fun():string, ... -function utf8.gmatch(s, pattern, init) end +function utf8extra.gmatch(s, pattern, init) end ---UTF-8 equivalent of string.gsub ---@param s string @@ -39,41 +43,41 @@ function utf8.gmatch(s, pattern, init) end ---@param n integer ---@return string ---@return integer count -function utf8.gsub(s, pattern, repl, n) end +function utf8extra.gsub(s, pattern, repl, n) end ---UTF-8 equivalent of string.len ---@param s string ---@return integer -function utf8.len(s) end +function utf8extra.len(s) end ---UTF-8 equivalent of string.lower ---@param s string ---@return string -function utf8.lower(s) end +function utf8extra.lower(s) end ---UTF-8 equivalent of string.match ---@param s string ---@param pattern string ---@param init? integer ---@return string | number captured -function utf8.match(s, pattern, init) end +function utf8extra.match(s, pattern, init) end ---UTF-8 equivalent of string.reverse ---@param s string ---@return string -function utf8.reverse(s) end +function utf8extra.reverse(s) end ---UTF-8 equivalent of string.sub ---@param s string ---@param i integer ---@param j? integer ---@return string -function utf8.sub(s, i, j) end +function utf8extra.sub(s, i, j) end ---UTF-8 equivalent of string.upper ---@param s string ---@return string -function utf8.upper(s) end +function utf8extra.upper(s) end ---Escape a str to UTF-8 format string. It support several escape format: ---* %ddd - which ddd is a decimal number at any length: change Unicode code point to UTF-8 format. @@ -91,7 +95,7 @@ function utf8.upper(s) end ---``` ---@param s string ---@return string utf8_string -function utf8.escape(s) end +function utf8extra.escape(s) end ---Convert UTF-8 position to byte offset. if only index is given, return byte ---offset of this UTF-8 char index. if both charpos and index is given, a new @@ -103,7 +107,7 @@ function utf8.escape(s) end ---@param index? integer ---@return integer charpos ---@return integer codepoint -function utf8.charpos(s, charpos, index) end +function utf8extra.charpos(s, charpos, index) end ---Iterate though the UTF-8 string s. If only s is given, it can used as a iterator: ---```lua @@ -120,7 +124,7 @@ function utf8.charpos(s, charpos, index) end ---@param index? integer ---@return integer charpos ---@return integer codepoint -function utf8.next(s, charpos, index) end +function utf8extra.next(s, charpos, index) end ---Insert a substring to s. If idx is given, insert substring before char at ---this index, otherwise substring will concat to s. idx can be negative. @@ -128,7 +132,7 @@ function utf8.next(s, charpos, index) end ---@param idx? integer ---@param substring string ---return string new_string -function utf8.insert(s, idx, substring) end +function utf8extra.insert(s, idx, substring) end ---Delete a substring in s. If neither start nor stop is given, delete the last ---UTF-8 char in s, otherwise delete char from start to end of s. if stop is @@ -138,7 +142,7 @@ function utf8.insert(s, idx, substring) end ---@param start? integer ---@param stop? integer ---return string new_string -function utf8.remove(s, start, stop) end +function utf8extra.remove(s, start, stop) end ---Calculate the width of UTF-8 string s. if ambi_is_double is given, the ---ambiguous width character's width is 2, otherwise it's 1. fullwidth/doublewidth @@ -150,7 +154,7 @@ function utf8.remove(s, start, stop) end ---@param ambi_is_double? boolean ---@param default_width? integer ---@return integer width -function utf8.width(s, ambi_is_double, default_width) end +function utf8extra.width(s, ambi_is_double, default_width) end ---Return the character index at given location in string s. this is a reverse ---operation of utf8.width(). this function returns a index of location, and a @@ -164,24 +168,24 @@ function utf8.width(s, ambi_is_double, default_width) end ---@return integer idx ---@return integer offset ---@return integer width -function utf8.widthindex(s, location, ambi_is_double, default_width) end +function utf8extra.widthindex(s, location, ambi_is_double, default_width) end ---Convert UTF-8 string s to title-case, used to compare by ignore case. if s ---is a number, it's treat as a code point and return a convert code point ---(number). utf8.lower/utf8.pper has the same extension. ---@param s string ---return string new_string -function utf8.title(s) end +function utf8extra.title(s) end ---Convert UTF-8 string s to folded case, used to compare by ignore case. if s ---is a number, it's treat as a code point and return a convert code point ---(number). utf8.lower/utf8.pper has the same extension. ---@param s string ---return string new_string -function utf8.fold(s) end +function utf8extra.fold(s) end ---Compare a and b without case, -1 means a < b, 0 means a == b and 1 means a > b. ---@param a string ---@param b string ---@return integer result -function utf8.ncasecmp(a, b) end +function utf8extra.ncasecmp(a, b) end |
