Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2925
Why does font spacing change?
posted

Why does the spacing of text of an UltraTextEditor change when it is in Edit mode compared to when it isn't?  It seems that when the control has focus, an extra pixel of space is created around all the text, moving it slightly to the right, and slightly down.  This is more noticeable if there are multiple lines of text.

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    This is due to the differences in character kerning between GDI and GDI+. The .NET TextBox, which we use in the UltraTextEditor to do the editing, is a wrapper around the old COM TextBox control, which predates GDI+. The native drawing mechanism for .NET is GDI+, which the UltraTextEditor uses when not in edit mode. GDI+, in an effort to maintain "device independence", significantly changed the kerning algorithm, thus producing the difference in spacing with the same font under the different drawing platforms.

    You can avoid this behavior by setting the control's TextRenderingMode to 'GDI', or by setting its 'AlwaysInEditMode' property to true.

Children