结合Grapheme Joiner在iOS的Cocoa中不起作用?

前端之家收集整理的这篇文章主要介绍了结合Grapheme Joiner在iOS的Cocoa中不起作用?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这个字符串:

[NSString stringWithFormat:@"%C%C%C%C",0x31,0x34f,0x32,0x20dd]

应该在两个角色周围显示为12圈. 0x34f是Combining Grapheme Joiner,0x20dd是组合圆.

显示的是12,圆圈只有2.木匠似乎被忽略了.有没有办法让组合字形连接器工作?

解决方法

不建议使用Combining Grapheme Joiner:

从Unicode标准,第16.2章布局控件 – 组合字形连接器

Rendering. For rendering,the combining grapheme joiner is invisible.
However,some older implementations may treat a sequence of grapheme
clusters linked by combining grapheme joiners as a single unit for the
application of enclosing combining marks. For more information on
grapheme clusters,see Unicode Technical Report #29,“Unicode Text
Segmentation.” For more information on enclosing combining marks,see
Section 3.11,Normalization Forms.

从第3.6章组合

It should be noted,however,that older implementations may have
supported the application of an enclosing combining mark to an entire
Indic consonant conjunct or to a sequence of grapheme clusters linked
together by combining grapheme joiners. Such an approach has a number
of technical problems and leads to interoperability defects,so it is
strongly recommended that implementations do not follow it.

http://unicode.org/faq/char_combmark.html#19

Q: Is it possible to apply a diacritic or combining enclosing mark to a sequence of more than one (non-combining) character?

  
  答:不,除了故意设计用于双字母序列的“双变音符号”之外,例如: U 035D组合双倍的BREVE. ZWJ(U 200D ZERO WITDH JOINER)和CGJ(U 034F COMBINING GRAPHEME JOINER)都不会将任何后续组合字符的范围受影响的方式“混合”字符.要将像“Esc”这样的字符序列放入类似于U 20E3 COMBINING ENCLOSING KEYCAP的字符序列中,您必须使用更高级别的协议. [KP]

猜你在找的cocoa相关文章