Page 1 of 1
2 questions about -kerning
Posted: 2008-12-17T16:55:32-07:00
by rmagick
Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
Also, is there a corresponding -draw primitive?
Re: 2 questions about -kerning
Posted: 2008-12-17T19:45:50-07:00
by magick
Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
See the manual page for FT_Get_Kerning(). Units are 64.0 * FT_Get_Kerning() units.
Also, is there a corresponding -draw primitive?
The -kerning option affects -draw text primitives.
For the most robust control of text placement, use SVG. Just use any of the SVG text elements and render like this:
- convert text.svg text.png
Re: 2 questions about -kerning
Posted: 2008-12-17T22:07:20-07:00
by anthony
rmagick wrote:Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
A question I would like to know. It would be important if you want to use it to make 'justified' text lines of specific length.
Why 64 times, why not just leave them 'as is' or multiplyed by density.
But the SVG is still probbaly the method method, if you can figure out its construction (not easy).
Google search for the man page says units are
font units for scalable formats, and in pixels for fixed-sizes formats
My experiments however show the -kerning size seems to be in pixels, regardless of font, density or otherwise. Basically generate a label of two characters using different fonts, and density's, Then subtract that from the same thing with a -kerning parameter of different sizes. the difference is the added space and that is the parameter in pixels.
As such my tests seem to indicate it is in
pixels.
Re: 2 questions about -kerning
Posted: 2008-12-18T16:05:19-07:00
by rmagick
anthony wrote:
As such my tests seem to indicate it is in pixels.
I agree. Well, almost but not quite pixels. I ran some quick tests using a string of 260 alphabetic characters at 3 different densities and 6 pointsizes. Each unit increase in the kerning value increased the average width/character by 1 pixel plus or minus a couple of hundreths. This holds for positive and negative kerning values. I didn't try fractional values. For my purposes "pixel" is a sufficiently accurate description of the unit.
(Oh, and I only tried 3 fonts.)
Re: 2 questions about -kerning
Posted: 2008-12-18T17:41:52-07:00
by anthony
It does not increases EVERY characters width.
It adds between every character. As such for a string of 260 characters, it will add extra space in 259 spots!
However I think (and this is untested) it will be ignored for the inter-character spaces around a NEWLINE or RETURN character.
It may also be ignored for vertical or horizontal tabs and formfeeds,
but again I can't be certain has I have not tested ir even generally used such characters for some time.
WARNING: if TABs are handles, column spacing on fixed width fonts may have problems. Again this is untested, but something to check if you plan to use it.
Cristy as asked if a -tspan option for inter-word spacing should also be added.
Though he does point out that justification and better text handling is part of the SVG format specification, so if you use the RSVG delegate library that may be the better way to handle text formating.
A simple, hand generated example of SVG text formating would be great to add to IM examples. Suggestions or Examples, or even usage notes, text, comments on this would be a good contribution to me for IM Examples.
Re: 2 questions about -kerning
Posted: 2008-12-18T18:04:54-07:00
by rmagick
You're correct. For my purposes, the kerning unit is a pixel.
However, I'm not so much concerned with drawing using SVG as I am with supporting my Ruby RVG library, which generates MVG code. I've already got a rough-but-adequate implemenation of letter-spacing and word-spacing working but a kerning (and tspan) draw primitive would come in handy there.
Re: 2 questions about -kerning
Posted: 2008-12-18T18:38:07-07:00
by anthony
Please keep me, and the rest of us image hackers, informed.
Re: 2 questions about -kerning
Posted: 2008-12-18T18:55:05-07:00
by rmagick
I'm sorry. I should've added a link. RVG's been around for some years now. It's fairly static.
http://www.imagemagick.org/RMagick/doc/rvgtut.html.
Follow the "Next" links to see the reference doc.