organicmaps / organicmaps

🍃 Organic Maps is a free Android & iOS offline maps app for travelers, tourists, hikers, and cyclists. It uses crowd-sourced OpenStreetMap data and is developed with love by MapsWithMe (MapsMe) founders and our community. No ads, no tracking, no data collection, no crapware. Please donate to support the development!
https://organicmaps.app
Apache License 2.0
8.58k stars 837 forks source link

[drape] Removed fixed text size in favor of always using SDF fonts #7959

Closed biodranik closed 1 week ago

biodranik commented 1 week ago

Fixed size was a case only for some older mdpi devices (likely to look a bit better). SDF fonts allow dynamic resizing to any desired size without loss of quality. And each glyph should be rendered only once on the texture.

Preparation for #4281

pastk commented 1 week ago

Looks good on my mdpi screen, better than before!

Now there are much less boggled fonts cases like this: image

Now this is the worst case I was able to spot image

Also the labels seem to be somewhat more contrast now and the min font size is smaller now.

biodranik commented 1 week ago

@pastk your screen is mdpi, right? Are there any before/after screenshots?

pastk commented 1 week ago

Yeap its mdpi, this PR produces smaller, more condensed and less blurry fonts:

fonts

biodranik commented 1 week ago

Can you please test if visual quality of fonts changes when you edit this parameter:

    uint32_t m_sdfScale = 4;

to 1, 2, 8, 16, 32?

And also check how uint32_t m_baseGlyphHeight = 22; influences the quality too? Maybe try 18, 24, 28, 32?

biodranik commented 1 week ago

@pastk sorry, the correct place to modify these constants is here:

uint32_t VisualParams::GetGlyphSdfScale() const
{
  ASSERT_INITED;
  return (m_visualScale <= 1.0) ? 3 : 4;
}

uint32_t VisualParams::GetGlyphBaseSize() const
{
  ASSERT_INITED;
  return 22;
}
pastk commented 1 week ago

GlyphSdfScale is best with 3 (the default) or 4 (I like it a bit more). The difference is very subtle anyway. (2 is too blurry, 8 is too coarse like there is no AA at all).

GlyphBaseSize is the best with default 22. I won't change it.