(none) imager-devel
/ help / lists / applications / search /

Re: Scaling fonts not working as expected

From: Peter Wood (
Date: Thu 21 Mar 2013 - 12:52:08 GMT

  • Next message: Tony Cook: "Re: Scaling fonts not working as expected"


    >I suspect the simplest solution is to find a width that fits within
    >the image (round down a little) and then render character by
    >character, adjusting the output position incrementally to fill the
    >image width.

    I'm not sure I understand what you're saying here. I'll restate what I
    think you're saying and you can correct me if I'm wrong. I'd perform my
    size calculation as I currently do, getting the display width of the
    string at the default font size, calculating the amount it exceeds the
    rounded-down width, and then decreasing the font size by this amount.
    Then, instead of rendering the string as a whole, I'd render one character
    at a time using the new font size. I would calculate the width of each
    character and then align the next character just to the right of that, and
    so on, until I'm finished with the string. Thus I would end up with a
    string that fits within the specified width?