| View previous topic :: View next topic |
| Author |
Message |
Harold Guest
|
Posted: Tue May 08, 2007 2:51 am Post subject: Textheight with wingdings |
|
|
I'm trying to get the text height of these two characters in the WingDing
font family.
û = x
ü = checkmark
When they are displayed on the screen the 'x' is visibly shorter than the
checkmark but using textheight() they come out the same height. Is there a
way to get the exact height of the different characters for fonts like this?
--
Best regards,
Harold |
|
| Back to top |
|
 |
Herre de Jonge Guest
|
Posted: Tue May 08, 2007 4:28 am Post subject: Re: Textheight with wingdings |
|
|
Does GetTextExtentPoint32() do the trick?
Harold wrote:
| Quote: | I'm trying to get the text height of these two characters in the WingDing
font family.
û = x
ü = checkmark
When they are displayed on the screen the 'x' is visibly shorter than the
checkmark but using textheight() they come out the same height. Is there a
way to get the exact height of the different characters for fonts like this? |
|
|
| Back to top |
|
 |
Harold Guest
|
Posted: Tue May 08, 2007 6:42 am Post subject: Re: Textheight with wingdings |
|
|
"Herre de Jonge" <hdejonge (AT) ravelin (DOT) nl> wrote in message
| Quote: | Does GetTextExtentPoint32() do the trick?
|
Nope, it reports the same thing for size.cy for any character that is
passed.
Harold |
|
| Back to top |
|
 |
quick Guest
|
Posted: Tue May 08, 2007 9:44 pm Post subject: Re: Textheight with wingdings |
|
|
I checked several fonts
they have all had a fixed height
even when the width is variable
Harold wrote:
| Quote: | "Herre de Jonge" <hdejonge (AT) ravelin (DOT) nl> wrote in message
Does GetTextExtentPoint32() do the trick?
Nope, it reports the same thing for size.cy for any character that is
passed.
Harold
|
|
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Tue May 08, 2007 10:15 pm Post subject: Re: Textheight with wingdings |
|
|
Harold wrote:
| Quote: | I'm trying to get the text height of these two characters in the
WingDing font family.
û = x
ü = checkmark
When they are displayed on the screen the 'x' is visibly shorter than
the checkmark but using textheight() they come out the same height.
Is there a way to get the exact height of the different characters
for fonts like this?
|
It can be done but it is not so straightforward. GetOutlineTextMetrics
gives you more information about a fonts character cell layout than
just using the total text height, but getting data for a specific
character is cumbersome. You can use GetGlyphOutline for that, but the
data format is not easy to analyze.
If you really need a character height representing the distance from
the topmost to the bottommost pixel rendered on a canvas the simplest
way to get that may be to render the character in the required font
size to a bitmap filled with white and then scan the pixel lines for
the first and last containing at least one black pixel.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com |
|
| Back to top |
|
 |
Harold Guest
|
Posted: Wed May 09, 2007 12:07 am Post subject: Re: Textheight with wingdings |
|
|
| Quote: | If you really need a character height representing the distance from
the topmost to the bottommost pixel rendered on a canvas the simplest
way to get that may be to render the character in the required font
size to a bitmap filled with white and then scan the pixel lines for
the first and last containing at least one black pixel.
|
Almost more work than its worth<g>. I wanted to center a wingding/webding
type character on a button. Because of the height differences some appear
centered and some don't.
Harold |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Fri May 11, 2007 7:12 pm Post subject: Re: Textheight with wingdings |
|
|
GetGlyphOutline returns information about a character in a GLYPHMETRICS
record. Look at the gmBlackboxX, gmBlackboxY, and gmptGlyphOrigin fields.
Using these fields you are able to reconstruct the exact bounding box of the
character (although I agree with Peter Below that getting it all working
correctly is a bit tricky).
Nils
"Harold" <h.holmes (AT) n (DOT) o.spam.lincolnbeach.com> schreef in bericht
news:463f9f5d$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I'm trying to get the text height of these two characters in the WingDing
font family.
û = x
ü = checkmark
When they are displayed on the screen the 'x' is visibly shorter than the
checkmark but using textheight() they come out the same height. Is there a
way to get the exact height of the different characters for fonts like
this?
--
Best regards,
Harold
|
|
|
| Back to top |
|
 |
|