SFML community forums

Help => Graphics => Topic started by: underww on October 18, 2015, 03:12:32 pm

Title: Monospace fonts is not rendered correctly
Post by: underww on October 18, 2015, 03:12:32 pm
I'm making a pseudo-console using SFML with a monospace font.
but I found that the monospace fonts is not rendered correctly in SFML.

the width(the 'advance' of the glyph) values are not equal.
and the 'bounds'  values of the glyph are also a bit strange.

here's some glyph data from my test.
(I tested a few monospace fonts, and they're normal in other environments)

any help would be appreciated. Thanks :)

 // OfficeCodePro, 20px
 // bounds = (left, top, width, height)
 'I' : bounds =  2, -14,  8, 14, advance = 12
 'J' : bounds =  1, -14,  9, 14, advance = 12
 'K' : bounds =  2, -14, 10, 14, advance = 12
 'L' : bounds =  3, -14,  8, 14, advance = 12
 'M' : bounds =  2, -14, 10, 14, advance = 13
 'N' : bounds =  2, -14,  9, 14, advance = 12
 'O' : bounds =  1, -14, 10, 14, advance = 12
 'P' : bounds =  2, -14,  9, 14, advance = 12
 'Q' : bounds =  1, -14, 11, 18, advance = 12
 'R' : bounds =  2, -14, 10, 14, advance = 12

 // FantasqueSansMono, 20px
 'I' : bounds =  1, -13,  7, 13, advance = 10
 'J' : bounds =  1, -13,  9, 13, advance = 10
 'K' : bounds =  1, -13,  9, 14, advance = 10
 'L' : bounds =  1, -13,  8, 13, advance = 10
 'M' : bounds =  1, -13,  8, 13, advance = 11
 'N' : bounds =  1, -13,  8, 13, advance = 10
 'O' : bounds =  1, -13,  9, 13, advance = 11
 'P' : bounds =  1, -13,  8, 13, advance = 10
 'Q' : bounds =  1, -13,  9, 15, advance = 10
 'R' : bounds =  1, -13,  9, 14, advance = 10
 
Title: Re: Monospace fonts is not rendered correctly
Post by: FRex on October 19, 2015, 12:06:05 am
sf::Text with FantasqueSansMono seems fine to me.
Title: Re: Monospace fonts is not rendered correctly
Post by: underww on October 19, 2015, 01:28:59 am
This is the screenshot of FantasqueSansMono-Regular font.
It's one sf::Text object.
(I use Windows 10, VS2015, and the latest version of SFML which I built myself)
Title: Re: Monospace fonts is not rendered correctly
Post by: mkalex777 on October 19, 2015, 05:46:55 am
I'm using UbuntuMonospace for in game console. I'm not sure about exact pixel size, but it seems that it works as monospace, because on the screen it looks good and really as monospace

Here is how your test looks with UbuntuMono-R.ttf in my console:
(http://savepic.su/6210182.png)
Title: Re: Monospace fonts is not rendered correctly
Post by: underww on October 19, 2015, 07:13:43 am
Yes, actually some fonts work fine. but also some fonts don't work as monospace.

Edit: Oh, It looks because of the bugs of fonts themselves.
but I still don't know why they're normal in other environments.