Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages
Started by Renald Yazmir
Wed, 25 Jul 2007 17:10
Output special symbol '�'
Author: Renald Yazmir
Date: Wed, 25 Jul 2007 17:10
Date: Wed, 25 Jul 2007 17:10
24 lines
1569 bytes
1569 bytes
Hello, I am trying to output a diameter symbol '�' I defined it as #define DIAMETER_SYMBOL '�' and then I strcpy or strcat it to my output text. It works well. But on some computers diameter symbol is not recognized by the default font. It appears as something else. My guess is that default font on that computer does not support this character. Is there any function to map this diameter symbol to any font? What must be set on programmatically so that I do not depend on the default font. Or any other solution. Thank you Rony
Re: Output special symbol 'ø'
Author: Asger Jorgensen
Date: Thu, 26 Jul 2007 00:51
Date: Thu, 26 Jul 2007 00:51
22 lines
1454 bytes
1454 bytes
Hi Renald I don't know what You should do, but it's not a symbol for diameter You are using it is actually a Danish character and that is probably why not all computer have it in their default font. It is part of Codepage 850 alt + 233 ø alt + 235 Ø ISO-8859-1 alt + 0216 Ø Ø alt + 0248 ø ø The corect symbol for diameter is part of the symbolfont and have the code 0xC6. You can use charmap.exe to find it Kind regards Asger
Re: Output special symbol '�'
Author: Bob Gonder
Date: Thu, 26 Jul 2007 13:49
Date: Thu, 26 Jul 2007 13:49
14 lines
1269 bytes
1269 bytes
Asger Jorgensen wrote: > You are using it is actually >a Danish character and that is probably why not all >computer have it in their default font. Looks Greek to me. Right next to alpha beta delta pi and epsilon Theta come to mind >It is part of >Codepage 850 >alt + 233 � >alt + 235 �
Re: Output special symbol 'ø'
Author: Alan Bellingham
Date: Thu, 26 Jul 2007 14:19
Date: Thu, 26 Jul 2007 14:19
22 lines
1762 bytes
1762 bytes
Bob Gonder <notbg@notmindspring.invalid> wrote: >Looks Greek to me. >Right next to alpha beta delta pi and epsilon >Theta come to mind > >>It is part of >>Codepage 850 >>alt + 233 � >>alt + 235 � It theta came to mind, it should be told that it was unwanted and be ordered to go away again. Theta is a tall oval with a horizontal line. A circle with an oblique line through it would be phi. But that's assuming you're using that character set. In the Windows 8859-1 character set, the closest is the 216/248 pair of characters. Alan Bellingham -- Team Browns ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Re: Output special symbol 'ø'
Author: Asger Jorgensen
Date: Thu, 26 Jul 2007 14:37
Date: Thu, 26 Jul 2007 14:37
31 lines
2030 bytes
2030 bytes
Hi Bob In article <vc9ha3tp27t3c9g0p746tdnrs1qu5plr51@4ax.com>, notbg@notmindspring.invalid says... > Asger Jorgensen wrote: > > > You are using it is actually > >a Danish character and that is probably why not all > >computer have it in their default font. > > Looks Greek to me. > Right next to alpha beta delta pi and epsilon > Theta come to mind Theta is close, You just have to turn it 45 degrees counter clock and then make the line a little bit longer.;-) No it is Danish, believe me I've had to deal with it all my programming life.. All english letter You can get from Uppet to lower case by adding 32 ( as You know ), but thats not the case with the Danish characters, and they are not even in the right order in the codepage, that sucks.. for refference: greek alphabet: http://deanofstudents.utexas.edu/gle/images/greek_alphabet.gif danish alphabet: http://www.speakdanish.dk/images/alphabet.gif kind regards Asger
Re: Output special symbol '�'
Author: David M
Date: Fri, 27 Jul 2007 01:55
Date: Fri, 27 Jul 2007 01:55
62 lines
2890 bytes
2890 bytes
>Is there any function to map this diameter symbol to any font?
>What must be set on programmatically so that I do not depend on the default
>font.
The best thing to do would be to use the Unicode character (U+00D8 for the
capital, U+00F8 for lowercase) and map it into something useable at runtime.
Note that there's no guarantee that a Unicode character really can be mapped
to a character in a specific codepage, so you may want to have a fallback
character to use in the worst case (eg, 'd' or something.)
I'd suggest you look at using ::WideCharToMultiByte, probably passing in
CP_THREAD_ACP for the codepage. For example, using a buffer called szAnsi
large enough to hold the conversion results (note it's a string, not a
character, even if in practice here you're only converting one character),
const WideString strSymbol(static_cast<wchar_t>(0xF8));
int iSize(WideCharToMultiByte(CP_THREAD_ACP, 0, strSymbol.c_bstr(), 1,
szAnsi, iBUFFER_SIZE, NULL, NULL));
if (iSize == 0) {
// conversion failed, return your fallback character
} else {
// return a std::string or AnsiString based on szAnsi
}
Codegear will be bringing out a Unicode-enabled VCL next year, so soon stuff
like this will be a thing of the past.
Hope this helps,
Cheers,
David
"Renald Yazmir" <renald@partmaker.com> wrote in message
news:46a775e8$1@newsgroups.borland.com...
> Hello,
>
> I am trying to output a diameter symbol '�'
>
> I defined it as
>
> #define DIAMETER_SYMBOL '�'
> and then I strcpy or strcat it to my output text. It works well.
>
> But on some computers diameter symbol is not recognized by the default
> font. It appears as
> something else. My guess is that default font on that computer does not
> support this character.
> Is there any function to map this diameter symbol to any font?
>
> What must be set on programmatically so that I do not depend on the
> default font.
> Or any other solution.
>
>
>
> Thank you
>
> Rony
>
>
Re: Output special symbol '�'
Author: David M
Date: Fri, 27 Jul 2007 02:07
Date: Fri, 27 Jul 2007 02:07
89 lines
4176 bytes
4176 bytes
Just replying to myself - a simpler way might be to use the \x escape
sequence in a string (I was reminded of this just now, it's in a comment
about five threads down!) and then painting it using TextOut or something.
But I'm fairly sure this only works in a Unicode / widechar string literal.
(I can't find anything about it in the Borland help, only MSDN, so I'm
guessing as to the behaviour using BC++.)
If you're using the VCL for output you still need to convert your Unicode
strings to ANSI in the right codepage, as my first post discussed. You
could cheat and use a Unicode-aware VCL control too, there are some quite
good third-party ones.
Finally I think assigning a WideString to an AnsiString performs some kind
of conversion, but I don't know the details. I'm pretty certain whatever it
does is not overly reliable and doing it manually gives better results, but
I honestly don't know.
Cheers,
David
"David M" <vintagedave@gmail.com> wrote in message
news:46a95084@newsgroups.borland.com...
> >Is there any function to map this diameter symbol to any font?
>>What must be set on programmatically so that I do not depend on the
>>default font.
>
> The best thing to do would be to use the Unicode character (U+00D8 for the
> capital, U+00F8 for lowercase) and map it into something useable at
> runtime. Note that there's no guarantee that a Unicode character really
> can be mapped to a character in a specific codepage, so you may want to
> have a fallback character to use in the worst case (eg, 'd' or something.)
>
> I'd suggest you look at using ::WideCharToMultiByte, probably passing in
> CP_THREAD_ACP for the codepage. For example, using a buffer called szAnsi
> large enough to hold the conversion results (note it's a string, not a
> character, even if in practice here you're only converting one character),
>
> const WideString strSymbol(static_cast<wchar_t>(0xF8));
> int iSize(WideCharToMultiByte(CP_THREAD_ACP, 0, strSymbol.c_bstr(), 1,
> szAnsi, iBUFFER_SIZE, NULL, NULL));
> if (iSize == 0) {
> // conversion failed, return your fallback character
> } else {
> // return a std::string or AnsiString based on szAnsi
> }
>
> Codegear will be bringing out a Unicode-enabled VCL next year, so soon
> stuff like this will be a thing of the past.
>
> Hope this helps,
>
> Cheers,
>
> David
>
>
> "Renald Yazmir" <renald@partmaker.com> wrote in message
> news:46a775e8$1@newsgroups.borland.com...
>> Hello,
>>
>> I am trying to output a diameter symbol '�'
>>
>> I defined it as
>>
>> #define DIAMETER_SYMBOL '�'
>> and then I strcpy or strcat it to my output text. It works well.
>>
>> But on some computers diameter symbol is not recognized by the default
>> font. It appears as
>> something else. My guess is that default font on that computer does not
>> support this character.
>> Is there any function to map this diameter symbol to any font?
>>
>> What must be set on programmatically so that I do not depend on the
>> default font.
>> Or any other solution.
>>
>>
>>
>> Thank you
>>
>> Rony
>>
>>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads