[Bug 21489] simple Delphi program: wrong text label height in some cases

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Feb 24 03:41:44 CST 2010


http://bugs.winehq.org/show_bug.cgi?id=21489





--- Comment #10 from Igor Savchenko <iggy at inbox.ru>  2010-02-24 03:41:43 ---
There is more detailed bug description. Bug is occasional. It happens
when word wrap is enabled and two lines of text, RENDERED IN CURRENT FONT,
match to this rule: first string length less or equal than second string
length.
thus, first string consist of first word and second word. and second string is
third word.
Example: 
firstword and 
second_word
instead of "and" there could be "an", "a" or "nd".

I suppose bug is in DrawText (Windows GDI function) implementation.

int DrawText(
  HDC hDC,          // handle to DC
  LPCTSTR lpString, // text to draw
  int nCount,       // text length
  LPRECT lpRect,    // formatting dimensions
  UINT uFormat      // text-drawing options
);

Delphi uses it (simplistic) like:
DrawText(Canvas.Handle, PChar(DText), Length(DText), Rect, DT_EXPANDTABS or
DT_CALCRECT or DT_WORDBREAK);
DT_EXPANDTABS = $40,DT_CALCRECT = $400,DT_WORDBREAK = $10

Please try to use function like writed above. var Rect's initialization
dimensions must be less then Rect's result dimensions 
(triggered by DT_CALCRECT). 

Bug is when var Rect's result height is 3x greater then text string height
(when text consists of two strings).
New attachment program (with sources) demonstrates bug, just click button to
set  two string text. Program shows heights, heights relation, and bug status
(relation 1 or 2 - ok, 3 - bug) in its status bar sections. Text has white
background (this is Rect) - so bug is visual.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list