Futurebasic/Language/Reference/usr fontheight

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USR FONTHEIGHT

Description - This function returns the current "font height" in pixels. This is based on the current font ID and font size for the current output window or printer. The font height is the full height of a line of text, measured from the top of one line to the top of the line below it. It is not the same thing as the "font size," although there is often a relationship between the font size and the font height. The font height is the sum of the font's "ascent," its "descent" and its "leading." See the "Font Manager" chapter in Inside Macintosh: Text for more information.

Example: USR FONTHEIGHT is useful for determining how many lines of text will fit within a rectangle of a given height. This LOCAL FN returns the number of text lines that can fit in the current window: LOCAL FN MaxLines

  wh = WINDOW(_height)
  fh = USR FONTHEIGHT
  max = wh \\ fh
  END FN = max

See Also TEXT