1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-06-30 23:20:43 +02:00

New font selection formspec

This commit is contained in:
Pierre-Yves Rollo
2018-11-10 22:35:47 +01:00
parent c1835931e5
commit b8357a505c
2 changed files with 175 additions and 4 deletions

View File

@ -29,9 +29,10 @@ font_api.path = minetest.get_modpath(font_api.name)
dofile(font_api.path.."/font.lua")
dofile(font_api.path.."/registry.lua")
dofile(font_api.path.."/fontform.lua")
--- Standard on_display_update entity callback.
-- Node should have a corresponding display_entity with size, resolution and
-- Node should have a corresponding display_entity with size, resolution and
-- maxlines fields and optionally halign, valign and color fields
-- @param pos Node position
-- @param objref Object reference of entity
@ -49,8 +50,8 @@ function font_api.on_display_update(pos, objref)
local maxlines = def.maxlines or 1 -- TODO:How to do w/o maxlines ?
objref:set_properties({
textures={font:make_text_texture(text,
objref:set_properties({
textures={font:make_text_texture(text,
font:get_height(maxlines) * def.size.x / def.size.y
/ (def.aspect_ratio or 1),
font:get_height(maxlines),
@ -62,4 +63,3 @@ end
-- Compatibility
font_lib = font_api