Warning: when private is used in public, it can really suck

by Michael S. Kaplan, published on 2007/03/21 03:02 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/03/21/1924167.aspx

Jeffrey's question earlier today:

Hi experts,

My customer has a custom designed font with some special characters in the Private Use Area (PUA). He is having a problem when trying to paste these characters (as text) into a RichEdit control in his application. Basically the character that gets displayed in the RichEdit is not the one he pasted in even though the font in the RichEdit control is set to his font.

For example, if he pastes in character 0xF012 (which is an 'x' with a bar on top) from Notepad, he instead got a double-headed vertical arrow character, which we are not even convinced is from his font. A similar replacement seems to happen for most of his PUA characters.

This occurs on Windows XP, so RichEdit 4.1 we think.

Any ideas on this strange problem?

Well, I had my suspicions, but Murray pointed out the actual problem, and it actually relates to the way that SYMBOL FONTS map to the PUA, as I have discussed in previous posts like More than you ever wanted to know about CP_SYMBOL, Strangely Symbolic font issues, and 'Doctor, it hurts when I do this.' Well, don't do that!

The solution for dealing this over-eager helping out that RichEdit does with the PUA code points between U+f000 and U+f0ff (I would start the range at U+f020 but they apparently do this weird font behavior starting with U+f000.

Well, avoid that small section of the PUA if you want to use RichEdit, because even if they take out this functionality in the future there are going to be multiple existing versions that are going to do this.

Now I personally find this behavior to be inexcusably lame, and putting in such a a public contract for use of the PRIVATE USE AREA is just really ugly....

But at least we know why RichEdit is doing what it is....


This post brought to you by U+f020, a <Private Use> character

no comments

referenced by

2007/05/21 MS Word says PUA is EA/CJK? TISNF!

go to newer or older post, or back to index or month or day