diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_font.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 4 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_TTFont.cpp | 13 | ||||
-rw-r--r-- | source/blender/src/editfont.c | 10 |
4 files changed, 21 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index d1f569e3f16..33747eb35a3 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -31,6 +31,10 @@ #ifndef BKE_VFONT_H #define BKE_VFONT_H +#ifdef __cplusplus +extern "C" { +#endif + #include <wchar.h> struct VFont; @@ -65,7 +69,11 @@ int getselection(int *start, int *end); void chtoutf8(unsigned long c, char *o); void wcs2utf8s(char *dst, wchar_t *src); int wcsleninu8(wchar_t *src); -int utf8towchar_(wchar_t *w, char *c); +int utf8towchar(wchar_t *w, char *c); + +#ifdef __cplusplus +} +#endif #endif diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 4b4704d8ba8..09c93962990 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -179,7 +179,7 @@ only a single input character is consumed. */ -int utf8towchar_(wchar_t *w, char *c) +int utf8towchar(wchar_t *w, char *c) { int len=0; @@ -661,7 +661,7 @@ struct chartrans *text_to_curve(Object *ob, int mode) utf8len = utf8slen(cu->str); tmp = mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); - utf8towchar_(mem, cu->str); + utf8towchar(mem, cu->str); // Count the wchar_t string length slen = wcslen(mem); diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp index a34ab39365d..e8f2b82f970 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.cpp +++ b/source/blender/ftfont/intern/FTF_TTFont.cpp @@ -31,10 +31,7 @@ #include <locale.h> #include "libintl.h" #include "BLI_blenlib.h" - -extern "C" { #include "BKE_font.h" -} #include "../FTF_Settings.h" @@ -292,9 +289,9 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag) /* note; this utf8towchar() function I totally don't understand... without using translations it removes special characters completely. So, for now we just skip that then. (ton) */ if (FTF_USE_GETTEXT & flag) - utf8towchar_(wstr, gettext(str)); + utf8towchar(wstr, gettext(str)); else if (FTF_INPUT_UTF8 & flag) - utf8towchar_(wstr, str); + utf8towchar(wstr, str); glGetFloatv(GL_CURRENT_COLOR, color); @@ -351,7 +348,7 @@ float FTF_TTFont::GetStringWidth(char* str, unsigned int flag) removes special characters completely. So, for now we just skip that then. (ton) */ if (FTF_USE_GETTEXT & flag) { - len=utf8towchar_(wstr, gettext(str)); + len=utf8towchar(wstr, gettext(str)); if(mode == FTF_PIXMAPFONT) { return font->Advance(wstr); @@ -377,9 +374,9 @@ void FTF_TTFont::GetBoundingBox(char* str, float *llx, float *lly, float *llz, f int len=0; if (FTF_USE_GETTEXT & flag) - len=utf8towchar_(wstr,gettext(str)); + len=utf8towchar(wstr,gettext(str)); else - len=utf8towchar_(wstr,str); + len=utf8towchar(wstr,str); font->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz); } diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index 5ec0399a426..cb245867c89 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -319,7 +319,7 @@ void load_3dtext_fs(char *file) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar_(mem, strp); + tmplen = utf8towchar(mem, strp); wcscat(textbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -686,7 +686,7 @@ void do_textedit(unsigned short event, short val, unsigned long _ascii) if(cu->len+filelen<MAXTEXT) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar_(mem, strp); + tmplen = utf8towchar(mem, strp); wcscat(textbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -969,7 +969,7 @@ void paste_unicodeText(char *filename) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar_(mem, strp); + tmplen = utf8towchar(mem, strp); // mem =utf8s2wc(strp); wcscat(textbuf, mem); MEM_freeN(mem); @@ -1033,7 +1033,7 @@ void paste_editText(void) if(cu->len+filelen<MAXTEXT) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar_(mem, strp); + tmplen = utf8towchar(mem, strp); wcscat(textbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -1064,7 +1064,7 @@ void make_editText(void) if(oldstr==NULL) oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf"); // Convert the original text to wchar_t - utf8towchar_(textbuf, cu->str); + utf8towchar(textbuf, cu->str); wcscpy(oldstr, textbuf); cu->len= wcslen(textbuf); |