Displaying ® symbol in Silverlight

人走茶凉 提交于 2019-12-23 09:58:07

问题


Folks!

I am trying to display ® and superscript TM symbols in my silverlight app. I want to save the text containing the symbols in a resx file.

Things i have tried:

  • Copy paste the ® symbol from any document to resx file. ® symbol gets displayed in the resx file. But, when running the silverlight app, xamlparseexception is thrown.

  • Use unicode text &#174 instead of ® symbol in the resx file. Same xamlparseexception thrown.

My resx file encoding is utf-8.

Appreciate your thoughts!

EDITED:
Incorrectly mentioned @ instead of ®.

Redbox in the snapshot is how the symbol gets displayed in Silverlight. Bluebox is how it needs to be displayed.

EDIT 2 and SOLUTION: The way the symbols are displayed are dependant on the font used. Also, displaying superscripts in Silverlight is a bit tricky. But, the simplest solution i found was to create the superscript text in Windows character map tool and copy paste it your app resource file.


回答1:


The size of the ® symbol varies with the font being used. Some fonts draw it as a superscript others draw it as a standard character. For example the "Lucida Sans Unicode" font treats it like a Superscript where as the "Lucida Grande" font draws it like a normal character. Hence you need to be careful which font you use to render it.

I'm seeing a case in point just as I write this. The text box where I'm writing this in SO has the ® character as a superscript whereas looking at the preview box below the character is normal size.



来源:https://stackoverflow.com/questions/1813645/displaying-symbol-in-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!