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

Author Topic: Glyph space inconsistency is killing me  (Read 4644 times)

0 Members and 1 Guest are viewing this topic.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Glyph space inconsistency is killing me
« on: December 23, 2018, 10:01:25 am »
See attached picture please.

sf::Text::setLetterSpacing isn't helping because the overall space sizes between glyphs is inconsistent.

Is there a way to fix this?

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Glyph space inconsistency is killing me
« Reply #1 on: December 23, 2018, 10:15:42 am »
Easier to read example with white font in the attachment.

As you can see (especially if you zoom in), some glyphs have the same spacing as photoshop while some have more (hence why I call it inconsistent)

(sorry for double post, meant to edit)
« Last Edit: December 23, 2018, 10:17:33 am by NGM88 »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Glyph space inconsistency is killing me
« Reply #2 on: December 30, 2018, 12:41:28 pm »
I think the comparison should be made on same-length examples - adjust the letter spacing until the final length of the texts are identical. That way, a more clear picture of the differences and where they are would be able to be seen.

It's also worth noting that SFML seems to show larger spaces overall in your examples.

Another thing to note is that Photoshop has multiple text rendering types.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Glyph space inconsistency is killing me
« Reply #3 on: January 02, 2019, 04:14:24 pm »
I have been doing a lot of letter spacing and line spacing tests since I started this topic. SFML's rendering often looks downright absurd. Just look at the attachment in my original post where "not" and "yet" look like they have spaces between them where as the word "available" looks fine. If I narrow down the letter spacing, then the word "available" looks absurd by the time the two other words look normal.

SFML has other issues when the comes to fonts as well: it seems utterly random which monospace font will work and which will not.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Glyph space inconsistency is killing me
« Reply #4 on: January 02, 2019, 04:30:28 pm »
Is the inconsistent spacing consistent with different fonts? I mean, if you print the same words with different fonts, does the spacing look to be the same? Or are the results totally random?

And don't hesistate to have a look at the corresponding code, or even to debug it; it's not that complicated (FreeType does most of the job).
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Glyph space inconsistency is killing me
« Reply #5 on: January 02, 2019, 05:44:51 pm »
Maybe it's this difference (from https://www.freetype.org/freetype2/docs/tutorial/step2.html )?

Quote
Not all font formats contain kerning information, and not all kerning formats are supported by FreeType; in particular, for TrueType fonts, the API can only access kerning via the ‘kern’ table. OpenType kerning via the ‘GPOS’ table is not supported! You need a higher-level library like HarfBuzz, Pango, or ICU, since GPOS kerning requires contextual string handling.

I assume Photoshop coming from Adobe themselves supports advanced typography.

Does that font look good and well spaced in other things like: GIMP, Firefox, Chrome, LaTeX, Microsoft/Libre Office Word, WordPad, etc.?
Back to C++ gamedev with SFML in May 2023

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Glyph space inconsistency is killing me
« Reply #6 on: January 02, 2019, 10:05:44 pm »
Is the inconsistent spacing consistent with different fonts? I mean, if you print the same words with different fonts, does the spacing look to be the same? Or are the results totally random?

I did comparisons with a number of fonts and there are inconsistencies in most of them. For example with the last font I tried, in the phrase "Versus the AI" there was an obvious space between the "V" and the "e". I compared it to PS and Word and noticed that, at character size 15, there was a 1 pixel gap between the "V" and the "e" where as the rest of the phrase was the same length. All the fonts I tried look perfectly fine in PS and Word.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Glyph space inconsistency is killing me
« Reply #7 on: January 03, 2019, 07:37:47 am »
Yes, but what I mean is: is there the same extra gap between 'V' and 'e' with all the fonts you tried?
Laurent Gomila - SFML developer

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Glyph space inconsistency is killing me
« Reply #8 on: January 04, 2019, 10:46:24 am »
Yes, but what I mean is: is there the same extra gap between 'V' and 'e' with all the fonts you tried?

If you look at my attachment at the second post you can see that the word "Versus" is more consistent with that particular font. No extra space between V and e.