View Issue Details

IDProjectCategoryView StatusLast Update
0035695PatchesWidgetsetpublic2019-06-09 22:03
ReporterAlexey Tor.Assigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0035695: Gtk3: implement font styles: underline, strikethrough
DescriptionIt was added by copy/paste from GTK2 code.
Tested on a form with label.
TagsNo tags attached.
Fixed in Revisionr61348
LazTarget-
WidgetsetGTK 3
Attached Files
  • fnt.diff (1,380 bytes)
    Index: lcl/interfaces/gtk3/gtk3objects.pas
    ===================================================================
    --- lcl/interfaces/gtk3/gtk3objects.pas	(revision 61344)
    +++ lcl/interfaces/gtk3/gtk3objects.pas	(working copy)
    @@ -465,6 +465,9 @@
     var
       AContext: PPangoContext;
       ADescription: PPangoFontDescription;
    +  AttrList: PPangoAttrList;
    +  AttrListTemporary: Boolean;
    +  Attr: PPangoAttribute;
     begin
       FLogFont := ALogFont;
       FFontName := ALogFont.lfFaceName;
    @@ -495,6 +498,30 @@
       FLayout := pango_layout_new(AContext);
       FLayout^.set_font_description(FHandle);
     
    +  if (ALogFont.lfUnderline<>0) or (ALogFont.lfStrikeOut<>0) then
    +  begin
    +    AttrListTemporary := false;
    +    AttrList := pango_layout_get_attributes(FLayout);
    +    if (AttrList = nil) then
    +    begin
    +      AttrList := pango_attr_list_new();
    +      AttrListTemporary := True;
    +    end;
    +    if ALogFont.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(ALogFont.lfStrikeOut<>0);
    +    pango_attr_list_change(AttrList, Attr);
    +
    +    pango_layout_set_attributes(FLayout, AttrList);
    +
    +    if AttrListTemporary then
    +      pango_attr_list_unref(AttrList);
    +  end;
    +
       g_object_unref(AContext);
     end;
     
    
    fnt.diff (1,380 bytes)

Activities

Alexey Tor.

2019-06-09 12:17

reporter  

fnt.diff (1,380 bytes)
Index: lcl/interfaces/gtk3/gtk3objects.pas
===================================================================
--- lcl/interfaces/gtk3/gtk3objects.pas	(revision 61344)
+++ lcl/interfaces/gtk3/gtk3objects.pas	(working copy)
@@ -465,6 +465,9 @@
 var
   AContext: PPangoContext;
   ADescription: PPangoFontDescription;
+  AttrList: PPangoAttrList;
+  AttrListTemporary: Boolean;
+  Attr: PPangoAttribute;
 begin
   FLogFont := ALogFont;
   FFontName := ALogFont.lfFaceName;
@@ -495,6 +498,30 @@
   FLayout := pango_layout_new(AContext);
   FLayout^.set_font_description(FHandle);
 
+  if (ALogFont.lfUnderline<>0) or (ALogFont.lfStrikeOut<>0) then
+  begin
+    AttrListTemporary := false;
+    AttrList := pango_layout_get_attributes(FLayout);
+    if (AttrList = nil) then
+    begin
+      AttrList := pango_attr_list_new();
+      AttrListTemporary := True;
+    end;
+    if ALogFont.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(ALogFont.lfStrikeOut<>0);
+    pango_attr_list_change(AttrList, Attr);
+
+    pango_layout_set_attributes(FLayout, AttrList);
+
+    if AttrListTemporary then
+      pango_attr_list_unref(AttrList);
+  end;
+
   g_object_unref(AContext);
 end;
 
fnt.diff (1,380 bytes)

Juha Manninen

2019-06-09 22:03

developer   ~0116649

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-06-09 12:17 Alexey Tor. New Issue
2019-06-09 12:17 Alexey Tor. File Added: fnt.diff
2019-06-09 16:45 Juha Manninen Assigned To => Juha Manninen
2019-06-09 16:45 Juha Manninen Status new => assigned
2019-06-09 22:03 Juha Manninen Status assigned => resolved
2019-06-09 22:03 Juha Manninen Resolution open => fixed
2019-06-09 22:03 Juha Manninen Fixed in Revision => r61348
2019-06-09 22:03 Juha Manninen LazTarget => -
2019-06-09 22:03 Juha Manninen Widgetset GTK 3 => GTK 3
2019-06-09 22:03 Juha Manninen Note Added: 0116649