1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00
This commit is contained in:
jules 2007-10-29 18:13:03 +00:00
parent 2a4fb4fd6b
commit 3230a03e33
5 changed files with 40 additions and 7 deletions

View file

@ -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;
}

View file

@ -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.

View file

@ -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()
{

View file

@ -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

View file

@ -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;
}