in reply to Adjustable pdf text size in API2

If you're using the core 14 fonts, the widths for each character are defined as part of the font's internal representation - in particular, there's a 'wx' hash which maps a width to each character. For non-core fonts, you could get at the bounding box of each character via PDF::API2::Basic::TTF::Glyph and derive the width from that.

For either approach, you'd have to take the character width, multiply by whatever text size you're actually outputting at and get a final display width for a given character from that. It'd be tedious, but I can't (at the moment) see a higher-level way of getting the widths you need.

Note: this doesn't take into account kerning pairs, which may or may not matter in your particular case.

Hope that helps.

Update: Ignore this - see GhodMode's reply for a much better answer.