Why fonts look different on LOVE than on web browser?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
RNavega
Party member
Posts: 341
Joined: Sun Aug 16, 2020 1:28 pm

Re: Why fonts look different on LOVE than on web browser?

Post by RNavega »

Before a definitive solution is found, have you tried using Text objects? They let you define static text, so it should be faster than multiple graphics.print() calls depending on the size of the texts you're trying to print.

The two key functions being:
qwdqwqwffqw
Prole
Posts: 25
Joined: Sat Jan 25, 2020 4:11 pm

Re: Why fonts look different on LOVE than on web browser?

Post by qwdqwqwffqw »

I finally solved this issue.

You are right. TextBatch should be better choice.
Also I did some tests after you mentioned GlyphData, and I found out advance of single glyph(GlyphData:getAdvance()) isn't always same as width of single glyph(font:getWidth("X")); sometimes they are same but sometimes they show 1px difference.
By applying advance instead, I could get same('improved') result that I've posted above (without needing big-sized font and messy converting calculations).

In addition, there was still slight difference after this modification as I've mentioned earlier. It turned out to be not applying subpixel positioning was causing this small difference. (https://freetype.org/freetype2/docs/gly ... phs-5.html).
After including this into code, I could get the perfect result :

results.png
results.png (54.85 KiB) Viewed 577 times

1st line is screenshot image of web browser rendering (which is the desired result).
2nd line is the result of default love.graphics.print, which clearly shows too condensed result.
3rd line is the result of my prior adjustment, better but still showing discrepancy.
4th line is the result of my final adjustment, which is rendered just same as 1st line.

Thanks for the suggestions, everyone! :awesome:
User avatar
dusoft
Party member
Posts: 611
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Why fonts look different on LOVE than on web browser?

Post by dusoft »

Good catch and maybe useful for somebody.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests