Is possible to put two glyphs in any place in MetaPost and get kerning between it?

for example using Lato-Regular.ttf

'ab' in 1.7cm,2cm and get information kerning 'a' and 'b'


put 'a' in (1.7cm,2cm) and 'b' on right kerning +11pt.

  • What do you mean exactly? Could you please post a complete Minimal Working Example and explain what result exactly you expect? Do you want the information displayed in the console output? – cfr Feb 8 '16 at 16:25
  • I dontknowwhat. What put 2 glyph from exactly ttf font? How get information? – Marek Kaski Feb 8 '16 at 17:23
  • How are you getting access to TTF fonts? Are you using MP through luamplib? Plain Metapost can only use fonts defined via the psfonts.map mechanism, which normally does not include any of your system fonts. – Thruston Feb 9 '16 at 11:54
  • What is the underlying requirement here? Why do you need the kerning information? – Thruston Feb 10 '16 at 22:19

If you create a textual picture like this:

   picture pp; pp = "proof" infont "pplri8r";

it will be created with the origin of the text sitting at coordinates (0, 0); then you can get the dimensions like this

   wd = xpart urcorner pp;
   ht = ypart urcorner pp;
   dp = ypart lrcorner pp;

You could use this idea to measure individual characters, but the only way I can think of to get the kerning information would be to measure the widths of "a" and "b" separately, and then compare them to the width of "ab".

But you can only use infont with font names in psfonts.map, so you need to get familiar with what Lato is called there. On my system I see "Lato-Reg-01" and so on, but the encodings are strange, so that the standard printable ASCII characters are not in their usual places.

  • is possible 'get kerning' from lualatex? Is posible to put my chars other place than(0,0)? – Marek Kaski Feb 10 '16 at 20:14
  • Why do you need the kerning information? It might be easier to use some utility to read it directly from the font? – Thruston Feb 10 '16 at 22:14
  • > "Is possible to put my chars other place than(0,0)?" Of course. It's just easier to measure them if you create the picture without shifting it first. Once you have a picture variable you can place it anywhere you like with draw pp shifted (x,y); You can draw it several times in different places if you want. – Thruston Feb 10 '16 at 22:17
  • please show me how i can read information about kerning glyph . script or, command line or perl,python,ruby,C 2) My qestion is HOW pt shifted, where i must write text, can You modyfy answer to put (x,y)? – Marek Kaski Feb 11 '16 at 14:20
  • @MarekKaski you don't need the kerning information to make a properly typeset label - that's all done automatically for you. I'm afraid I don't understand your question. I'll wait a couple of days and then delete this answer. – Thruston Feb 11 '16 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.