diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp index 8ca7a801..b0a8328d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp @@ -298,11 +298,11 @@ void pyDynamicText::DrawTextW( int16_t x, int16_t y, std::wstring text ) // 2) clip // 3) just draw if ( fWrap ) - pMsg->DrawWrappedString(x,y,fWrapWidth,fWrapHeight,text.c_str()); + pMsg->DrawWrappedString(x,y,fWrapWidth,fWrapHeight,plString::FromWchar(text.c_str())); else if ( fClip ) - pMsg->DrawClippedString(x,y,fClipLeft,fClipTop,fClipRight,fClipBottom,text.c_str()); + pMsg->DrawClippedString(x,y,fClipLeft,fClipTop,fClipRight,fClipBottom,plString::FromWchar(text.c_str())); else - pMsg->DrawString(x,y,text.c_str()); + pMsg->DrawString(x,y,plString::FromWchar(text.c_str())); plgDispatch::MsgSend( pMsg ); // whoosh... off it goes } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp index de8b22b3..28044cf4 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp @@ -112,38 +112,24 @@ void plDynamicTextMsg::FrameRect( uint16_t left, uint16_t top, uint16_t right fColor = c; } -void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const char *text ) -{ - wchar_t *wString = hsStringToWString(text); - DrawString(x,y,wString); - delete [] wString; -} - -void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const wchar_t *text ) +void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const plString& text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds ); fCmd |= kDrawString; - fString = plString::FromWchar(text); + fString = text; fX = x; fY = y; } -void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ) -{ - wchar_t *wString = hsStringToWString(text); - DrawClippedString(x,y,clipLeft,clipTop,clipRight,clipBottom,wString); - delete [] wString; -} - -void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text ) +void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const plString& text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd |= kDrawClippedString; - fString = plString::FromWchar(text); + fString = text; fX = x; fY = y; @@ -153,20 +139,13 @@ void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clip fBottom = clipBottom; } -void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text ) -{ - wchar_t *wString = hsStringToWString(text); - DrawWrappedString(x,y,wrapWidth,wrapHeight,wString); - delete [] wString; -} - -void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text ) +void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const plString& text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd |= kDrawWrappedString; - fString = plString::FromWchar(text); + fString = text; fX = x; fY = y; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h index 9f800450..77c5de8d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h @@ -128,12 +128,9 @@ public: void SetLineSpacing( int16_t spacing ); void FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); void FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); - void DrawString( int16_t x, int16_t y, const char *text ); - void DrawString( int16_t x, int16_t y, const wchar_t *text ); - void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ); - void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text ); - void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text ); - void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text ); + void DrawString( int16_t x, int16_t y, const plString& text ); + void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const plString& text ); + void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const plString& text ); void DrawImage( int16_t x, int16_t y, plKey &image, bool respectAlpha = false ); void DrawClippedImage( int16_t x, int16_t y, plKey &image, uint16_t clipX, uint16_t clipY, uint16_t clipWidth, uint16_t clipHeight, bool respectAlpha = false ); void SetJustify( uint8_t justifyFlags );