gamnit :: BMFontAsset :: load
# Load font description and textures from the assets folder
#
# Sets `error` if an error occurred, otherwise
# the font description can be accessed via `desc`.
fun load
do
var text_asset = text_asset
text_asset.load
var error = text_asset.error
if error != null then
self.error = error
return
end
var desc = text_asset.to_s
var fnt_or_error = desc.parse_bmfont(path.dirname)
if fnt_or_error.is_error then
self.error = fnt_or_error.error
return
end
var fnt = fnt_or_error.value
self.desc_cache = fnt
# Load textures too
for page_name, texture in fnt.pages do
texture.load
# Move up any texture loading error.
# This algo keeps only the latest error,
# but this isn't a problem on single page fonts.
error = texture.error
if error != null then self.error = error
end
end
lib/gamnit/bmfont.nit:328,2--362,4