diff --git a/lcl/interfaces/gtk/gtkproc.pp b/lcl/interfaces/gtk/gtkproc.pp index ef94e80cc7..b41d870fa3 100644 --- a/lcl/interfaces/gtk/gtkproc.pp +++ b/lcl/interfaces/gtk/gtkproc.pp @@ -525,7 +525,6 @@ procedure EndGDKErrorTrap; {$Ifdef GTK1} const - GDK_KEY_Escape = GDK_Escape; GDK_key_dead_circumflex = GDK_dead_circumflex; GDK_KEY_KP_Space = GDK_KP_Space; GDK_KEY_KP_ENTER = GDK_KP_ENTER; @@ -563,7 +562,7 @@ procedure EndGDKErrorTrap; GDK_KEY_KP_Separator = GDK_KP_Separator; GDK_KEY_KP_Subtract = GDK_KP_Subtract; GDK_KEY_KP_Decimal = GDK_KP_Decimal; - GDK_KEY_KP_Divide = GDK_KP_Divide: + GDK_KEY_KP_Divide = GDK_KP_Divide; GDK_KEY_KP_0 = GDK_KP_0; GDK_KEY_KP_1 = GDK_KP_1; GDK_KEY_KP_2 = GDK_KP_2; @@ -619,10 +618,10 @@ procedure EndGDKErrorTrap; GDK_KEY_F20 = GDK_F20; GDK_KEY_F21 = GDK_F21; GDK_KEY_F22 = GDK_F22; - GDK_KEY_F23 = GDK_F23 + GDK_KEY_F23 = GDK_F23; GDK_KEY_F24 = GDK_F24; GDK_KEY_cyrillic_io = GDK_cyrillic_io; - GDK_KEY_cyrillic_Capital_hardsign = GDK_cyrillic_io..GDK_cyrillic_Capital_hardsign; + GDK_KEY_cyrillic_Capital_hardsign = GDK_cyrillic_Capital_hardsign; type PGtkOldEditable = PGtkEditable; diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index ac1717cd9b..46a2291b1f 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -129,14 +129,20 @@ begin LoadDefaultFont; exit; end; - FullString := AnsiString(FamilyName + ' ' + IntToStr(Abs(lfHeight))); + FullString := AnsiString(FamilyName); + if IsFontNameXLogicalFontDesc(LongFontName) then + if Abs(lfHeight)=0 then + FullString := FullString + ' 12' + else + FullString := FullString + ' ' + IntToStr(Abs(lfHeight)); end else begin FullString := AnsiString(FamilyName); - if (PointSize = '') or (AnsiCompareText(PointSize,'*')=0) then - FullString := FullString + ' 12' - else - FullString := FullString + ' ' + PointSize; + if IsFontNameXLogicalFontDesc(LongFontName) then + if (PointSize = '') or (AnsiCompareText(PointSize,'*')=0) then + FullString := FullString + ' 12' + else + FullString := FullString + ' ' + IntToStr(StrToInt(PointSize) div 10); end; GdiObject^.GDIFontObject := pango_font_description_from_string(PChar(FullString)); @@ -451,101 +457,105 @@ begin Underline := CurrentFont^.Underline; StrikeOut := CurrentFont^.StrikeOut; end; - - If UseFontDesc = nil then + + GetStyle('default'); + If (UseFontDesc = nil) or (GetStyleWidget('default')=nil) then WriteLn('WARNING: [Tgtk2Object.ExtTextOut] Missing Font') else begin // to reduce flickering calculate first and then paint DCOrigin:=GetDCOffset(TDeviceContext(DC)); - GetStyle('default'); Layout := gtk_widget_create_pango_layout (GetStyleWidget('default'), nil); - pango_layout_set_font_description(Layout, UseFontDesc); + If (Layout = nil) then + WriteLn('WARNING: [Tgtk2Object.ExtTextOut] Missing Pango Layout') + else begin + pango_layout_set_font_description(Layout, UseFontDesc); - AttrList := pango_layout_get_attributes(Layout); + AttrList := pango_layout_get_attributes(Layout); - If (AttrList = nil) then - AttrList := pango_attr_list_new(); + If (AttrList = nil) then + AttrList := pango_attr_list_new(); - If CurrentFont^.Underline then - Attr := pango_attr_underline_new(PANGO_UNDERLINE_SINGLE) - else - Attr := pango_attr_underline_new(PANGO_UNDERLINE_NONE); - - pango_attr_list_change(AttrList,Attr); - - Attr := pango_attr_strikethrough_new(CurrentFont^.StrikeOut); - pango_attr_list_change(AttrList,Attr); - - 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; - - LineLen := FindChar(#10,Str,Count); - TopY := Y; - UpdateDCTextMetric(TDeviceContext(DC)); - TxtPt.X := X + DCOrigin.X; - LineHeight := DCTextMetric.TextMetric.tmAscent; - TxtPt.Y := TopY + LineHeight + DCOrigin.Y; - - SelectedColors := dcscCustom; - - if ((Options and ETO_OPAQUE) <> 0) then - begin - Width := Rect^.Right - Rect^.Left; - Height := Rect^.Bottom - Rect^.Top; - EnsureGCColor(DC, dccCurrentBackColor, True, False); - gdk_draw_rectangle(Drawable, GC, 1, - Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y, - Width, Height); - end; - - EnsureGCColor(DC, dccCurrentTextColor, True, False); - Case TColor(CurrentTextColor.ColorRef) of - clScrollbar..clEndColors: - RGBColor := GetSysColor(CurrentTextColor.ColorRef and $FF); + If CurrentFont^.Underline then + Attr := pango_attr_underline_new(PANGO_UNDERLINE_SINGLE) else - RGBColor := CurrentTextColor.ColorRef and $FFFFFF; - end; + Attr := pango_attr_underline_new(PANGO_UNDERLINE_NONE); - Attr := pango_attr_foreground_new(gushort(GetRValue(RGBColor)) shl 8, - gushort(GetGValue(RGBColor)) shl 8, - gushort(GetBValue(RGBColor)) shl 8); + pango_attr_list_change(AttrList,Attr); - pango_attr_list_change(AttrList,Attr); + Attr := pango_attr_strikethrough_new(CurrentFont^.StrikeOut); + pango_attr_list_change(AttrList,Attr); - pango_layout_set_attributes(Layout, AttrList); - - LineStart:=Str; - if LineLen < 0 then begin - LineLen:=Count; - if Count> 0 then DrawTextLine; - end else - Begin //write multiple lines - StrEnd:=Str+Count; - while LineStart < StrEnd do begin - LineEnd:=LineStart+LineLen; - if LineLen>0 then DrawTextLine; - inc(TxtPt.Y,LineHeight); - LineStart:=LineEnd+1; // skip #10 - if (LineStart 0 then + begin + X := Rect^.Left; + Y := Rect^.Top; + IntersectClipRect(DC, Rect^.Left, Rect^.Top, + Rect^.Right, Rect^.Bottom); end; - end; - g_object_unref(Layout); - Result := True; + LineLen := FindChar(#10,Str,Count); + TopY := Y; + UpdateDCTextMetric(TDeviceContext(DC)); + TxtPt.X := X + DCOrigin.X; + LineHeight := DCTextMetric.TextMetric.tmAscent; + TxtPt.Y := TopY + LineHeight + DCOrigin.Y; + + SelectedColors := dcscCustom; + + if ((Options and ETO_OPAQUE) <> 0) then + begin + Width := Rect^.Right - Rect^.Left; + Height := Rect^.Bottom - Rect^.Top; + EnsureGCColor(DC, dccCurrentBackColor, True, False); + gdk_draw_rectangle(Drawable, GC, 1, + Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y, + Width, Height); + end; + + EnsureGCColor(DC, dccCurrentTextColor, True, False); + Case TColor(CurrentTextColor.ColorRef) of + clScrollbar..clEndColors: + RGBColor := GetSysColor(CurrentTextColor.ColorRef and $FF); + else + RGBColor := CurrentTextColor.ColorRef and $FFFFFF; + end; + + Attr := pango_attr_foreground_new(gushort(GetRValue(RGBColor)) shl 8, + gushort(GetGValue(RGBColor)) shl 8, + gushort(GetBValue(RGBColor)) shl 8); + + pango_attr_list_change(AttrList,Attr); + + pango_layout_set_attributes(Layout, AttrList); + + LineStart:=Str; + if LineLen < 0 then begin + LineLen:=Count; + if Count> 0 then DrawTextLine; + end else + Begin //write multiple lines + StrEnd:=Str+Count; + while LineStart < StrEnd do begin + LineEnd:=LineStart+LineLen; + if LineLen>0 then DrawTextLine; + inc(TxtPt.Y,LineHeight); + LineStart:=LineEnd+1; // skip #10 + if (LineStart