'cmd' mark shows incorrectly when using non-juce-default font

Using non-juce-default font:

Using juce-default font (but it’ll display all non-ascii chars to messy code):

Well, the font you use needs to have the glyph available.

Yes, @jrlanglois, I know that. but nearly all non-ascii font on macOS don’t have that glyph…

Try Font::setFallbackFontName and Font::setFallbackFontStyle.

Thanks, jrlanglois, I also know those static methods of Font class. However…

void Font::setFallbackFontName (const String& name)
    FontValues::fallbackFont = name;

    jassertfalse; // Note that use of a fallback font isn't currently implemented in OSX..

void Font::setFallbackFontStyle (const String& style)
    FontValues::fallbackFontStyle = style;

    jassertfalse; // Note that use of a fallback font isn't currently implemented in OSX..

Sorry, bit out of my depth from there! Jules knows a lot about that stuff, so could probably clarify why that’s not implemented.

Never mind, jrlanglois.

Hope someone of juce team could solve this issue. Further to say, they’ll have more sympathy and humanistic concern for all foreign programmers… I know Jules hates non-ASCII chars very much though…

This problem solved, the solution is very bad and helpless though… (have to invisibled the shortcut’s text which was defined in ApplicationCommandTarget).

I rewrote the LookAndFeel::drawPopupMenuItem() in MyLookAndFeel class, its implementation is:

LookAndFeel_V2::drawPopupMenuItem (g, area, isSeparator, isActive, 
                                   isHighlighted, isTicked, hasSubMenu,
                                   text, String(), icon, textColour);

In order for this to work out of the box, you need to use TextLayout drawing instead of Graphics one for the menu display.
This way, the system fallback font will work.
This is for example the only to have Japanese text be displayed even if you don’t use a Japanese font.

If this is in Juce code, then this need to be a Juce team mods.
The only issue with TextLayout is that it’s probably slower that the Graphics method

1 Like

Thanks for your reply, @otristan, I’ll give it a try later on :slight_smile:

AFAIK, TextLayout will not solve this problem if you’re using custom fonts. See: TextLayout fallback font not working with memory fonts