From: David on
Hi. I'm using a special font called Maestro, which contains musical symbols.
If I use Excel's char() function, I establish that one of the symbols I want
has ascii code 206.

Then I use DrawString on a WinForm, character 206 (0xCE) displays a
completely different character. Indeed, if I display all characters from
said font, none of them are the symbol I want - which does display in Excel,
so the symbol IS in the font.

This is presumably because of my regional settings or such? How can I force
a particular code set for Graphics to use??
From: Jeff Gaines on
On 07/12/2009 in message
<1CD53DEA-121F-4B5E-959A-6BF7D8DA307B(a)microsoft.com> David wrote:

>Hi. I'm using a special font called Maestro, which contains musical
>symbols.
> If I use Excel's char() function, I establish that one of the symbols I want
>has ascii code 206.
>
>Then I use DrawString on a WinForm, character 206 (0xCE) displays a
>completely different character. Indeed, if I display all characters from
>said font, none of them are the symbol I want - which does display in
>Excel,
>so the symbol IS in the font.
>
>This is presumably because of my regional settings or such? How can I force
>a particular code set for Graphics to use??

Are you sure you have set the correct font for the control you are painting?

--
Jeff Gaines Dorset UK
All things being equal, fat people use more soap
From: Patrice on
Double check you are using the same font (and to start with make sure to use
the same size, weight , style etc... than in Excel).

What if you try a character in the "Windgings" font to see if you have the
same problem (in which case we could try to repro and help) or if it seems
specific to this Maestro font ?

--
Patrice

"David" <David(a)discussions.microsoft.com> a �crit dans le message de groupe
de discussion : 1CD53DEA-121F-4B5E-959A-6BF7D8DA307B(a)microsoft.com...
> Hi. I'm using a special font called Maestro, which contains musical
> symbols.
> If I use Excel's char() function, I establish that one of the symbols I
> want
> has ascii code 206.
>
> Then I use DrawString on a WinForm, character 206 (0xCE) displays a
> completely different character. Indeed, if I display all characters from
> said font, none of them are the symbol I want - which does display in
> Excel,
> so the symbol IS in the font.
>
> This is presumably because of my regional settings or such? How can I
> force
> a particular code set for Graphics to use??


From: Peter Duniho on
David wrote:
> Hi. I'm using a special font called Maestro, which contains musical symbols.
> If I use Excel's char() function, I establish that one of the symbols I want
> has ascii code 206.
>
> Then I use DrawString on a WinForm, character 206 (0xCE) displays a
> completely different character. Indeed, if I display all characters from
> said font, none of them are the symbol I want - which does display in Excel,
> so the symbol IS in the font.
>
> This is presumably because of my regional settings or such? How can I force
> a particular code set for Graphics to use??

I'm not sure you can depend on Excel to tell you the character code. In
particular, .NET strings are Unicode, and so the CHAR() function in
Excel (which returns a value between 1 and 255) cannot work for all
Unicode characters.

If you want to know the exact Unicode character code for the symbol you
want, a better tool is the Character Map accessory in Windows. You can
select the font you're using, as well as the particular encoding where
appropriate (i.e. ASCII versus Unicode), and it will reliably show you
the exact character code in the encoding you're looking at for a given
glyph in the font.

You should, as others note, make sure that you are in fact using the
font you think you're using. But assuming you are, the problem may be
simply an issue of character encodings, with your code displaying a
different character from the font than you think you are.

For sure: if you are using the correct font, and the correct character
code, you will get the correct output.

Pete