0
使用CGContextSelectFont繪製到位圖,但使用某種編碼。使用其他語言時,這不起作用。基於當前語言選擇編碼的推薦方法是什麼?請注意,本地化工作正常。如何使用CGContextSelectFont選擇基於當前語言的編碼?
CGContextDrawImage(context, rect, image.CGImage);
NSString *temp = [[NSString alloc] initWithFormat:@"%@%@",[Localization string:@"WaitingForDownloadFor"],title];
const char *text = [temp UTF8String];
CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); //*** line in question
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetRGBFillColor(context, 1, 1, 1, 1);
CGContextShowTextAtPoint(context, 10, h/2, text, strlen(text));
通常,Mac OS X和iOS中的所有字符串都是UTF-8。看到[這個問題](http://stackoverflow.com/questions/275437/unicode-character-not-showing)。 – 2011-07-14 14:27:44
這是真正回答上面的代碼.... – ort11