http://www.perlmonks.org?node_id=950760


in reply to font measurement

Your sample code looks great. What type of font do you plan to use? Is it ttf or what?

Replies are listed 'Best First'.
Re^2: font measurement
by preahkumpii (Novice) on Jan 30, 2012 at 12:50 UTC
    A ttf, or otf. Really I just want to specify a font on my Windows system. The actual code I will use is much more complex, but seeing I can't even get the basic idea of measuring the string, I figured it would be better to make a simple program to test it first.

      Windows has some API functions that can be fed with a string and a font, returning some sizes. Start looking at Font and Text Functions.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      AFAIK the Font::Freetype suite can render you at least one given symbol. Assuming that spacing between characters will be constant, you can calculate the size of any string, using these data.

      But there is also Font::TTF, which I didn't used before - start reading from this point, I guess.