Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- From: "Christian Kaiser" <bchk@xxxxxx>
- Date: Mon, 5 Feb 2007 09:29:04 +0100
David,
I would not cache the data for all characters in the font, only the 7-bit
part (most use US-ASCII or the trivial western codepages anyway). The rest I
would query on demand.
But that's a decision that's up to you and some performance measurements.
Sorry I cannot help you with the other problem - but what do you care what
GEtTextExtent...() do when you can do that yourself? Possibly some kind of
rounding? I use GetCharABCWidthsFloat() on NT systems and round it after
adding all values as floats or doubles.
Christian
"David Liebtag" <DavidLiebtag@xxxxxxxxxxxxx> wrote in message
news:uU4FbCxRHHA.488@xxxxxxxxxxxxxxxxxxxxxxx
I have added code my WM_SETFONT handler to query the sizes of all the
characters in the font. This information is cached and used later during
string processing. It works terrific! Thanks!
However, I still have a question or two,,,
Initially, I built a string containing all the characters in the font and
then called GetTextExtentExPointW to query the character sizes. This
works,
but I notice the first time I call it for a large font, like Arial Unicode
MS, it takes a long time,,, about 4 seconds on my 3.4 ghz machine.
Although
subsequent calls are fast, the first call is too slow and adversely
impacts
my application initialization. So, I tried to find another technique.
I tried GetCharABCWidths and found that when I add the abc values
together,
I get the same character widths as GetTextExtentExPointW for most
characters
and for those characters it works beautifully. However, for some
characters, I get different results. For example, if I query the ABC
widths
for U+01F6, I get values of 2, 12, and 2 for a total of 16 pixels wide.
GetTextExtentExpoint reports that this character is 17 pixels wide.
Can anyone explain to me the relationship between the abc widths and the
width returned by GetTextExtentExPoint?
Or, can anyone tell me a high performance way to accurately retrieve the
widths of all the characters in a font?
Thanks a lot.
David Liebtag
.
- References:
- GetTextExtentExPoint slow for characters greater than codepoint 127
- From: David Liebtag
- Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- From: Feng Yuan [MSFT]
- Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- From: David Liebtag
- GetTextExtentExPoint slow for characters greater than codepoint 127
- Prev by Date: Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- Next by Date: Re: Can't write text on screen after upgrade to VS2005/Vista
- Previous by thread: Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- Next by thread: Re: GetTextExtentExPoint slow for characters greater than codepoint 127
- Index(es):
Relevant Pages
|