native.getFontNames()

Type Function
Library native.*
Return value Array
Revision Release 2022.3683
Keywords fonts, font names
See also native.newFont()
display.newText()

Overview

Returns an array of the available native fonts.

Gotchas

Syntax

native.getFontNames()

Example

local systemFonts = native.getFontNames()

-- Set the string to query for (part of the font name to locate)
local searchString = "pt"

-- Display each font in the Terminal/console
for i, fontName in ipairs( systemFonts ) do

    local j, k = string.find( string.lower(fontName), string.lower(searchString) )

    if ( j ~= nil ) then
        print( "Font Name = " .. tostring( fontName ) )
    end
end