开发者

no uni code support in TTSearchlightLabel

开发者 https://www.devze.com 2023-03-09 13:32 出处:网络
the TTSearchlightLabel class in the Three20 framework ignores whitespaces and latin letters. Its render code looks like this :

the TTSearchlightLabel class in the Three20 framework ignores whitespaces and latin letters. Its render code looks like this :

CGContextSelectFont(context, [_font.fontName UTF8String], _font.pointSize, kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetTextMatrix(cont开发者_Python百科ext, CGAffineTransformScale(CGAffineTransformIdentity, 1, -1));
CGContextSetFillColorWithColor(context, _textColor.CGColor);
CGContextShowTextAtPoint(context, x, y, [self.text UTF8String], self.text.length);

I am not very familiar with this low level rendering but did somebody get rid of this ? I tried also kCGEncodingFontSpecific but its getting worst even.

I guess the issue is not really fixable so quickly, is there an alternative to have this kind of text effects ?

Thanks a lot, Guenter


The documentation for CGContextSelectFont’s encoding parameter says:

textEncoding A CGTextEncoding value that specifies the encoding used for the font. For a description of the available values, see “CGTextEncoding”.

The possible values are:

kCGEncodingFontSpecific The built-in encoding of the font.

and

kCGEncodingMacRoman The MacRoman encoding. MacRoman is an ASCII variant originally created for use in the Mac OS, in which characters 127 and lower are ASCII, and characters 128 and higher are non-English characters and symbols.

Change the parameter to kCGEncodingFontSpecific and it should display correctly.

0

精彩评论

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