Yet another QueryFontMetrics question
Yet another QueryFontMetrics question
QueryFontMetrics() returns the ascender and descender value for a font, and the height and width of a text string, but it doesn't give a relation between the two, that is, it doesn't give the font's actual height above the baseline (which is often different from the ascender value). Is there any way to do this, other than a hack such as getting the height of a capital M and calculating the height from baseline from that?
Re: Yet another QueryFontMetrics question
QueryFontMetrics returns
- % 0 character width
% 1 character height
% 2 ascender
% 3 descender
% 4 text width
% 5 text height
% 6 maximum horizontal advance
- % 7 bounding box: x1
% 8 bounding box: y1
% 9 bounding box: x2
% 10 bounding box: y2
% 11 origin: x
% 12 origin: y
Re: Yet another QueryFontMetrics question
Well, it would be great to have those values, but if you're talking about releasing an updated version of ImageMagick, I'm not sure that would help me, as I'm using a webhosting service and I don't know how they'll feel about updating. (They're using version 6.2.9, for what it's worth.) I was just wondering if someone else had encountered the same problem and figured out a work-around.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Yet another QueryFontMetrics question
AN alturnative way is to actually render the character then trim it to determine the information. It will be relatively slow but it will always work.
I do some simular statistical gathering in IM Examples for the command line interface, but the principle is that same. For PerlMagick the image does not need to be written or exposed outside the script.
See Determining Font Metrics, without using an API for more info.
I do some simular statistical gathering in IM Examples for the command line interface, but the principle is that same. For PerlMagick the image does not need to be written or exposed outside the script.
See Determining Font Metrics, without using an API for more info.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/