Merge branch 'develop' into 8.1.0-Dev
This commit is contained in:
@@ -49,8 +49,8 @@ namespace lime {
|
||||
int GetAscender ();
|
||||
int GetDescender ();
|
||||
wchar_t *GetFamilyName ();
|
||||
int GetGlyphIndex (char* character);
|
||||
void* GetGlyphIndices (bool useCFFIValue, char* characters);
|
||||
int GetGlyphIndex (const char* character);
|
||||
void* GetGlyphIndices (bool useCFFIValue, const char* characters);
|
||||
void* GetGlyphMetrics (bool useCFFIValue, int index);
|
||||
int GetHeight ();
|
||||
int GetNumGlyphs ();
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
DEFINE_KIND (k_finalizer);
|
||||
|
||||
@@ -175,6 +176,54 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value wstring_to_value (std::wstring* val) {
|
||||
|
||||
if (val) {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
return alloc_wstring (val->c_str ());
|
||||
#else
|
||||
std::string _val = std::string (val->begin (), val->end ());
|
||||
return alloc_string (_val.c_str ());
|
||||
#endif
|
||||
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
vbyte* wstring_to_vbytes (std::wstring* val) {
|
||||
|
||||
if (val) {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
int size = std::wcslen (val->c_str ());
|
||||
char* result = (char*)malloc (size + 1);
|
||||
std::wcstombs (result, val->c_str (), size);
|
||||
result[size] = '\0';
|
||||
return (vbyte*)result;
|
||||
#else
|
||||
std::string _val = std::string (val->begin (), val->end ());
|
||||
int size = std::strlen (_val.c_str ());
|
||||
char* result = (char*)malloc (size + 1);
|
||||
std::strncpy (result, _val.c_str (), size);
|
||||
result[size] = '\0';
|
||||
return (vbyte*)result;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_application_create () {
|
||||
|
||||
Application* application = CreateApplication ();
|
||||
@@ -687,7 +736,7 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
value _path = alloc_wstring (path->c_str ());
|
||||
value _path = wstring_to_value (path);
|
||||
delete path;
|
||||
return _path;
|
||||
|
||||
@@ -720,13 +769,9 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
int size = std::wcslen (path->c_str ());
|
||||
char* result = (char*)malloc (size + 1);
|
||||
std::wcstombs (result, path->c_str (), size);
|
||||
result[size] = '\0';
|
||||
vbyte* _path = wstring_to_vbytes (path);
|
||||
delete path;
|
||||
|
||||
return (vbyte*)result;
|
||||
return _path;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -757,7 +802,7 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
value _path = alloc_wstring (path->c_str ());
|
||||
value _path = wstring_to_value (path);
|
||||
delete path;
|
||||
return _path;
|
||||
|
||||
@@ -790,13 +835,9 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
int size = std::wcslen (path->c_str ());
|
||||
char* result = (char*)malloc (size + 1);
|
||||
std::wcstombs (result, path->c_str (), size);
|
||||
result[size] = '\0';
|
||||
vbyte* _path = wstring_to_vbytes (path);
|
||||
delete path;
|
||||
|
||||
return (vbyte*)result;
|
||||
return _path;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -830,7 +871,8 @@ namespace lime {
|
||||
|
||||
for (int i = 0; i < files.size (); i++) {
|
||||
|
||||
val_array_set_i (result, i, alloc_wstring (files[i]->c_str ()));
|
||||
value _file = wstring_to_value (files[i]);
|
||||
val_array_set_i (result, i, _file);
|
||||
delete files[i];
|
||||
|
||||
}
|
||||
@@ -864,12 +906,8 @@ namespace lime {
|
||||
|
||||
for (int i = 0; i < files.size (); i++) {
|
||||
|
||||
int size = std::wcslen (files[i]->c_str ());
|
||||
char* _file = (char*)malloc (size + 1);
|
||||
std::wcstombs (_file, files[i]->c_str (), size);
|
||||
_file[size] = '\0';
|
||||
|
||||
*resultData++ = (vbyte*)_file;
|
||||
vbyte* _file = wstring_to_vbytes (files[i]);
|
||||
*resultData++ = _file;
|
||||
delete files[i];
|
||||
|
||||
}
|
||||
@@ -899,7 +937,7 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
value _path = alloc_wstring (path->c_str ());
|
||||
value _path = wstring_to_value (path);
|
||||
delete path;
|
||||
return _path;
|
||||
|
||||
@@ -932,13 +970,9 @@ namespace lime {
|
||||
|
||||
if (path) {
|
||||
|
||||
int size = std::wcslen (path->c_str ());
|
||||
char* result = (char*)malloc (size + 1);
|
||||
std::wcstombs (result, path->c_str (), size);
|
||||
result[size] = '\0';
|
||||
vbyte* _path = wstring_to_vbytes (path);
|
||||
delete path;
|
||||
|
||||
return (vbyte*)result;
|
||||
return _path;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -3659,7 +3659,7 @@ namespace lime {
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_effecti, _TCFFIPOINTER _I32 _I32);
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_effectiv, _TCFFIPOINTER _I32 _ARR);
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_enable, _I32);
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _DYN);
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_filteri, _TCFFIPOINTER _I32 _I32);
|
||||
DEFINE_HL_PRIM (_VOID, hl_al_filterf, _TCFFIPOINTER _I32 _F32);
|
||||
DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_aux, _NO_ARG);
|
||||
DEFINE_HL_PRIM (_TCFFIPOINTER, hl_al_gen_buffer, _NO_ARG);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define IS_IN_RANGE(c, f, l) (((c) >= (f)) && ((c) <= (l)))
|
||||
|
||||
|
||||
unsigned long readNextChar (char*& p)
|
||||
unsigned long readNextChar (const char*& p)
|
||||
{
|
||||
// TODO: since UTF-8 is a variable-length
|
||||
// encoding, you should pass in the input
|
||||
@@ -33,7 +33,8 @@ unsigned long readNextChar (char*& p)
|
||||
// can determine if a malformed UTF-8
|
||||
// sequence would exceed the end of the buffer...
|
||||
|
||||
unsigned char c1, c2, *ptr = (unsigned char*) p;
|
||||
const unsigned char* ptr = (const unsigned char*) p;
|
||||
unsigned char c1, c2;
|
||||
unsigned long uc = 0;
|
||||
int seqlen;
|
||||
|
||||
@@ -792,7 +793,7 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
int Font::GetGlyphIndex (char* character) {
|
||||
int Font::GetGlyphIndex (const char* character) {
|
||||
|
||||
long charCode = readNextChar (character);
|
||||
|
||||
@@ -801,7 +802,7 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void* Font::GetGlyphIndices (bool useCFFIValue, char* characters) {
|
||||
void* Font::GetGlyphIndices (bool useCFFIValue, const char* characters) {
|
||||
|
||||
if (useCFFIValue) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user