Type Function Library native.* Return value Array Revision Release 2024.3703 Keywords fonts, font names See also native.newFont() display.newText()
Returns an array of the available native fonts.
The fonts available in the Corona Simulator may be different from those available on your device. In general, iOS device fonts can be accessed from the Corona Simulator for macOS, but additional macOS fonts will also be available that may not work on the device. If you encounter a problem of fonts appearing in the Corona Simulator but not on your device, this is the most likely cause. When in doubt, check the available device font names using native.getFontNames()
.
Also use native.getFontNames()
if you’re using custom fonts. On Android, the font name must be spelled exactly right, but often the font name is different from the font file name; for a given font file, the font name can be different on Android than on iOS.
native.getFontNames()
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