Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
Also, is there a corresponding -draw primitive?
2 questions about -kerning
Re: 2 questions about -kerning
See the manual page for FT_Get_Kerning(). Units are 64.0 * FT_Get_Kerning() units.Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
The -kerning option affects -draw text primitives.Also, is there a corresponding -draw primitive?
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: 2 questions about -kerning
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.rmagick wrote:Regarding the new -kerning option. What units are the value? Pixels? Points? English Metric Units?
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
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.font units for scalable formats, and in pixels for fixed-sizes formats
As such my tests seem to indicate it is in pixels.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: 2 questions about -kerning
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.anthony wrote: As such my tests seem to indicate it is in pixels.
(Oh, and I only tried 3 fonts.)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: 2 questions about -kerning
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: 2 questions about -kerning
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.
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: 2 questions about -kerning
Please keep me, and the rest of us image hackers, informed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: 2 questions about -kerning
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.
http://www.imagemagick.org/RMagick/doc/rvgtut.html.
Follow the "Next" links to see the reference doc.