Could it be possible to have a choise (boolean) if you want font's bottom left origin or some command...?
But if i'm the only one who wants to keep bottom left, ignore me
Virox wrote:Could it be possible to have a choise (boolean) if you want font's bottom left origin or some command...?
But if i'm the only one who wants to keep bottom left, ignore me
mmm I thought so too, at the beginning, but I'm not finding it as trivial as I thought.
My biggest issue comes from the fact that there's no way to tell fonts appart, when they are being created dynamically (i.e. different heights)
Sure enough, I can have complete control over my fonts if I am developing a complete game. I can load/create them on the love.load() stage and then reference them on the game. However, if I am writing a game engine (or a GUI library) this is not that simple. I don't have control over the loading phase. When the user says "use this font, with this height" it is kind of difficult to know whether the font has already been instantiated somewhere with that height, or whether I have to create it myself.
So let me rephrase my request then: I'd like fonts to be more easily identifiable. For example: It would help having a "getParentFont()" & "getOriginalFont()" for fonts created with different heights. If f1 is loaded from a file, and f2 is f1 with height=33, then f2:getParentFont() should return f1. If f3 is f2 with height=14, then f3:getParentFont() will return f2, and f3:getOriginalFont() will return f1.
A "getType()" would also be nice ('string', 'ttf', you get the idea)
local loadedFonts = {}
local createFont = love.graphics.newFont
function love.graphics.newFont(fname, fsize)
fsize = fsize or 'default'
loadedFonts[fname] = loadedFonts[fname] or {}
loadedFonts[fname][fsize] = loadedFonts[fname][fsize] or (fsize ~= 'default' and createFont(fname, fsize) or createFont(fname))
return loadedFonts[fname][fsize]
end