View Issue Details

IDProjectCategoryView StatusLast Update
0036298LazarusWidgetsetpublic2019-11-13 07:12
ReporterCudaText manAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUbuntu 19 x64OSOS Version
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0036298: gtk2: Listbox with OwnerDrawFixed doesn't render strikeout text on canvas
DescriptionDemo don't render crossed text in the listbox.
But if i add more font styles (bold+italic+strikeout+underline - see commented line in demo) then crossed is rendered.
TagsNo tags attached.
Fixed in Revisionr62233
LazTarget-
WidgetsetGTK 2
Attached Files
  • tst-crossed-text.zip (3,331 bytes)
  • s.diff (464 bytes)
    Index: lcl/interfaces/gtk2/gtk2winapi.inc
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 62230)
    +++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
    @@ -1409,6 +1409,7 @@
              (lfWeight = FW_NORMAL) and
              (lfItalic = 0) and
              (lfUnderline = 0) and
    +         (lfStrikeOut = 0) and
              (lfOrientation = 0) and
              IsFontNameDefault(lfFacename) then
           begin
    
    s.diff (464 bytes)
  • s2.diff (1,418 bytes)
    Index: lcl/interfaces/gtk2/gtk2winapi.inc
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 62230)
    +++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
    @@ -1409,6 +1409,7 @@
              (lfWeight = FW_NORMAL) and
              (lfItalic = 0) and
              (lfUnderline = 0) and
    +         (lfStrikeOut = 0) and
              (lfOrientation = 0) and
              IsFontNameDefault(lfFacename) then
           begin
    @@ -1517,15 +1518,19 @@
               AttrList := pango_attr_list_new();
               AttrListTemporary := True;
             end;
    -        if LogFont.lfUnderline <> 0 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(LogFont.lfStrikeOut<>0);
    -        pango_attr_list_change(AttrList, Attr);
    +        if LogFont.lfUnderline<>0 then
    +        begin
    +          Attr := pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
    +          pango_attr_list_change(AttrList, Attr);
    +        end;
     
    +        if LogFont.lfStrikeOut<>0 then
    +        begin
    +          Attr := pango_attr_strikethrough_new(True);
    +          pango_attr_list_change(AttrList, Attr);
    +        end;
    +
             pango_layout_set_attributes(CurFont, AttrList);
             
             if AttrListTemporary then
    
    s2.diff (1,418 bytes)

Activities

CudaText man

2019-11-12 00:15

reporter  

tst-crossed-text.zip (3,331 bytes)

CudaText man

2019-11-12 06:59

reporter   ~0119235

found all occurences of "underline" in gtk2 folder, and fixed this.

s.diff (464 bytes)
Index: lcl/interfaces/gtk2/gtk2winapi.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 62230)
+++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
@@ -1409,6 +1409,7 @@
          (lfWeight = FW_NORMAL) and
          (lfItalic = 0) and
          (lfUnderline = 0) and
+         (lfStrikeOut = 0) and
          (lfOrientation = 0) and
          IsFontNameDefault(lfFacename) then
       begin
s.diff (464 bytes)

CudaText man

2019-11-12 07:04

reporter   ~0119236

s2.diff replaces s.diff, has additional tiny optimization (don't create 2 Pango attribs if font style is only Underline or only Crossed).

s2.diff (1,418 bytes)
Index: lcl/interfaces/gtk2/gtk2winapi.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 62230)
+++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
@@ -1409,6 +1409,7 @@
          (lfWeight = FW_NORMAL) and
          (lfItalic = 0) and
          (lfUnderline = 0) and
+         (lfStrikeOut = 0) and
          (lfOrientation = 0) and
          IsFontNameDefault(lfFacename) then
       begin
@@ -1517,15 +1518,19 @@
           AttrList := pango_attr_list_new();
           AttrListTemporary := True;
         end;
-        if LogFont.lfUnderline <> 0 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(LogFont.lfStrikeOut<>0);
-        pango_attr_list_change(AttrList, Attr);
+        if LogFont.lfUnderline<>0 then
+        begin
+          Attr := pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+          pango_attr_list_change(AttrList, Attr);
+        end;
 
+        if LogFont.lfStrikeOut<>0 then
+        begin
+          Attr := pango_attr_strikethrough_new(True);
+          pango_attr_list_change(AttrList, Attr);
+        end;
+
         pango_layout_set_attributes(CurFont, AttrList);
         
         if AttrListTemporary then
s2.diff (1,418 bytes)

Juha Manninen

2019-11-12 23:42

developer   ~0119246

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-11-12 00:15 CudaText man New Issue
2019-11-12 00:15 CudaText man File Added: tst-crossed-text.zip
2019-11-12 06:59 CudaText man File Added: s.diff
2019-11-12 06:59 CudaText man Note Added: 0119235
2019-11-12 07:04 CudaText man File Added: s2.diff
2019-11-12 07:04 CudaText man Note Added: 0119236
2019-11-12 23:37 Juha Manninen Assigned To => Juha Manninen
2019-11-12 23:37 Juha Manninen Status new => assigned
2019-11-12 23:42 Juha Manninen Status assigned => resolved
2019-11-12 23:42 Juha Manninen Resolution open => fixed
2019-11-12 23:42 Juha Manninen Fixed in Revision => r62233
2019-11-12 23:42 Juha Manninen LazTarget => -
2019-11-12 23:42 Juha Manninen Widgetset GTK 2 => GTK 2
2019-11-12 23:42 Juha Manninen Note Added: 0119246