View Issue Details

IDProjectCategoryView StatusLast Update
0035675LazarusWidgetsetpublic2019-06-05 17:16
ReporterAlexey Tor.Assigned ToDmitry Boyarintsev 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0035675: Cocoa: bug in ExtTextOut with Dx param with Emoji
Descriptionrun the demo on Linux or Win. works ok-- shows Emoji rendered on (10,10) nicely.
Cocoa: Emoji rendered badly-- big gaps between emojis.

(bottom Emoji are TPanel.Caption - ignore them)

this is from ATSynEdit code- so I get first WideString deltas (dx), and convert them to UTF8 deltas (dx2).
TagsNo tags attached.
Fixed in Revision61323
LazTarget-
WidgetsetCocoa
Attached Files
  • moji.png (11,194 bytes)
    moji.png (11,194 bytes)
  • moji2.png (12,629 bytes)
    moji2.png (12,629 bytes)
  • emojitest.zip (2,520 bytes)
  • skipnoglyph.diff (1,166 bytes)
    Index: cocoagdiobjects.pas
    ===================================================================
    --- cocoagdiobjects.pas	(revision 61315)
    +++ cocoagdiobjects.pas	(working copy)
    @@ -1368,7 +1368,7 @@
       Context: NSGraphicsContext;
       Locations: array of NSPoint;
       Indexes: array of NSUInteger;
    -  I, Count: NSUInteger;
    +  I,j, Count: NSUInteger;
       transform : NSAffineTransform;
     begin
       Range := FLayout.glyphRangeForTextContainer(FTextContainer);
    @@ -1404,14 +1404,20 @@
         SetLength(Indexes, Count);
         Locations[0] := FLayout.locationForGlyphAtIndex(0);
         Indexes[0] := 0;
    +    j:=0;
         for I := 1 to Count - 1 do
         begin
           Locations[I] := Locations[I - 1];
    -      Locations[I].x := Locations[I].x + DX[I - 1];
    +      if FLayout.glyphAtIndex(i) <> 0 then
    +      begin
    +        Locations[I].x := Locations[I].x + DX[j];
    +        inc(j);
    +      end;
           Indexes[I] := I;
         end;
         FLayout.setLocations_startingGlyphIndexes_count_forGlyphRange(@Locations[0], @Indexes[0], Count, Range);
       end;
    +
       if FillBackground then
         FLayout.drawBackgroundForGlyphRange_atPoint(Range, Pt);
       FLayout.drawGlyphsForGlyphRange_atPoint(Range, Pt);
    
    skipnoglyph.diff (1,166 bytes)
  • moji3.png (10,183 bytes)
    moji3.png (10,183 bytes)

Activities

Alexey Tor.

2019-06-05 00:02

reporter   ~0116570

Upload hangs on 0%. Here is Github
https://github.com/Alexey-T/FreePascal-tests/tree/master/Canvas%20TextOut%20with%20Dx%20param%20with%20Emoji

Dmitry Boyarintsev

2019-06-05 14:59

developer  

moji.png (11,194 bytes)
moji.png (11,194 bytes)

Dmitry Boyarintsev

2019-06-05 15:11

developer  

moji2.png (12,629 bytes)
moji2.png (12,629 bytes)

Dmitry Boyarintsev

2019-06-05 15:14

developer  

emojitest.zip (2,520 bytes)

Dmitry Boyarintsev

2019-06-05 15:15

developer   ~0116577

upload doesn't really hang at 0% you just need to press "Add Note"
(keeping "Note" text blank is ok)

Dmitry Boyarintsev

2019-06-05 15:16

developer   ~0116579

Last edited: 2019-06-05 15:36

View 2 revisions

rendering "big gaps" seems to be pretty consistent across (utf-16 based) systems.
macOS 10.14 is seen on the screenshot

Dmitry Boyarintsev

2019-06-05 15:56

developer  

skipnoglyph.diff (1,166 bytes)
Index: cocoagdiobjects.pas
===================================================================
--- cocoagdiobjects.pas	(revision 61315)
+++ cocoagdiobjects.pas	(working copy)
@@ -1368,7 +1368,7 @@
   Context: NSGraphicsContext;
   Locations: array of NSPoint;
   Indexes: array of NSUInteger;
-  I, Count: NSUInteger;
+  I,j, Count: NSUInteger;
   transform : NSAffineTransform;
 begin
   Range := FLayout.glyphRangeForTextContainer(FTextContainer);
@@ -1404,14 +1404,20 @@
     SetLength(Indexes, Count);
     Locations[0] := FLayout.locationForGlyphAtIndex(0);
     Indexes[0] := 0;
+    j:=0;
     for I := 1 to Count - 1 do
     begin
       Locations[I] := Locations[I - 1];
-      Locations[I].x := Locations[I].x + DX[I - 1];
+      if FLayout.glyphAtIndex(i) <> 0 then
+      begin
+        Locations[I].x := Locations[I].x + DX[j];
+        inc(j);
+      end;
       Indexes[I] := I;
     end;
     FLayout.setLocations_startingGlyphIndexes_count_forGlyphRange(@Locations[0], @Indexes[0], Count, Range);
   end;
+
   if FillBackground then
     FLayout.drawBackgroundForGlyphRange_atPoint(Range, Pt);
   FLayout.drawGlyphsForGlyphRange_atPoint(Range, Pt);
skipnoglyph.diff (1,166 bytes)

Dmitry Boyarintsev

2019-06-05 15:58

developer   ~0116580

Last edited: 2019-06-05 15:58

View 2 revisions

dx-offset shown after the skipnoglyph.diff patch applied.



moji3.png (10,183 bytes)
moji3.png (10,183 bytes)

Dmitry Boyarintsev

2019-06-05 17:16

developer   ~0116581

please test and close if ok

Issue History

Date Modified Username Field Change
2019-06-04 23:52 Alexey Tor. New Issue
2019-06-05 00:02 Alexey Tor. Note Added: 0116570
2019-06-05 14:59 Dmitry Boyarintsev File Added: moji.png
2019-06-05 15:00 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2019-06-05 15:00 Dmitry Boyarintsev Status new => assigned
2019-06-05 15:11 Dmitry Boyarintsev File Added: moji2.png
2019-06-05 15:14 Dmitry Boyarintsev File Added: emojitest.zip
2019-06-05 15:15 Dmitry Boyarintsev Note Added: 0116577
2019-06-05 15:16 Dmitry Boyarintsev Status assigned => feedback
2019-06-05 15:16 Dmitry Boyarintsev LazTarget => -
2019-06-05 15:16 Dmitry Boyarintsev Note Added: 0116579
2019-06-05 15:36 Dmitry Boyarintsev Note Edited: 0116579 View Revisions
2019-06-05 15:56 Dmitry Boyarintsev File Added: skipnoglyph.diff
2019-06-05 15:58 Dmitry Boyarintsev File Added: moji3.png
2019-06-05 15:58 Dmitry Boyarintsev Note Added: 0116580
2019-06-05 15:58 Dmitry Boyarintsev Note Edited: 0116580 View Revisions
2019-06-05 17:16 Dmitry Boyarintsev Status feedback => resolved
2019-06-05 17:16 Dmitry Boyarintsev Resolution open => fixed
2019-06-05 17:16 Dmitry Boyarintsev Fixed in Revision => 61323
2019-06-05 17:16 Dmitry Boyarintsev Widgetset Cocoa => Cocoa
2019-06-05 17:16 Dmitry Boyarintsev Note Added: 0116581