Steve wrote: >>> I am having an issue trying vertically center text in a larger >>> rectangle. >>> Using Fn StringWidth to get the width of the text and the height >>> using GetFontInfo. I calculate how many lines are needed and >>> adjust the rect.top accordingly. This is the part that is failing. >>> But it's not working correctly. Maybe I am not getting the font >>> metrics correctly. >>> Can anyone point me to examples of doing this correctly? >> >> How are you drawing the text? HIThemeDrawTextBox() can >> automatically centre text both vertically and horizontally. > No, I am not using HIThemeDrawTextBox, just DrawThemeTextBox. > I am still using v4.4 FB for the production version of MacPOS with > many things yet to do before converting this very large program to > FBtoC. StringWidth() and GetFontInfo() are for QuickDraw text, and would be of doubtful use with DrawThemeTextBox(). GetThemeTextDimensions() is what you should be using. Here's the description of its ioBounds parameter, which tells you the height needed for the Rect to be passed to DrawThemeTextBox() * ioBounds: * On output, ioBounds->v contains the height of the text. If you * pass false to inWrapToWidth, ioBounds->h will contain the width * of the text on output. If you pass true to inWrapToWidth, * ioBounds->h must (on input) contain the desired width for * wrapping; on output, ioBounds->h contains the same value you * specified on input. Robert P.