Menu

#266 Localized label for font selector

v0.9.29
closed
None
5
2022-12-11
2022-12-09
No

Currently, it is quite difficult to understand which font is suitable to use for user's language.

I tried to translate 'Aa' to 'あ' hoping the first image, but , of course, the result was the second one.

How about rendering translated label string only for the locale fonts such as "ja.ttf" ?

2 Attachments

Discussion

  • Pere Pujal i Carabantes

    Interesting, I never paid attention to this but really it looks much better without the squares

    The attached patch helps when the translation has at least two(2) letters and both fail to render or they render exactly the same.

    It doesn't help when one letter renders right and the other renders as square, but I guess this case is more complex to fix...

    Please test
    Pere

     
  • William Kendrick

    Pere's diff is good, and I've applied it, thanks!

    The charset_works() code expects to compare glyphs for multiple characters in a string. If they all come back identical (e.g., all "unknown character" rectangles) then we know it's not blitting them properly. This is why "Aa" is handy.

    So what I also had to do was set a string with TWO Hiragana characters (I used regular and small for this, too, so: "あぁ" -- please feel free to change it to something that makes more sense!) to get the code to work.

    On my system, I see a LOT of "Aa" in a variety of fonts (so no broken rectangles! great!), but also one font where I seem to have Hiragana available, which shows as "あぁ" in the font selector.

    PS - There are other strings, used by "dirwalk" to 'score' fonts, based on how useful to (compatible they are with) the chosen locale, so I've added some Hiragana to them as well. e.g., "oO" helps determine whether a Latin font truly has lowercase characters that look different from uppercase.

    PPS - Adjusted the comments in "dirwalk" so that the explanations ACTUALLY made their way into the POT and PO files, to explain all these random little strings. Sorry I didn't notice they got lost (or perhaps were never there!?)

    If this all seems better, let me know and I'll close this ticket...

     
  • Shin-ichi TOYAMA

    Hi!

    Thanks for working on this!!

    Please see following results on Windows.

    First, I enabled system font by config hoping many 'あぁ' on the font selector for the fonts supporting Hiragana. But, I saw just one 'あぁ'. The labels for other font supporting Hiragana are still 'Aa'.

    Next, I changed the translation for 'Aa' from 'あぁ' to 'あア' because small 'ぁ' is rarely used and I thought 'あア' will show more clearly Katakana is available. But, 'あア' did not appear on the font selector.

     
  • Shin-ichi TOYAMA

    I confirmed that just applying Pere's patch to the commit "3e6415e408911d5449da459697e56a62fd4efdf3" works fine.

    I see so many 'あア' on the font selector!

     
    • William Kendrick

      @dolphin6k -- In case I've messed things up in my attempt to apply Pere's changes, can you try to take what's in master now, and adjust it so it works properly for you, if that's even necessary? You can either post a diff, or if it seems good, just commit to master branch.

      Thanks!

       
  • Shin-ichi TOYAMA

    I confirmed that following change in fonts.c stops listing all available localized labels.

    @@ -1607,16 +1616,22 @@ static int do_surfcmp(const SDL_Surface * const *const v1,
         }
       }
    
    -  return cmp;
    +  /* In the end, they were the same! */
    +  return 0;
    

    I've pushed a commit that reverts this part.

    Please check it and do correct thing if it has any problem.

     

    Last edit: Shin-ichi TOYAMA 2022-12-11
    • William Kendrick

      Thanks! :) It looks like we can close this now!

       
  • William Kendrick

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB