native.getFontNames()

类型 功能
native.*
返回值 数组
修订版本 发行版 2024.3703
关键字 字体,字体名称
另请参见 native.newFont()
display.newText()

概述

返回可用本机字体的数组。

疑难问题

语法

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