Page 2 of 2

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

Posted: Thu May 30, 2024 5:31 pm
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:

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

Posted: Tue Jun 04, 2024 8:42 am
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 578 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:

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

Posted: Tue Jun 04, 2024 6:06 pm
by dusoft
Good catch and maybe useful for somebody.