naev 0.12.5
nlua_font.c File Reference

Handles fonts. More...

#include "nlua_font.h"
#include "ndata.h"
#include "nluadef.h"
Include dependency graph for nlua_font.c:

Go to the source code of this file.

Functions

static int fontL_gc (lua_State *L)
 Frees a font.
static int fontL_eq (lua_State *L)
 Compares two fonts to see if they are the same.
static int fontL_new (lua_State *L)
 Gets a font.
static int fontL_height (lua_State *L)
 Gets the height of a font.
static int fontL_width (lua_State *L)
 Gets the width of some text for a font.
static int fontL_setFilter (lua_State *L)
 Sets the font minification and magnification filters.
static int fontL_addFallback (lua_State *L)
 Adds a fallback to a font.
int nlua_loadFont (nlua_env env)
 Loads the font library.
glFontlua_tofont (lua_State *L, int ind)
 Lua bindings to interact with fonts.
glFontluaL_checkfont (lua_State *L, int ind)
 Gets font at index or raises error if there is no font at index.
glFontlua_pushfont (lua_State *L, glFont font)
 Pushes a font on the stack.
int lua_isfont (lua_State *L, int ind)
 Checks to see if ind is a font.

Variables

static const luaL_Reg fontL_methods []

Detailed Description

Handles fonts.

Definition in file nlua_font.c.

Function Documentation

◆ fontL_addFallback()

int fontL_addFallback ( lua_State * L)
static

Adds a fallback to a font.

Lua function parameter: Font font Font to set fallback to. Lua function parameter: string filename Name of the font to add. Lua function parameter:[opt=""] string prefix Prefix to use for the fonts.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: addFallback

Definition at line 251 of file nlua_font.c.

◆ fontL_eq()

int fontL_eq ( lua_State * L)
static

Compares two fonts to see if they are the same.

Lua function parameter: Font f1 Font 1 to compare. Lua function parameter: Font f2 Font 2 to compare. Lua return parameter: boolean true if both fonts are the same.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: __eq

Definition at line 137 of file nlua_font.c.

◆ fontL_gc()

int fontL_gc ( lua_State * L)
static

Frees a font.

Lua function parameter: Font font Font to free.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: __gc

Definition at line 123 of file nlua_font.c.

◆ fontL_height()

int fontL_height ( lua_State * L)
static

Gets the height of a font.

Lua function parameter: Font f Font to get the height of. Lua return parameter: number Height of the font.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: height

Definition at line 192 of file nlua_font.c.

◆ fontL_new()

int fontL_new ( lua_State * L)
static

Gets a font.

Lua function parameter: String|Number fontname Name of the font. Lua function parameter:[opt=1.] size Number Font height. Lua return parameter: Font A newly created font. Lua return parameter: String Name of the newly created font. Lua return parameter: String Prefix of the newly created font.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: new

Definition at line 156 of file nlua_font.c.

◆ fontL_setFilter()

int fontL_setFilter ( lua_State * L)
static

Sets the font minification and magnification filters.

Lua function parameter: Font font Font to set filter. Lua function parameter: string min Minification filter ("nearest" or "linear") Lua function parameter:[opt] string mag Magnification filter ("nearest" or "linear"). Defaults to min.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: setFilter

Definition at line 225 of file nlua_font.c.

◆ fontL_width()

int fontL_width ( lua_State * L)
static

Gets the width of some text for a font.

Lua function parameter: Font f Font to use. Lua function parameter: string text Text to get width of. Lua return parameter: number Height of the font.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: width

Definition at line 207 of file nlua_font.c.

◆ lua_isfont()

int lua_isfont ( lua_State * L,
int ind )

Checks to see if ind is a font.

Parameters
LLua state to check.
indIndex position to check.
Returns
1 if ind is a font.

Definition at line 101 of file nlua_font.c.

◆ lua_pushfont()

glFont * lua_pushfont ( lua_State * L,
glFont font )

Pushes a font on the stack.

Parameters
LLua state to push font into.
fontFont to push.
Returns
Newly pushed font.

Definition at line 86 of file nlua_font.c.

◆ lua_tofont()

glFont * lua_tofont ( lua_State * L,
int ind )

Lua bindings to interact with fonts.

Lua module: font

Gets font at index.

Parameters
LLua state to get font from.
indIndex position to find the font.
Returns
Font found at the index in the state.

Definition at line 61 of file nlua_font.c.

◆ luaL_checkfont()

glFont * luaL_checkfont ( lua_State * L,
int ind )

Gets font at index or raises error if there is no font at index.

Parameters
LLua state to get font from.
indIndex position to find font.
Returns
Font found at the index in the state.

Definition at line 72 of file nlua_font.c.

◆ nlua_loadFont()

int nlua_loadFont ( nlua_env env)

Loads the font library.

Parameters
envEnvironment to load font library into.
Returns
0 on success.

Definition at line 43 of file nlua_font.c.

Variable Documentation

◆ fontL_methods

const luaL_Reg fontL_methods[]
static
Initial value:
= {
{ "__gc", fontL_gc },
{ "__eq", fontL_eq },
{ "new", fontL_new },
{ "height", fontL_height },
{ "width", fontL_width },
{ "setFilter", fontL_setFilter },
{ "addFallback", fontL_addFallback },
{ 0, 0 } }
static int fontL_height(lua_State *L)
Gets the height of a font.
Definition nlua_font.c:192
static int fontL_width(lua_State *L)
Gets the width of some text for a font.
Definition nlua_font.c:207
static int fontL_addFallback(lua_State *L)
Adds a fallback to a font.
Definition nlua_font.c:251
static int fontL_eq(lua_State *L)
Compares two fonts to see if they are the same.
Definition nlua_font.c:137
static int fontL_setFilter(lua_State *L)
Sets the font minification and magnification filters.
Definition nlua_font.c:225
static int fontL_new(lua_State *L)
Gets a font.
Definition nlua_font.c:156
static int fontL_gc(lua_State *L)
Frees a font.
Definition nlua_font.c:123

Font metatable methods.

Definition at line 27 of file nlua_font.c.