2 * psychlops_g_font_OSX.h
3 * Psychlops Standard Library (Universal)
5 * Last Modified 2008/09/12 by Kenchi HOSOKAWA
6 * (C) 2008 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
9 #include "../../core/graphic/psychlops_g_font.h"
10 #include "../../core/graphic/psychlops_g_font.h"
11 #include <CoreFoundation/CoreFoundation.h>
12 #include "../../core/ApplicationInterfaces/psychlops_code_exception.h"
16 Font Font::default_font(20, normal_weight, normal_style, L"HiraKakuPro-W3");
18 std::wstring LocalEncodingtoWCHAR(const char* s, int length) {
19 char *c = new char[length+1];
20 memcpy(c+1, s, length);
22 CFStringRef str = CFStringCreateWithBytes(kCFAllocatorDefault, (const UInt8*)(c), length+1, kCFStringEncodingMacJapanese, false);
24 if(str==NULL) throw new Exception("fail: ShiftJIStoWCHAR");
26 result.resize(CFStringGetLength(str));
27 #if defined(PANTHER) && ( PANTHER ==1 )
28 CFStringGetCString(str, (char*)result.data(), result.length()*4, kCFStringEncodingUnicode);
30 CFStringGetCString(str, (char*)result.data(), result.length()*4, kCFStringEncodingUTF32LE);
34 std::wstring LocalEncodingtoWCHAR(const char* c) {
38 return LocalEncodingtoWCHAR(c, i);
41 } /* <- namespace Psycholops */