Re: GetCharacterPlacement() problems
From: Mike D Sutton (EDais_at_mvps.org)
Date: 06/21/04
- Next message: RichM: "Color shifting problem"
- Previous message: Mike D Sutton: "Re: Improving text quality from GetGlyphOutline"
- In reply to: Mike D Sutton: "GetCharacterPlacement() problems"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Jun 2004 11:58:10 +0100
> I'm getting very odd results when using the GCP_USEKERNING flag with GetCharacterPlacement() (either the ASCII or Wide versions of
> the call) when combined with GCP_MAXEXTENT to handle word wrapping - It appears to be calculating the max extent of the string
> incorrectly and returning a small number of characters able to be fit into the available space when there's space for plenty more.
> Are these flags incompatible with one another or is this a bug?
> Note; I've used GetFontLanguageInfo() to make sure that the selected font has a kerning table and am passing it's return value
(with
> FLI_GLYPHS masked off and GCP_MAXEXTENT appended) to the API call. With GCP_USEKERNING masked off too then I get correct results
> but if possible I'd like to include this for better quality character positioning output - is there some trick to make them play
> nicely together?
It looks like the problem is now resolved, in case anyone else has the same problem the way we fixed it was to call
GetCharaterPlacement() twice, the first with the GCP_MAXEXTENT flag only (and the return from GetFontLanguageInfo() with FLI_GLYPHS
and GCP_USEKERNING masked off) to get the number of characters of the string that could be displayed on the line. At that point you
can seek back to find the last break character then and trim the string if found, then send only that segment of the string back to
GetCharaterPlacement() for the kerning (and in our case optionally full justification.) Of course with extreme kerning the number
of characters on the line may be slightly off but for the most part it seems to work fine.
Hope this helps,
Mike
P.s. If anyone else has had similar experiences with the call or knows of a better method then I'd be interested to hear about it.
- Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://www.mvps.org/EDais/
- Next message: RichM: "Color shifting problem"
- Previous message: Mike D Sutton: "Re: Improving text quality from GetGlyphOutline"
- In reply to: Mike D Sutton: "GetCharacterPlacement() problems"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|