Monday, July 03, 2006

Using Unicode

You can insert a number of special symbols into Mtext. In the Mtext editor select the symbol icon "@" on the formatting toolbar to get the symbols menu.

But what if you want to insert a symbol not in this list? There are a number of characters in most fonts that can be inserted with some good old fashioned arcane syntax. Notice all the \U+xxxx codes on the menu? Those are the Unicode values for the symbol.

Let's say you wanted to use the less than or equal to symbol. It's not available from AutoCAD's list of symbols, but it is defined in the ROMANS text font. It's Unicode value is \U+2264. How does one find this value? Use the Windows Character Map (Start > All Programs > Accessories > System Tools > Character Map).

In Character Map select the True Type equivalent of the AutoCAD font you're using in your drawing. Locate the desired symbol from the font; it's Unicode value is displayed in the lower left corner of the dialog.

In the Mtext Editor type this Unicode value where you wish to insert the symbol. The special symbol will appear immediately.

12 Comments:

At 3:22 PM , Anonymous Anonymous said...

Selecting the "other" option from the AutoCAD symbols list will automatically bring up the character map for the current font--no need to go through all the trouble of determining the appropriate unicode string.

 
At 7:38 PM , Blogger Ward Romberger said...

Ooh, very cool. I like that "Other" brings up the Character Map. However, I still like to enter the unicode strings manually. Using Copy/Paste from Character Map embeds unwanted formatting codes in my Mtext (plus the Copy/Paste required from Character Map isn't all that easier, nor intuitive).

String using Unicode:
10 \U+2264 20

String using Copy/Paste from Character Map:
10 {\Fromans|c0;\H0.9583x;\U+2220\fMS Shell Dlg|b0|i0|c0|p0;\H0.7391x; 20}

 
At 10:06 AM , Blogger Ragnar said...

Nice, but I've got an extra task. How to properly insert a Unicode character into a block attribute?
The architect sent us a plan header whith U+2259 in one attribute and says it displays correctly on his system but for us it doesn't work and the entire company is trying to figure it out ;-)

 
At 7:41 PM , Blogger Ward Romberger said...

We're quickly leaving my area of expertise. I know just enough of fonts to get my text and a couple of special characters to display. The best I can determine is that most US fonts (all that I personally examined) have no binding for uni-code character \U+2259. I've seen some references to that uni-code character being an "estimate" symbol (an equal sign with a caret above); however, I cannot verify that for you, nor tell you what true-type font may utilize this binding. Good luck finding it and, if you do, please do me the favor of reporting it here just to satisfy my curiosity.

 
At 8:29 PM , Blogger Ward Romberger said...

Well, lookee there, I found the symbol described above (\U+2259) in fonts ISOCPEUR and ISOCTEUR. Must be a European thing. Try setting the text style that the attribs use to one of these two fonts.

Good luck,
Ward
(still not an expert in this area.)

 
At 2:05 AM , Blogger Ragnar said...

I did find a font (Arial Unicode MS) that contains the desired symbol, but we haven't yet found a way to get the attribute to display properly - the block contains an attribute and an mText in the same style (Arial F), one displays correctly and one doesn't (we only get a square). One more problem: we're using AutoCadLT while the guys who sent us the header use the full version and claimed they remedied the problem by using a comment named "reload attributes" or something like that, but LT does not have that... I guess the Unicode implementation is still somewhat unfinished (like so many things in Acad... e.g. opening a drawing only to find some colors messed up (displayed as blue even though layer manager says they're white, and they also plot blue, but after closing and reopening the drawing everything works... a glitch that happens occasionally upon changing from mspace to pspace.)

Extra issue: just copying the "estimate" symbol from the character map does not work at all - either CTRL-V does nothing at all or it inserts stuff I never copied... just confirms my suspicions concerning Acad (both in 2006 and 2007).

For now we used a band aid approach inserting a few blanks in the block attrib and overlaying mText with the desired character. After plotting who can tell ;-)

 
At 9:32 PM , Blogger Ward Romberger said...

Probably the reason that the Mtext displays the symbol and the Attrib does not is that the font is not assigned to the Style used by the Attrib.

List the block and take note of the text style used by the Attrib. Now use the STYLE command to assign the font ISOCPEUR to that Style. Does your block Attrib now display the unicode character correctly?

The Mtext could very well have a font formatting code wrapped around the unicode character overriding the text style's font.

Complicated ain't it.

 
At 7:35 AM , Blogger Ragnar said...

Whoa, thanks, that did it! The style was assigned the font Arial instead of Arial Unicode MS. Changing it did the trick.
Now all I have to do is write a German "manual" how to do it for all the guys here.

BTW, do you have an idea how one could achieve a global style definition instead of having to edit the style separately in each file?

 
At 12:32 AM , Anonymous Anonymous said...

Good post, very useful. There is also a shareware tool that can be used to translate the Unicode \U+xxxx into readable Unicode text. This is specially useful for professional translators trying to translate an AutoCAD DXF drawing.
This is the link:
http://translationtospanish.com/cad/download.htm

 
At 9:34 PM , Anonymous Anonymous said...

This comment has been removed by a blog administrator.

 
At 12:43 PM , Anonymous Cialis said...

Great tutorial!

 
At 9:40 AM , Blogger Sarah said...

Has anyone tried to use unicode with arctext? I can't get any symbols to display with arctext?

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home