Vertical Centering Text

Dan Friedman dan at
Wed Apr 9 21:30:01 EDT 2003


Does anyone already have a function for setting a fields topMargin so that
it's text is centered vertically?

I got this far (don't laugh!)... Which works fine for some font sizes... But
others are not right.

on fixLineHeight tFieldID
  put the formattedHeight of line 1 of field id tFieldID into tHeight
  put the formattedHeight of char 1 of field id tFieldID into cHeight
  put the height of field id tFieldID into fHeight
  set the topMargin of field id tFieldID to ((((fHeight - tHeight)/2) +
end fixLineHeight

Any thoughts?


More information about the use-livecode mailing list