It's nothing really problematic, but I've been wondering why same font(+ same size & same text) looks different on Love, than on web browser, pdf viewer, etc.
The text rendered in love seems to have same heights but narrower width. After several testing, I noticed it's not only letter spacing & kerning, but also thickness of stroke and width/height ratio are slight different(letters like "/" shows noticeable differences in slope angle in stoke), if I'm not mistaken.
Why is it so? Is there any fundamental difference in rendering method?
Since narrowly condensed text can be harmful to readability, is there any way to control this(other than scaling horizontally)?
Why fonts look different on LOVE than on web browser?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 21
- Joined: Sat Jan 25, 2020 4:11 pm
Re: Why fonts look different on LOVE than on web browser?
Please, post screenshots. AFAIK LOVE uses bitmaps internally for font rendering. Even if you provide TTF, an internal bitmap font will be created from it. This could be the cause.
- slime
- Solid Snayke
- Posts: 3141
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Why fonts look different on LOVE than on web browser?
love uses FreeType for truetype text rendering. FreeType has its own rasterization algorithms and default hinting that may behave differently from a specific operating system's own text renderer.
(In fact, text rendered through the OS will look different on each OS.)
That being said, without knowing what your fonts and code are, we can only guess about what you're seeing.
(In fact, text rendered through the OS will look different on each OS.)
That being said, without knowing what your fonts and code are, we can only guess about what you're seeing.
-
- Prole
- Posts: 21
- Joined: Sat Jan 25, 2020 4:11 pm
Re: Why fonts look different on LOVE than on web browser?
Oh, sorry for not providing any examples & code.
Here is an example with Segoe UI TTF file(system font. file could be found in C:\Windows\Fonts), but similar difference could be found in other font files including OTF ones.
1. A paragraph from love2d github page(I added "/" for better comparison) in chrome browser : which will be rendered with Segoe UI + 16px size in my environment. 2. Made simple .html with same text, to be sure : 3. in notepad2(and other apps) : > All above shows same rendering output. You can download images and compare them(they are on the same scale).
4. love, 16px : same height, but narrower output : 5. love, 17px : taller, but still narrower ouput : As you can see, rendering of LOVE show more 'condensed' output.
love code used :
Here is an example with Segoe UI TTF file(system font. file could be found in C:\Windows\Fonts), but similar difference could be found in other font files including OTF ones.
1. A paragraph from love2d github page(I added "/" for better comparison) in chrome browser : which will be rendered with Segoe UI + 16px size in my environment. 2. Made simple .html with same text, to be sure : 3. in notepad2(and other apps) : > All above shows same rendering output. You can download images and compare them(they are on the same scale).
4. love, 16px : same height, but narrower output : 5. love, 17px : taller, but still narrower ouput : As you can see, rendering of LOVE show more 'condensed' output.
love code used :
Code: Select all
love.graphics.setFont(love.graphics.newFont("segoeui.ttf", 16))
local s = "There/ are also branches for currently released major versions, which may have fixes and changes meant for \nupcoming patch releases within that major version."
function love.draw()
love.graphics.print(s, 20, 20)
end
Re: Why fonts look different on LOVE than on web browser?
This looks like if anything, it should be reported to FreeType.
Re: Why fonts look different on LOVE than on web browser?
The difference seems to be in kerning and I would be curious why.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests