diff --git a/src/juce_appframework/gui/components/juce_Component.cpp b/src/juce_appframework/gui/components/juce_Component.cpp index 5281c5c837..ec99ca70cd 100644 --- a/src/juce_appframework/gui/components/juce_Component.cpp +++ b/src/juce_appframework/gui/components/juce_Component.cpp @@ -3371,7 +3371,7 @@ bool Component::hasKeyboardFocus (const bool trueIfChildIsFocused) const throw() || (trueIfChildIsFocused && isParentOf (currentlyFocusedComponent)); } -Component* Component::getCurrentlyFocusedComponent() throw() +Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() throw() { return currentlyFocusedComponent; } @@ -3403,7 +3403,7 @@ bool Component::isMouseOverOrDragging() const throw() return flags.mouseOverFlag || flags.draggingFlag; } -bool Component::isMouseButtonDownAnywhere() throw() +bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw() { return ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown(); } @@ -3450,7 +3450,7 @@ void Component::enableUnboundedMouseMovement (bool enable, } } -Component* Component::getComponentUnderMouse() throw() +Component* JUCE_CALLTYPE Component::getComponentUnderMouse() throw() { return componentUnderMouse; } diff --git a/src/juce_appframework/gui/components/juce_Component.h b/src/juce_appframework/gui/components/juce_Component.h index 8f9a752661..91d4b0fcd5 100644 --- a/src/juce_appframework/gui/components/juce_Component.h +++ b/src/juce_appframework/gui/components/juce_Component.h @@ -1051,7 +1051,7 @@ public: @returns the focused component, or null if nothing is focused. */ - static Component* getCurrentlyFocusedComponent() throw(); + static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw(); //============================================================================== /** Tries to move the keyboard focus to one of this component's siblings. @@ -1573,7 +1573,7 @@ public: @see isMouseButtonDown, ModifierKeys */ - static bool isMouseButtonDownAnywhere() throw(); + static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw(); /** Returns the mouse's current position, relative to this component. @@ -1586,7 +1586,7 @@ public: @returns the component or 0 if there isn't one. @see contains, getComponentAt */ - static Component* getComponentUnderMouse() throw(); + static Component* JUCE_CALLTYPE getComponentUnderMouse() throw(); /** Allows the mouse to move beyond the edges of the screen. diff --git a/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp b/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp index aa65acdd72..a55c95a931 100644 --- a/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp +++ b/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp @@ -42,7 +42,7 @@ static const float minFontHeight = 0.1f; static const float maxFontHeight = 10000.0f; static const float defaultFontHeight = 14.0f; -static String defaultSans, defaultSerif, defaultFixed; +static String defaultSans, defaultSerif, defaultFixed, fallbackFont; //============================================================================== @@ -168,6 +168,7 @@ void clearUpDefaultFontNames() throw() // called at shutdown by code in Typface defaultSans = String::empty; defaultSerif = String::empty; defaultFixed = String::empty; + fallbackFont = String::empty; } const String Font::getDefaultSansSerifFontName() throw() @@ -190,6 +191,16 @@ void Font::setDefaultSansSerifFontName (const String& name) throw() defaultSans = name; } +const String Font::getFallbackFontName() throw() +{ + return fallbackFont; +} + +void Font::setFallbackFontName (const String& name) throw() +{ + fallbackFont = name; +} + //============================================================================== void Font::setHeight (float newHeight) throw() { diff --git a/src/juce_appframework/gui/graphics/fonts/juce_Font.h b/src/juce_appframework/gui/graphics/fonts/juce_Font.h index 914938a1ac..bdb9de2b29 100644 --- a/src/juce_appframework/gui/graphics/fonts/juce_Font.h +++ b/src/juce_appframework/gui/graphics/fonts/juce_Font.h @@ -324,6 +324,18 @@ public: */ static const StringArray findAllTypefaceNames() throw(); + //============================================================================== + /** Returns the name of the typeface to be used for rendering glyphs that aren't found + in the requested typeface. + */ + static const String getFallbackFontName() throw(); + + /** Sets the (platform-specific) name of the typeface to use to find glyphs that aren't + available in whatever font you're trying to use. + */ + static void setFallbackFontName (const String& name) throw(); + + //============================================================================== juce_UseDebuggingNewOperator diff --git a/src/juce_appframework/gui/graphics/fonts/juce_Typeface.cpp b/src/juce_appframework/gui/graphics/fonts/juce_Typeface.cpp index 87307ed26e..4ae7ed47e0 100644 --- a/src/juce_appframework/gui/graphics/fonts/juce_Typeface.cpp +++ b/src/juce_appframework/gui/graphics/fonts/juce_Typeface.cpp @@ -302,9 +302,19 @@ const TypefaceGlyphInfo* Typeface::getGlyph (const juce_wchar character) throw() } if (CharacterFunctions::isWhitespace (character) && character != L' ') + { return getGlyph (L' '); + } else if (character != defaultCharacter) + { + const Font fallbackFont (Font::getFallbackFontName(), 10, 0); + Typeface* const fallbackTypeface = fallbackFont.getTypeface(); + + if (fallbackTypeface != 0 && fallbackTypeface != this) + return fallbackTypeface->getGlyph (character); + return getGlyph (defaultCharacter); + } return 0; }