diff options
| author | jussi | 2022-06-26 15:03:08 +0300 |
|---|---|---|
| committer | jussi | 2022-06-26 15:03:08 +0300 |
| commit | 314d0412a53b8e012ec183c503a69cc32e24ab34 (patch) | |
| tree | 1655be4b4a86f1712641301d673e22750ec7e8a6 /src/text.c | |
| parent | 36baf4c1222aee409bb62be9770798bfa7fdd302 (diff) | |
| download | reilua-enhanced-314d0412a53b8e012ec183c503a69cc32e24ab34.tar.gz reilua-enhanced-314d0412a53b8e012ec183c503a69cc32e24ab34.tar.bz2 reilua-enhanced-314d0412a53b8e012ec183c503a69cc32e24ab34.zip | |
Get font info.
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 75 |
1 files changed, 75 insertions, 0 deletions
@@ -261,3 +261,78 @@ int ltextMeasureText( lua_State *L ) { return 1; } + +/* +> baseSize = RL_GetFontBaseSize( Font font ) + +Get font baseSize + +- Failure return false +- Success return int +*/ +int ltextGetFontBaseSize( lua_State *L ) { + if ( !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontBaseSize( Font font )" ); + lua_pushboolean( L, false ); + return 1; + } + size_t fontId = lua_tointeger( L, -1 ); + + if ( !validFont( fontId ) ) { + lua_pushboolean( L, false ); + return 1; + } + lua_pushinteger( L, state->fonts[ fontId ]->baseSize ); + + return 1; +} + +/* +> glyphCount = RL_GetFontGlyphCount( Font font ) + +Get font glyphCount + +- Failure return false +- Success return int +*/ +int ltextGetFontGlyphCount( lua_State *L ) { + if ( !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphCount( Font font )" ); + lua_pushboolean( L, false ); + return 1; + } + size_t fontId = lua_tointeger( L, -1 ); + + if ( !validFont( fontId ) ) { + lua_pushboolean( L, false ); + return 1; + } + lua_pushinteger( L, state->fonts[ fontId ]->glyphCount ); + + return 1; +} + +/* +> glyphPadding = RL_GetFontGlyphPadding( Font font ) + +Get font glyphPadding + +- Failure return false +- Success return int +*/ +int ltextGetFontGlyphPadding( lua_State *L ) { + if ( !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphPadding( Font font )" ); + lua_pushboolean( L, false ); + return 1; + } + size_t fontId = lua_tointeger( L, -1 ); + + if ( !validFont( fontId ) ) { + lua_pushboolean( L, false ); + return 1; + } + lua_pushinteger( L, state->fonts[ fontId ]->glyphPadding ); + + return 1; +} |
