Vertical Centering Text

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


Hello!

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) +
(cHeight/2))-1)
end fixLineHeight


Any thoughts?

Thanks!
Dan




More information about the Use-livecode mailing list