Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Monospace fonts is not rendered correctly  (Read 3195 times)

0 Members and 1 Guest are viewing this topic.

underww

  • Newbie
  • *
  • Posts: 34
    • View Profile
Monospace fonts is not rendered correctly
« 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
 
« Last Edit: October 18, 2015, 03:33:00 pm by underww »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Monospace fonts is not rendered correctly
« Reply #1 on: October 19, 2015, 12:06:05 am »
sf::Text with FantasqueSansMono seems fine to me.
Back to C++ gamedev with SFML in May 2023

underww

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Monospace fonts is not rendered correctly
« Reply #2 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)
« Last Edit: October 19, 2015, 01:37:44 am by underww »

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Monospace fonts is not rendered correctly
« Reply #3 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:
« Last Edit: October 19, 2015, 06:25:33 am by mkalex777 »

underww

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Monospace fonts is not rendered correctly
« Reply #4 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.
« Last Edit: October 19, 2015, 07:30:10 am by underww »