如何在任何字符上方添加变音符号(例如代字号)? [英] How do I add a diacritic (example a tilde) above any character?

查看:164
本文介绍了如何在任何字符上方添加变音符号(例如代字号)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

对于使用语音字符的应用程序,我需要能够使用不在Unicode表格中的变音符号字母,例如带有波浪号的w,或者拉丁语a用波浪号转过来。我在这里看过CodeProject(http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters),这个答案可以解决我的问题,但我试过制作调整该示例使用的类并使用波浪号测试字母w,但它不会产生结果。奇怪的是w与^是好的。我不明白为什么。有没有办法在任何字母上添加任何discritic?



谢谢

Antonio Barros



我尝试了什么:



我在这里看过,在CodeProject中(http://www.codeproject .com / Questions / 175452 / Dynamicly-add-diacritics-to-characters),一个可以解决我的问题的答案,但我已经尝试调整该示例使用的类并测试字母w与波浪号,但它没有产生结果。奇怪的是w和^是可以的。

解决方案

除了提供许多可用于语音表示的字符的Windows标准字体编码(Unicode)之外,还有是用于语音表示的特殊字体;我建议你使用其中一个:[ ^ ] :

语音字体 for  Windows 
由于引入了Unicode,最近的Windows计算机已经准备好了语音符号。请参阅http: // www.phon.ucl.ac.uk/home/wells/ipa-unicode.htm

用于一般用途的最佳Windows字体似乎是Times New Roman,Arial,Courier New和Segoe UI。 Windows 7 8 提供的版本包括IPA图表上的所有符号。其他有用的字体可用 免费下载来自 www.sil.org。




这是如何:

例如,'w'带有变音抑扬音:ŵ:ŵ ;使用代字号:w



这些字符的生成为小'w',后面跟着组合的变音符号扬声重音和代字号,代码点分别为0x0302和0x0303。



首先,不要搞砸了:其次是变音符号,而不是前缀。另外,请记住,在little-endian中(.NET字符串的内部表示是UTF-16LE),低字节首先出现; 0x0302和0x0303代码点以字节顺序2,3,3,3出现。但是,函数 System.Text.Encoding.GetBytes System.Text.Encoding.GetChars 处理:编码类(System.Text) [ ^ ]。



如果您不想在代码文件中插入Unicode文本,这些功能很有用:

Char.ConvertFromUtf32方法(Int32)(系统) [ ^ ],

Char.ConvertToUtf32方法(字符,字符)(系统) [ ^ ]。



在这里,重要的是要理解:UTF-32是唯一的UTF,它代表一个字符,因为这个字在数字上等于Unic ode代码点。它不适用于.NET字符,但使用.NET字符串或字符对。这是因为.NET字符并不总是真正的字符:有些代表来自代理对的低或高代理,所以是真正的Unicode字符(超出 BMP )表示为两个.NET字符。



另请参阅:

UTF-16 - 维基百科,免费的百科全书代理对),

Universal字符集字符 - 平面 - 维基百科,免费百科全书 for BMP )。



(不要误会我的意思:变音符号与代理对没有关系;对于变音符号,你只使用BMP ,除非主字符代码点超出它。我写了以前的字符来解释.NET UTF-32函数的用途,这些函数没有很好地解释我的Microsoft MSDN帮助。)



-SA

Hi!
I need, for an application that uses phonetic characters, to be able to have letters with diacritics that are not in the Unicode Tables, such as "w" with a tilde, or the latin "a" turned with a tilde. I've seen here, in CodeProject ("http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters"), an answer that could resolve my problem, but I've tried making an adjust to the class that that example uses and test the letter "w" with a tilde, but it didn't produces the result. Curiously "w" with "^" is ok. I can't understand why. Is there a way to add any discritic to any letter?

Thanks
Antonio Barros

What I have tried:

I've seen here, in CodeProject ("http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters"), an answer that could resolve my problem, but I've tried making an adjust to the class that that example uses and test the letter "w" with a tilde, but it didn't produces the result. Curiously "w" with "^" is ok.

解决方案

In addition to Windows standard font encoding (Unicode) providing many characters that can be used for phonetic representations, there are special fonts for phonetic representation; I suggest you use one of those: [^] :

Phonetic Fonts for Windows
Thanks to the introduction of Unicode, recent Windows computers come ready-equipped with phonetic symbols. See http://www.phon.ucl.ac.uk/home/wells/ipa-unicode.htm

The best Windows fonts for general use appear to be Times New Roman, Arial, Courier New, and Segoe UI. The versions supplied with Windows 7 and 8 include all the symbols on the IPA Chart. Other useful fonts are available for free download from www.sil.org.


"


This is how:
For example, 'w' with diacritical circumflex accent: ŵ; with tilde: w̃.

Those characters are produced as small 'w' followed by combined diacritical marks circumflex accent and tilde, code points 0x0302 and 0x0303, respectfully.

First of all, don't mess it up: followed by the diacritic, not prefixed by. Also, remember that in little-endian (internal representation of .NET string is UTF-16LE) lower byte comes first; 0x0302 and 0x0303 code point come in the byte order 2, 3, 3, 3. However, the function System.Text.Encoding.GetBytes and System.Text.Encoding.GetChars take care of that: Encoding Class (System.Text)[^].

If you don't want to insert Unicode text in code files, these functions are useful:
Char.ConvertFromUtf32 Method (Int32) (System)[^],
Char.ConvertToUtf32 Method (Char, Char) (System)[^].

Here, its important to understand: UTF-32 is the only UTF which represents a character as the word numerically equal to the Unicode code point. It does not work with .NET characters but with .NET strings or pairs of characters. This is because .NET characters are not always really characters: some represent either low or high surrogate from a surrogate pair, so a "real" Unicode character (beyond BMP) is represented as two .NET characters.

See also:
UTF-16 — Wikipedia, the free encyclopedia ( for surrogate pairs),
Universal Character Set characters — planes — Wikipedia, the free encyclopedia (for BMP).

(Don't get me wrong: the diacritical marks have nothing to do with surrogate pairs; with the diacritical, you only use BMP, unless the "main" character code point is beyond it. I wrote previous character to explain the purpose of .NET UTF-32 functions which are not well explained my Microsoft MSDN help.)

—SA


这篇关于如何在任何字符上方添加变音符号(例如代字号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆