How GetCharWidth works?
Hi I understand if dont like questons like this but I have read the docs and it says width returned is in logical coordinates.
So I asume they must be converted to "pixels" but how?
Could this be done whit GetDeviceCaps() ?
That returns the average width but i need width of each character. Example a has difrend width than i. Thanks though!
also note that even I would use GetTextExtentPoint32 for single chars I would still have to convert logical units. Right?
also note that even I would use GetTextExtentPoint32 for single chars I would still have to convert logical units. Right?
In my experience it doesn''t. (work, that is)
Check out my previous experience:
http://www.gamedev.net/community/forums/topic.asp?topic_id=165540
Check out my previous experience:
http://www.gamedev.net/community/forums/topic.asp?topic_id=165540
quote:Original post by Sailorstick
In my experience it doesn't. (work, that is)
Check out my previous experience:
http://www.gamedev.net/community/forums/topic.asp?topic_id=165540
What windows you got?
I have 98 SE and GetCharWidth32() doesnt work in that so Im using GetCharWidth() wich works and returns somehow sensible values... So now they should be converted...
The main queston isnt yet answerd, what is logical width? And how to convert?
[edited by - Craazer on May 9, 2004 12:33:51 PM]
So far no good. However this is how I understand the conversion should work from the docs:
So "quess" what, that doesnt work.
The window and viewport x's are both 1, wich I know nothing about, but character widths are still too short or unaccurate.
[edited by - Craazer on May 9, 2004 2:25:46 PM]
SIZE wext,vext;GetWindowExtEx(mhdc,&wext);GetViewportExtEx(mhdc,&vext);for(int x = 0; x < NUM_CHARS;x++) { // cwidths are gained by GetCharWidth() pcharwidths[x] = (MulDiv(cwidths[x],vext.cx,wext.cx)); }
So "quess" what, that doesnt work.
The window and viewport x's are both 1, wich I know nothing about, but character widths are still too short or unaccurate.
[edited by - Craazer on May 9, 2004 2:25:46 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement