J
Jack Fredrick
Does anybody know how to get the metrics of a selected font/word?
Does anybody know how to get the metrics of a selected font/word?
Jack Fredrick formulated the question :
What sorts of metrics are you looking for? Those offered by structures
like LOGFONT, or more detailed info on each glyph within?
Jack Fredrick formulated the question :
What sorts of metrics are you looking for? Those offered by structures
like LOGFONT, or more detailed info on each glyph within?
The metrics available LOGFONT structures are what I had in mind, If
possible to find which chars are supported by each font that would be
great, I've been looking for something like that for a long time.
Moishy laid this down on his screen :
Okay, here's a sample you may want to look at...
Uses EnumFontFamilies for that info on any/all fonts on the system:http://vb.mvps.org/samples/FontFilter
What info are you starting with? YOu may also be interested in...
Looks inside the internal table structure of TTF files:http://vb.mvps.org/samples/FontFilter
Very messy, but it's *all* there.
Does anybody know how to get the metrics of a selected font/word?
Thank you very much, I hope to get around to delve into the topic
sometime this week.
Can you please give me a quick example how to determine a fonts height
and width for a specific char or string?
Moishy formulated on Tuesday :
I've never done that, myself. Please realize that those values will be
dependent on device context. So, it's relatively easy to determine for
any given DC, but if you want to do it for any random font you'll need
to create a compatible DC and select that font into it first. Then, I
believe you can use GetTextExtentPoint32 to retrieve the metrics for
any given string.
http://msdn.microsoft.com/en-us/library/dd144938(v=vs.85).aspx
You can probably Google for that API call and VB6 and/or VBA to find
functional examples...
http://www.ex-designz.net/apidetail.asp?api_id=590
First of all, why is the height of a specific letter in a specific
font dependable upon the DC, I want to know the real value as created
by the creator of the font?
I converted your example to Word VBA. All works well besides the
filtering based upon the cboCharset. Here is a link to the file
(https://rapidshare.com/files/2732974441/FontEnum.doc) your help will
be most appreciated.
Moishy formulated the question :
Relative to what? The DC is what gives it context. (Which, of course,
is the C in DC.)
With what, in particular?
When measuring a persons height (feet and inches etc.) it isn'tRelative to what? The DC is what gives it context. (Which, of course,
is the C in DC.)
Getting the procedure to filter results based upon the value ofWith what, in particular?
When measuring a persons height (feet and inches etc.) it isn't
relative to any thing, why are computer measurements any different?
Getting the procedure to filter results based upon the value of
cboCharset.
Moishy brought next idea :
Well, because people aren't scalable. Fonts are. They're just
outlines, defined mathematically.
Tell me this, how long is y=mx+b?
Hmmm, well, for starters, I'm getting an error on that download link.
But it's really not polite to upload something like that, and ask folks
to trust it, anyway. What sort of failure is it? What have you done
to troubleshoot it? Can you isolate the failure and post the snippet
here?
Well, because people aren't scalable. Fonts are. They're just
outlines, defined mathematically.
Hmmm, well, for starters, I'm getting an error on that download link.
But it's really not polite to upload something like that, and ask folks
to trust it, anyway. What sort of failure is it? What have you done
to troubleshoot it? Can you isolate the failure and post the snippet
here?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.