Love2D - Font Messed Up!

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Love2D - Font Messed Up!

Post by kikito »

Triplenox wrote: Here is the code I have for the fonts:
I think he was referring to a .love file showing the error. With the font included. So we can see it for ourselves.

Regarding the screenshot, I still don't know what's wrong with it. Some letters are "not aligned" with the rest, but I guessed that was the way the font was.
When I write def I mean function.
FrogsFriend
Prole
Posts: 6
Joined: Mon Aug 27, 2012 10:21 am

Re: Love2D - Font Messed Up!

Post by FrogsFriend »

If you zoom in on the font it's clear that all the straight edges are very crisp, but the curves are blurred.

Is that the problem?
Is that the way the font is supposed to be?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Love2D - Font Messed Up!

Post by Robin »

FrogsFriend wrote:If you zoom in on the font it's clear that all the straight edges are very crisp, but the curves are blurred.
Isn't that just anti-aliasing?

And yeah, Triplenox, without a .love we can't really help. We can only stand around and talk about stuff vaguely related to your problem.
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Love2D - Font Messed Up!

Post by Jasoco »

Triplenox wrote: This isn't the full code for my love.load and love.draw, but it's everything to do with text, hope this helps, some how :p

Kind Regards,

-Triplenox (I'm feeling like a retard now!)
Problem is we also need the font file. Because we can all just use another font but it would look right to us. We need the gf.ttf font in order to compare it exactly to what you have.

It might just be what fonts look like on your system.
User avatar
the_leg
Prole
Posts: 25
Joined: Sun Sep 05, 2010 3:43 am

Re: Love2D - Font Messed Up!

Post by the_leg »

Just google harabara for the font file. GIMP renders the text almost the same as LOVE does, so I don't think this is a LOVE issue. You might want to try the font out in other programs, and see how they render it, or change fonts.
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

Re: Love2D - Font Messed Up!

Post by pk »

Okay, I'm a bit of a font nerd.

*ahem*

The article I linked to on page one (this) explains the problem you are seeing with the fonts. Grayscale anti-aliasing is going to look blurred compared to subpixel anti-aliasing. Basically, horizontal and vertical lines will look okay, but everything else just blurs horribly. Read the first few paragraphs, you won't find a much more succinct plain English explanation. You can stop when it starts going into Windows specifics.

Broadly, there are two types of fonts: print fonts and screen fonts. Print fonts are designed to be printed on high quality media at high dpi. Screen fonts are optimized to work on a computer display, which up until recently have been very low resolution in comparison. Apple's retina display is encroaching upon the dpi that professional designers are used to seeing in their posters and brochures.

A basic overview of print vs screen fonts can be found here.

There are lots of programmers here, so some of you should be familiar with bitmap fonts. Bitmap fonts such as the Proggy fonts are a no brainer for low resolution displays. The pixels are either on or off, so they always look sharp and crisp, no need for any anti-aliasing. But... they don't scale up or down automatically. If you make a font at 9pt, and someone wants to use the same font at 12pt, you have to redraw every single glyph at the larger size. Good old Courier on Windows is an example of this; you can only use it at 10, 12, and 15 point because those are the only sizes it was drawn in.

Sometime around the early '80s a few font foundries started creating fonts that where optimized for screens, or that could work equally well for print and screen. Hinting is what made this possible.

Bigelow and Holmes, for example, created the kick ass Lucida family of fonts that Microsoft and Apple have both been using for almost two decades. If you've ever read an O'Reily book with source code listings, you're probably looking at TheSansMono which was designed by the same guy who made Consolas. Bitstream Vera is a newer free font that works quite well at low resolution, even with grayscale anti-aliasing.

-----

Fonts can be confusing. Hopefully this helped some and you guys can stop standing around scratching your heads.

@Triplenox: Harabara looks like it works best as a print font to me. The font is full of small curves that don't work well at anything other than retina dpi levels. My advice is either 1) stick with the font and hope nobody else notices, or 2) search for a free screen font that works better. It's my experience that your average computer user is utterly clueless about font quality, so I think you can safely get away with option 1.

Somebody on Mac or Linux (Linux with RGB subpixels rendering enabled), download this font, load it up in Gedit/TextEdit/whatever, and post it here. You'll be able to tell the difference when Harabara is rendered with subpixel anti-aliasing turned on.

I *think* LOVE uses FreeType, and I *think* FreeType can render fonts using different levels of subpixel anti-aliasing. Why LOVE is configured out of the box for grayscale, I don't know. You'd have to ask someone else.
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love2D - Font Messed Up!

Post by substitute541 »

pk wrote: I *think* LOVE uses FreeType, and I *think* FreeType can render fonts using different levels of subpixel anti-aliasing. Why LOVE is configured out of the box for grayscale, I don't know. You'd have to ask someone else.
Love2D uses TrueType, and grayscale anti-aliasing. It's either the font, or Love2D. If you don't know what (btw talking to the one who is asking a question) subpixel rendering is, it adds red, green, and blue to the edges of the font. The result is much smoother compared to grayscale rendering. Try print-screening this page, and copy it to Paint, then zoom in on the text.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Love2D - Font Messed Up!

Post by bartbes »

substitute541 wrote:Love2D uses TrueType
Freetype.


Anyway, am I right in thinking that if he really wants this font, and he wants it do be crips, he could also render it somewhere else and then use it as ImageFont?
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Love2D - Font Messed Up!

Post by Boolsheet »

Sure he can. The question is does he care for displays with reversed or vertical pixel arrangement (or even CRTs) and can he bothered to write a menu that asks the player what he wants (because it's easier to implement than the whole querying-the-OS thing)?

And then there's FSAA that backstabs us anyway. :P

I like that FreeType defaults to something portable and predictable. More options for the font renderering would be nice, however. Not sure why there's no issue for that on the tracker yet.
Shallow indentations.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Love2D - Font Messed Up!

Post by Jasoco »

bartbes wrote:
substitute541 wrote:Love2D uses TrueType
Freetype.


Anyway, am I right in thinking that if he really wants this font, and he wants it do be crips, he could also render it somewhere else and then use it as ImageFont?
It wouldn't have any Kerning if you turn it into an image font.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests