I wrote this in an attempt to generate a fixed width font from the default love font. It prints given letters one by one on a black background, screenshoting / cutting out each one and then assembling it into a new imageFont.
I have encountered the following problems:
a) Saving the font in .tga format does not save the transparency which is needed to create an imageFont
b) [FIXED] The zipped version (.love) of this code generates a different (bad) imageFont while when unzipped (ran from a folder) the generated font is as intended. Occurs under WinXP, didn't test on other OS.
Problem a) could theoretically be solved by saving in a different data format, f.e. pixel data as opposed to using image formats.
I have no idea why b) occurs though, any ideas?
Screenshot of b)
The code
Generating fixed width font
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Generating fixed width font
Last edited by Regret on Tue Jul 13, 2010 7:24 pm, edited 1 time in total.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Generating fixed width font
1. PNG > TGA. (Looks over the internet for facts) It's smaller, also lossless, also has alpha channel, and allows more color depth (TGA's max is 8bpc, PNG is 16). More importantly, it is usually better supported on graphic libraries.
2. The "uncompressed works, compressed it gives me an error" is 90% times due to uppercase/lowercase differences between the filenames used in the source code and the real file names. For example, image.png vs image.PNG . Look for those typos.
2. The "uncompressed works, compressed it gives me an error" is 90% times due to uppercase/lowercase differences between the filenames used in the source code and the real file names. For example, image.png vs image.PNG . Look for those typos.
When I write def I mean function.
Re: Generating fixed width font
Love does not support saving into .png format using love.image.newEncodedImageData.kikito wrote:1. PNG > TGA. (Looks over the internet for facts) It's smaller, also lossless, also has alpha channel, and allows more color depth (TGA's max is 8bpc, PNG is 16). More importantly, it is usually better supported on graphic libraries.
There are no images used, no typos in filenames as it is only main.lua and conf.lua.kikito wrote:2. The "uncompressed works, compressed it gives me an error" is 90% times due to uppercase/lowercase differences between the filenames used in the source code and the real file names. For example, image.png vs image.PNG . Look for those typos.
EDIT: Problem b) was my fault due to running .love files with an older version, ran it with newest and it worked ;/
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Generating fixed width font
So, ehm, why not use a normal fixed width font?
Help us help you: attach a .love.
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests