开发者

CoreGraphics - Special characters not drawn correctly

开发者 https://www.devze.com 2023-04-02 03:16 出处:网络
I am drawing an image using CoreGraphics and can\'t get the €-sign displaying correctly.. The dollar sign works fine, however. I have tried it using different fonts but same problem, my guess now i

I am drawing an image using CoreGraphics and can't get the €-sign displaying correctly..

The dollar sign works fine, however. I have tried it using different fonts but same problem, my guess now is that there is an encoding problem of some sort, but I still cant get it working correctly.

Here is my code that does the drawing:

context.SelectFont (font.FamilyName, font.PointSize, CGTextEncoding.MacRoman);
context.SetFillColorWithColor (color.CGColor);
context.SetTextDrawingMode (CGTextDrawingMode.Fill);
context.SetShouldAntialias (antiAlias);
context.ShowTextAtPoint (position.X, position.Y,text);

Anything that can point me in the right direction is appreci开发者_StackOverflowated.


The "euro" sign is a bit more recent than other characters but, even if defined in MacRoman, I could not get CoreGraphics to display it properly with ShowTextAtPoint (I suspect an encoding issue).

However it works fine if you use UIKit instead of CoreGraphics, see Q&A: no german umlaute in CGBitmapContext for the sample code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号