Re: [Q]How to display Tahoma italic font
- From: "Johnny" <johnny194@xxxxxxxxxxx>
- Date: 16 May 2006 01:46:12 -0700
Thanks John and sorry that i forgot to describe more clearly.
First, the improper display is not that the middle italic letters
overlap the right hand normal letters, instead, it is that the middle
right hand normal letters overlap the last italic letter.
And what troubles me is that:
1. this program works well for other TT fonts except for the following:
"Arial Black"
"Comic Sans MS"
"Haettenschweiler"
"Impact"
"Lucida Console"
"Microsoft Sans Serif"
"Symbol"
"Tahoma"
"Times New Roman MT Extra Bold"
2. Instead of substracting the cWidth from the Xincrement, if I add the
cWidth, it will ok, but for other TT fonts, there are additional spaces
on the canvas. And I can't find anything to support adding the cWidth,
most of them suggest substracting like yours.
Thank you again and please find my comments inlined.
John Carson wrote:
"Johnny" <johnny194@xxxxxxxxxxx> wrote in message*snip*
In fact, I don't know how to start out with Unicode. :( would you mindLPSTR lpszString = "dd";
int stringLen = strlen(lpszString);
LPWSTR wString = (LPWSTR)malloc(WCHAR_STRING_LENGTH * sizeof(LPWSTR));
So what is WCHAR_STRING_LENGTH? This doesn't make sense on several levels.
First, I don't know why you are converting from ANSI to Unicode instead of
starting out with Unicode. Second sizeof(LPWSTR) is just the size of a
pointer which has nothing to do with how much space you need for the string.
Third, you have not made any allowance for the terminating NUL. The
following makes more sense:
LPWSTR wString = (LPWSTR)malloc(sizeof(WCHAR) * (stringLen+1));
to give me a brief example? And I changed
LPWSTR wString = (LPWSTR)malloc(WCHAR_STRING_LENGTH * sizeof(LPWSTR));
to
LPWSTR wString = (LPWSTR)malloc(sizeof(WCHAR) * (stringLen+1));
Thanks for your suggestion
*snip*
Done, thanksMultiByteToWideChar(CP_ACP, 0, lpszString, stringLen, wString,
WCHAR_STRING_LENGTH);
Change WCHAR_STRING_LENGTH to stringLen+1.
*snip*
I've changed all the TextOut to TextOutW, thanksTextOut(hdc, XIncrement, YStart, (LPCWSTR)wString, stringLen);
Make that TextOutW (unless UNICODE is #defined, in which cas you don't need
all your other Ws).
*snip*
Regards,
Johnny
.
- Follow-Ups:
- Re: [Q]How to display Tahoma italic font
- From: John Carson
- Re: [Q]How to display Tahoma italic font
- References:
- [Q]How to display Tahoma italic font
- From: Johnny
- Re: [Q]How to display Tahoma italic font
- From: John Carson
- [Q]How to display Tahoma italic font
- Prev by Date: Re: [Q]How to display Tahoma italic font
- Next by Date: Re: [Q]How to display Tahoma italic font
- Previous by thread: Re: [Q]How to display Tahoma italic font
- Next by thread: Re: [Q]How to display Tahoma italic font
- Index(es):