Find the width of unicode data
-
I am trying to find out the width of data that is writtern in unicode.Is there any API for this. I find GetTextMetrices but it does not give me correct width for unicode true type font. Thanks in Advance :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
-
I am trying to find out the width of data that is writtern in unicode.Is there any API for this. I find GetTextMetrices but it does not give me correct width for unicode true type font. Thanks in Advance :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
-
I am trying to find out the width of data that is writtern in unicode.Is there any API for this. I find GetTextMetrices but it does not give me correct width for unicode true type font. Thanks in Advance :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
Shilpi Boosar wrote:
I find GetTextMetrices but it does not give me correct width for unicode true type font.
How are you using it?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
I am trying to find out the width of data that is writtern in unicode.Is there any API for this. I find GetTextMetrices but it does not give me correct width for unicode true type font. Thanks in Advance :)
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
If
GetTextMetrics
does not return the proper width, which it does not for some fonts such as ALISON, then one should use theGetCharABCWidthsFloat
function.RECT ImageRect = {0}; // get the required height of the bitmap TEXTMETRIC tm = {0}; GetTextMetrics(ImageDC, &tm); ImageRect.bottom = tm.tmHeight; // Calculate the required width of the bitmap. Some characters in some fonts // have overhangs and/or underhangs so large that the second or even third // character from either end of the text can affect the size of the bitmap // needed to display the text. ABCFLOAT ABCWidths = {0}; double left = 0.0; double right = 0.0; double pos = 0.0; for (std::tstring::iterator it = ImageText.begin(); it != ImageText.end(); ++it) { if (GetCharABCWidthsFloat(ImageDC, \*(it), \*(it), &ABCWidths)) { pos += ABCWidths.abcfA; left = min(left, pos); pos += ABCWidths.abcfB; right = max(right, pos); pos += ABCWidths.abcfC; } } ImageRect.right = (long)((right - left) + 0.5);
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!