This partially reverts commit 555b667d22.
Using ComponentPeer::isShowing instead of ComponentPeer::isMinimised
inside Component::isShowing can cause problems when displaying OpenGL
components.
Specifically, OpenGL components use a ComponentMovementWatcher to
determine when they should be attached/detached from the parent window.
The ComponentMovementWatcher updates whenever a component visibility
change event is emitted, which happens in two cases:
- Component::setVisible is called on the OpenGL component or an ancestor
- ComponentPeer::handleMovedOrResized is called in response to a
minimisation state change
When handling either of these events, the ComponentMovementWatcher will
call Component::isShowing to determine whether or not the component is
really showing.
The problem is that the result of ComponentPeer::isShowing may change
independently of changes to the Component visiblity state or
ComponentPeer minimisation state, so the ComponentPeerWatcher might not
notify its listeners when a component is really shown/hidden.
One potential workaround would be for the ComponentPeer to send
notifications when the showing state of the window changes, so that the
ComponentMovementWatcher can forward those notifications. The main
problem with this approach is that on Windows, the window doesn't seem
to receive a message on hide/show, and it's not clear whether there
exists some other approach to detect a hide/show event.
If there were some event we could listen for on Windows, then we could
call Component::sendVisibilityChangeMessage in response to this event
and things would *likely* work at that point, but this may still have
unintended side-effect. As a result, I think the best approach to
restore the old behaviour is to revert the change to
Component::isShowing. The implementations of ComponentPeer::isShowing
have been left in place so that users can do still query the real
visibility state of native windows if necessary.
This behaviour, previously available in JUCE 7, was missing since the
JUCE 8 changes related to Unicode text drawing.
With this commit, words that are too long to fit in a line are again
broken up, with the caveat, that we can expect this approach to produce
quirks with bidirectional text. We don't expect that such a feature
could be satisfactorily provided for bidirectional text, so this is a
stopgap measure for legacy applications.
Previously, when attempting to create a font with a name different to
that of any font on the system, the returned typeface could be nullptr.
This could lead to crashes when attempting to use the typeface.
Now, if we fail to find a matching font using DirectWrite, we fall back
to the older LOGFONT and DC approach, which will generally locate a
usable typeface, though not necessarily an exact match.
The new behaviour more closely matches the behaviour of JUCE 7, which
would attempt to construct a DirectWrite typeface, but would fall back
to creating an HFONT on failure.
The main reason for removing this call is that this function is
deprecated, and is no longer needed now that we keep our own cache of
CTFonts that have been loaded from memory, and now that we no longer use
CoreText text layouts.
This also appears to fix an issue with garbled text which was
occasionally seen when different versions of the same font were
available, e.g. because differing versions of the font were
simultaneously embedded as BinaryData and installed on the system.
- Reject surrogate code points for all unicode encodings
- Prevent out of bounds access in some cases
- Move ASCII and UTF character validation functions to CharacterFunctions
- Add more unit tests