Skip to content

Commit 8de1fe0

Browse files
committed
feature(unicode): Implement UTF16 support with ICU4C.
1 parent bd00fa1 commit 8de1fe0

File tree

280 files changed

+2973
-2746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+2973
-2746
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ IDL_*.loc
5858
/.cache
5959
.clang-format
6060
/.vscode
61+
/.vs
6162
/build*

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ if(WIN32)
7777
endif()
7878

7979
include(dx9)
80+
81+
option(W3D_BUILD_OPTION_ICU "Build with ICU." OFF)
82+
add_feature_info(ICUBuild W3D_BUILD_OPTION_ICU "Build OpenW3D with ICU")
83+
84+
if(W3D_BUILD_OPTION_ICU)
85+
include(icu)
86+
endif()
87+
else()
88+
set(W3D_BUILD_OPTION_ICU ON)
89+
include(icu)
8090
endif()
8191

8292
include(gamespy)

Code/BinkMovie/subtitle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void SubTitleClass::Set_RGB_Color(
135135
*
136136
******************************************************************************/
137137

138-
void SubTitleClass::Set_Caption(wchar_t* string)
138+
void SubTitleClass::Set_Caption(unichar_t* string)
139139
{
140140
// Release existing caption
141141
if (mCaption != NULL) {
@@ -145,12 +145,12 @@ void SubTitleClass::Set_Caption(wchar_t* string)
145145

146146
// Make a copy of caption
147147
if (string != NULL) {
148-
size_t length = wcslen(string);
149-
mCaption = new wchar_t[length + 1];
148+
size_t length = u_strlen(string);
149+
mCaption = new unichar_t[length + 1];
150150
WWASSERT(mCaption != NULL);
151151

152152
if (mCaption != NULL) {
153-
wcscpy(mCaption, string);
153+
u_strcpy(mCaption, string);
154154
}
155155
}
156156
}

Code/BinkMovie/subtitle.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#include "always.h"
4545
#include "wwdebug.h"
46-
#include <wchar.h>
46+
#include "unichar.h"
4747

4848
class SubTitleClass
4949
{
@@ -95,18 +95,18 @@ class SubTitleClass
9595
Alignment Get_Alignment(void) const { return mAlignment; }
9696

9797
// Set the caption text
98-
void Set_Caption(wchar_t* string);
98+
void Set_Caption(unichar_t* string);
9999

100100
// Retrieve the caption text
101-
const wchar_t* Get_Caption(void) const { return mCaption; }
101+
const unichar_t* Get_Caption(void) const { return mCaption; }
102102

103103
private:
104104
unsigned int mTimeStamp;
105105
unsigned int mDuration;
106106
unsigned int mRGBColor;
107107
int mLinePosition;
108108
Alignment mAlignment;
109-
wchar_t* mCaption;
109+
unichar_t* mCaption;
110110
};
111111

112112
#endif // _SUBTITLE_H_

Code/BinkMovie/subtitlemanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void SubTitleManagerClass::Draw_Sub_Title(const SubTitleClass* subtitle)
314314

315315
Renderer.Reset();
316316

317-
const wchar_t* string = subtitle->Get_Caption();
317+
const unichar_t* string = subtitle->Get_Caption();
318318

319319
int w,h,bits;
320320
bool windowed;

0 commit comments

Comments
 (0)