Default margin in edit control

Achim Kaiser mail1 at kaisersite.de
Sun May 4 16:39:39 CDT 2003


Hi,

By creating an edit control, EC_USEFONTINFO is used to set the controls
default right and left margin.

It seems that the default left, right margin is calculated in Wine by
using one third of the average char width. This is done for all Fonts.
Despite the docs don't tell how Windows calculates the default margins, my
tests show that the default right margin is different form the left margin
in most cases. So it can't be "one third of the average char width". Also
my tests show that for non TrueType or non vector fonts the default right
and left margin is set to zero. (Of course, because the horizontal
overhang is always zero then.)

Here are the docs describing the thing:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontroltextoperations.asp

"By default, the edit control margins are set just wide enough to
accommodate the largest character horizontal overhang (negative ABC
widths) for the current font being used in the edit control."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_setmargins.asp

"The low/high-order word can specify the EC_USEFONTINFO value to set the
left/right margin to a narrow width calculated using the text metrics of
the control's current font. If no font has been set for the control, the
margin is set to zero."

My first patch fixes only the thing with the non TrueType fonts. A second
patch will follow when I have discovered how Windows calculates the
margins exactly.

Achim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecmargins.diff
Type: application/octet-stream
Size: 2256 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20030504/c3ccacfa/ecmargins.obj


More information about the wine-patches mailing list