Hi Geoff, both code versions were intended for fixedLineHeight text. But now you mention it I will try to adjust the code for variable lineHeight and varying fonts.
Since am currently doing "cantuccini" (sort of italian cookies) I will try it a little later. I think the solution is not to rely on the textHeight but to calculate from the formattedHeight / 2 in code version 2. Put that into the offset. I have not tried it though yet. Kind regards Bernd Geoff Canyon-4 wrote > What requirement am I missing that this isn't sufficient -- and capable of > handling multiple fonts and font sizes throughout the text? > > get the formattedrect of line 1 to -1 of fld 1 > set the topmargin of fld 1 to (the height of fld 1 - item 4 of it + > item > 2 of it) div 2 > > > On Fri, Dec 19, 2014 at 1:52 PM, Terence Heaford < > t.heaford@ > > > wrote: > >> Thank you very much for this code. >> >> I was surprised that LC did not have an option for vertically aligned >> text >> in a field and on searching the forum found your method. >> >> However, on my iMac the offset calculation did not seem to work precisely >> and I had to adjust it slightly. >> >> As I am creating a report stack for printing tables that may have >> different fonts and font sizes with different row(field) heights provided >> as parameters I was looking for a reliable way to centre text vertically >> with the possibility of many options. >> >> Thanks again, this really looks like the answer. I will report back if >> anything looks odd in testing. >> >> All the best >> >> Terry >> >> > On 19 Dec 2014, at 17:32, BNig < > bernd.niggemann@ > > wrote: >> > >> > Did the code "you came across" not do what you wanted? >> >> _______________________________________________ >> use-livecode mailing list >> > use-livecode@.runrev >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > _______________________________________________ > use-livecode mailing list > use-livecode@.runrev > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Vertically-aligning-text-in-a-field-tp4686824p4686964.html Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode