1. Anders Ruud
  2. love
  3. Issues


Issue #650 wontfix

Adding image font support to newFont and setNewFont

created an issue

I propose that newImageFont be combined into newFont, and setNewFont be able to create and set image fonts.

There are two problems I see with how things are currently:

First, newImageFont is slightly misleading. There isn't an "ImageFont" object, it simply creates a Font in a different way to how newFont does.

It's true that newFont and newImageFont create Fonts in two very different ways, but newImageData and newSoundData also have very different ways of making what they create.

You can create an ImageData object from a file...

ImageData = love.image.newImageData( path/File/FileData )

Or create a blank one by specifying a width and height:

ImageData = love.image.newImageData( width, height )

In fact, love.graphics.newFont is already like this:

You can create a Font object from a file...

love.graphics.newFont( path/File/FileData, size )

Or create one using the default font by specifying a size:

love.graphics.newFont( size )

So I propose that newFont could also create Fonts from an image and a string of glyphs:

love.graphics.newFont( path/etc, glyphs )

Just like newImageData, newSoundData, and creating a Font with newFont using the default font, the arguments don't make things ambiguous.

The second problem is that setNewFont can set a new Font from a font file, or using the default font, but not using an image font. Why not? So I propose that setNewFont accept an image file plus glyph string too:

love.graphics.setNewFont( path/etc, glyphs )

Comments (7)

  1. hahawoo reporter

    Although, newQuad and newGeometry also create the same type of object in different ways, as do newRectangleShape and newPolygonShape (and I'm kind of also thinking that newFileData could have two versions). Hmmmmm...

  2. Bart van Strien

    This would make newFont really weird to use, with 10 overloads that do 2 different things. Not to mention it's really hard to separate which one is which (is the second argument there? is it a string? is it a number?), and it collides with plans to simplify and/or change ImageFont creation. Does it make sense to change this, and then change it back later?

  3. hahawoo reporter

    I feel you. It's just weird how you can set and create a TTF font with one function, but not with an ImageFont. I guess you could have setNewImageFont, but is that weird because there is no setImageFont?

  4. Log in to comment