Add Arabic text shaping support for chat functionality
This commit introduces Arabic text shaping in the chat application by adding `ArabicShaping.cpp` and `ArabicShaping.h` for handling contextual forms and visual reordering. The rendering logic in `ChatScreen.cpp` is updated to utilize this new functionality, adjusting cursor positions accordingly. Other UI components, including `UIControl_Base.cpp`, `UIControl_Label.cpp`, and `UIControl_SaveList.cpp`, are modified to ensure proper display of Arabic text. Additionally, `Font.cpp` is enhanced with methods for efficient rendering of pre-shaped text.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "UIControl.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\JavaMath.h"
|
||||
#include "..\..\..\Minecraft.World\ArabicShaping.h"
|
||||
|
||||
UIControl_Base::UIControl_Base()
|
||||
{
|
||||
@@ -32,13 +33,16 @@ void UIControl_Base::tick()
|
||||
//app.DebugPrintf("Calling SetLabel - '%ls'\n", m_label.c_str());
|
||||
m_bLabelChanged = false;
|
||||
|
||||
// Shape the text before sending to Iggy; m_label stays unshaped for future updates
|
||||
wstring shaped = shapeArabicText(m_label.getString());
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = (IggyUTF16*) m_label.c_str();
|
||||
stringVal.length = m_label.length();
|
||||
stringVal.string = (IggyUTF16*) shaped.c_str();
|
||||
stringVal.length = (int)shaped.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
|
||||
@@ -56,13 +60,16 @@ void UIControl_Base::setLabel(UIString label, bool instant, bool force)
|
||||
{
|
||||
m_bLabelChanged = false;
|
||||
|
||||
// Shape the text before sending to Iggy; m_label stays unshaped for future updates
|
||||
wstring shaped = shapeArabicText(m_label.getString());
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = (IggyUTF16*)m_label.c_str();
|
||||
stringVal.length = m_label.length();
|
||||
stringVal.string = (IggyUTF16*) shaped.c_str();
|
||||
stringVal.length = (int)shaped.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
|
||||
|
||||
Reference in New Issue
Block a user