Hello.
I am generating a PDF file from withing a C program I am developing and I am running into trouble measuring the dimensions of arbitrary text string when rendered on the page. Even if I had widths of individual glyphs in the font I am using, I would still run into trouble considering ligatures. My questions are the following:
- When I generate a PDF file, I have to provide the /Widths array dictionary entry for the font I use. How do I get these values? Is it possible to get them out of the font file (OTF/Type-1) easily?
- If I do have the widths of individual glyphs and the ascent/descent values for the whole font, I still need ascent/descent for individual glyphs so that I can typeset things perfectly. How about these? Can they be read from the formats mentioned above?
What confuses me is this. A PDF writer (be it Microsoft Word) knows the font it is using to write text, obviously. When it saves the document as PDF, does it really inspect the font to dig out the glyph sizes?
I do not use any libraries whatsoever, I am generating the whole file and its PostScript streams "by hand".
Thanks!
David