mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-15 00:24:19 +00:00
Android: Fixed a crash when painting a string that can't be represented as a UTF-16 string
This commit is contained in:
parent
0055d3f8f8
commit
6c08f04a8e
1 changed files with 4 additions and 2 deletions
|
|
@ -218,10 +218,12 @@ public:
|
|||
void getGlyphPositions (const String& text, Array<int>& glyphs, Array<float>& xOffsets) override
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
const int numChars = text.length();
|
||||
auto jtext = javaString (text);
|
||||
|
||||
const int numChars = env->GetStringLength (jtext.get());
|
||||
jfloatArray widths = env->NewFloatArray (numChars);
|
||||
|
||||
const int numDone = paint.callIntMethod (AndroidPaint.getTextWidths, javaString (text).get(), widths);
|
||||
const int numDone = paint.callIntMethod (AndroidPaint.getTextWidths, jtext.get(), widths);
|
||||
|
||||
HeapBlock<jfloat> localWidths (static_cast<size_t> (numDone));
|
||||
env->GetFloatArrayRegion (widths, 0, numDone, localWidths);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue