diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index 3a329ae5c2..063e1a49cb 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -2503,74 +2503,76 @@ begin WriteLn('WARNING: [TgtkObject.ExtTextOut] Uninitialized GC'); Result := False; end - else begin - If UseFont = nil then begin - WriteLn('WARNING: [TgtkObject.ExtTextOut] Missing Font'); - Result := False; - end - else begin - // TODO: implement other parameters. - //ADC := SaveDC(DC); - DCOrigin:=GetDCOffset(PDeviceContext(DC)); - if (Options and ETO_OPAQUE) <> 0 then - begin - Width := Rect^.Right - Rect^.Left; - Height := Rect^.Bottom - Rect^.Top; - gdk_gc_set_fill(GC, GDK_SOLID); - gdk_gc_set_foreground(GC, @CurrentBackColor); - gdk_draw_rectangle(Drawable, GC, 1, - Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y, - Width, Height); - end; - if (Options and ETO_CLIPPED) <> 0 then - begin - X := Rect^.Left; - Y := Rect^.Top; - IntersectClipRect(DC, Rect^.Left, Rect^.Top, Rect^.Right, - Rect^.Bottom); - end; - Num := FindChar(#10,Str,Count); - AY := Y; - GetTextMetrics(DC, TM); - TxtPt.X := X; - {$IfDef Win32} - TxtPt.Y := AY + TM.tmHeight div 2; - {$Else} - TxtPt.Y := AY + TM.tmAscent; - {$EndIf} - SelectGDKTextProps(DC); - if Num < 0 then begin - if Count> 0 then - gdk_draw_text(Drawable, UseFont, GC, - TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count); - end else - Begin //write multiple lines - LineStart:=Str; - StrEnd:=Str+Count; - while LineStart < StrEnd do begin - LineEnd:=LineStart+Num; - if Num>0 then - gdk_draw_text(Drawable, UseFont, GC, - TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, LineStart, Num); - AY := TxtPt.Y; - {$IfDef Win32} - TxtPt.Y := AY + TM.tmHeight div 2; - {$Else} - TxtPt.Y := AY + TM.tmAscent; - {$EndIf} - LineStart:=LineEnd+1; // skip #10 - if (LineStart 0) + and (Rect=nil) then begin + WriteLn('WARNING: [TgtkObject.ExtTextOut] Rect=nil'); + Result := False; + end else begin + // TODO: implement other parameters. + //ADC := SaveDC(DC); + DCOrigin:=GetDCOffset(PDeviceContext(DC)); + if ((Options and ETO_OPAQUE) <> 0) then + begin + Width := Rect^.Right - Rect^.Left; + Height := Rect^.Bottom - Rect^.Top; + gdk_gc_set_fill(GC, GDK_SOLID); + gdk_gc_set_foreground(GC, @CurrentBackColor); + gdk_draw_rectangle(Drawable, GC, 1, + Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y, + Width, Height); end; + if (Options and ETO_CLIPPED) <> 0 then + begin + X := Rect^.Left; + Y := Rect^.Top; + IntersectClipRect(DC, Rect^.Left, Rect^.Top, + Rect^.Right, Rect^.Bottom); + end; + Num := FindChar(#10,Str,Count); + AY := Y; + GetTextMetrics(DC, TM); + TxtPt.X := X; + {$IfDef Win32} + TxtPt.Y := AY + TM.tmHeight div 2; + {$Else} + TxtPt.Y := AY + TM.tmAscent; + {$EndIf} + SelectGDKTextProps(DC); + if Num < 0 then begin + if Count> 0 then + gdk_draw_text(Drawable, UseFont, GC, + TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count); + end else + Begin //write multiple lines + LineStart:=Str; + StrEnd:=Str+Count; + while LineStart < StrEnd do begin + LineEnd:=LineStart+Num; + if Num>0 then + gdk_draw_text(Drawable, UseFont, GC, + TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, LineStart, Num); + AY := TxtPt.Y; + {$IfDef Win32} + TxtPt.Y := AY + TM.tmHeight div 2; + {$Else} + TxtPt.Y := AY + TM.tmAscent; + {$EndIf} + LineStart:=LineEnd+1; // skip #10 + if (LineStart