mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-01 03:10:06 +00:00
Added some assertions to catch use of some Font methods on background threads
This commit is contained in:
parent
a45855f7c3
commit
66fa7e7411
1 changed files with 8 additions and 0 deletions
|
|
@ -625,6 +625,10 @@ int Font::getStringWidth (const String& text) const
|
|||
|
||||
float Font::getStringWidthFloat (const String& text) const
|
||||
{
|
||||
// This call isn't thread-safe when there's a message thread running
|
||||
jassert (MessageManager::getInstanceWithoutCreating() == nullptr
|
||||
|| MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager());
|
||||
|
||||
auto w = getTypeface()->getStringWidth (text);
|
||||
|
||||
if (font->kerning != 0.0f)
|
||||
|
|
@ -635,6 +639,10 @@ float Font::getStringWidthFloat (const String& text) const
|
|||
|
||||
void Font::getGlyphPositions (const String& text, Array<int>& glyphs, Array<float>& xOffsets) const
|
||||
{
|
||||
// This call isn't thread-safe when there's a message thread running
|
||||
jassert (MessageManager::getInstanceWithoutCreating() == nullptr
|
||||
|| MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager());
|
||||
|
||||
getTypeface()->getGlyphPositions (text, glyphs, xOffsets);
|
||||
|
||||
if (auto num = xOffsets.size())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue