ToME: the Tales of Maj'Eyal
http://forums.te4.org/

Adding or changing default font in addon?
http://forums.te4.org/viewtopic.php?f=45&t=49286
Page 1 of 1

Author:  Feanor1397 [ Sat Oct 27, 2018 8:30 pm ]
Post subject:  Adding or changing default font in addon?

I'm making translation for ToME as addon, but I got a problem right now: most of default tome fonts have not some glyphs like cyrillic characters. Is there a way to add font pack to my addon or change default font files by overloading it?

Author:  Feanor1397 [ Sun Oct 28, 2018 8:46 am ]
Post subject:  Re: Adding or changing default font in addon?

So far i managed to load mine font in hooks:

Code:
local Base = require "engine.ui.Base"
--local FontPackage = require "engine.FontPackage"

class:bindHook("ToME:load", function(self, data)
--FontPackage:loadDefinition("/data/font/packages/default.lua")
Base.font = core.display.newFont("/data-rusificator/font/DroidSans.ttf", 12)
Base.font_h = Base.font:lineSkip()
Base.font_mono = core.display.newFont("/data-rusificator/font/DroidSansMono.ttf", 12)
Base.font_mono_w = Base.font_mono:size("  ") - Base.font_mono:size(" ")  -- account for inter-letter interval
Base.font_mono_h = Base.font_mono:lineSkip()
Base.font_bold = core.display.newFont("/data-rusificator/font/DroidSans.ttf", 12)
Base.font_bold_h = Base.font_bold:lineSkip()
end)


overriding font files did not work. overriding of fontPackage works partialy. new font pack appears in settings WHILE tome module loaded, but loading fonts from it did not works, engine falls to base fonts anyway.
If I set fonts like in code above I'm loosing font size control with settings. What can i do to fix that?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/