[Lazarus] Win 7 issue / Re: -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

Martin Frb lazarus at mfriebe.de
Tue Oct 6 15:23:56 CEST 2020

On 06/10/2020 15:09, Maxim Ganetsky via lazarus wrote:
> ----
> Can you try to catch it in the debugger, and see what params are given
> to NewTextOut
> in
> parentfp=0x13abf6e8)
>      at lazsyntextarea.pp:1741
>   fTextDrawer.NewTextOut(TxtLeft, rcToken.Top, TxtFlags, tok,
> ATokenInfo.Tk.TokenStart, ATokenInfo.Tk.TokenLength, FEtoBuf);
> Can you add some debugln in a format convenient to you? This will
> simplify things, I think.
This is in the paint handler, and it is called for each token. So 
potentially very slow with debugln.

But since it is in startup, hopefully you wont have to many.

Apply this patch please

diff --git a/components/synedit/lazsyntextarea.pp 
index 4c5a599c9b..163af24e6c 100644
--- a/components/synedit/lazsyntextarea.pp
+++ b/components/synedit/lazsyntextarea.pp
@@ -1737,6 +1737,7 @@ procedure TLazSynTextArea.PaintTextLines(AClip: 
TRect; FirstLine, LastLine,
      if rcToken.Right > nRightEdge + 1 then
        tok.Bottom := rcLine.Bottom;
      TxtLeft := ScreenColumnToXValue(ATokenInfo.PhysicalCharStart); // 
because for the first token, this can be middle of a char, and lead to 
wrong frame
+debugln('Calling NewTextOut L: %s rcT: %s tok: %s tkt: %s // %s // eto: 
%s', [dbgs(TxtLeft), dbgs(rcToken), dbgs(tok), 
dbgMemRange(PByte(ATokenInfo.Tk.TokenStart), ATokenInfo.Tk.TokenLength), 
dbgs(ATokenInfo.Tk.TokenLength), dbgs(Length(FEtoBuf.EtoData)) ]);
      fTextDrawer.NewTextOut(TxtLeft, rcToken.Top, TxtFlags, tok,
        ATokenInfo.Tk.TokenStart, ATokenInfo.Tk.TokenLength, FEtoBuf);

diff --git a/components/synedit/syntextdrawer.pp 
index 834d442563..ddbb09f4df 100644
--- a/components/synedit/syntextdrawer.pp
+++ b/components/synedit/syntextdrawer.pp
@@ -1267,9 +1267,14 @@ procedure TheTextDrawer.NewTextOut(X, Y: Integer; 
fuOptions: UINT;
      CharPlaceInfo.lpGlyphs:= @Glyphs[0];
      CharPlaceInfo.nGlyphs:= Length(Glyphs);
      Glyphs[0] := #0;
      if GetCharacterPlacementW(FDC, PWChar(W), Length(W), 0, 
CharPlaceInfo, GCP_LIGATE or GCP_REORDER or GCP_GLYPHSHAPE)<> 0 then begin
+debugln('GOT PLACEMENT %s  / %s  / %s', [dbgs(length(Glyphs)), 
dbgs(CharPlaceInfo.nGlyphs), dbgs(CharPlaceInfo.lpGlyphs=@Glyphs[0]) ]);
+if CharPlaceInfo.nGlyphs > 0 then begin
+debugln('GOT --- %s  / %s', [dbgs(length(Glyphs)), 
dbgMemRange(CharPlaceInfo.lpGlyphs, 2*CharPlaceInfo.nGlyphs)]);
        Windows.ExtTextOutW(FDC, X, Y, fuOptions or ETO_GLYPH_INDEX, 
@ARect, Pointer(Glyphs), CharPlaceInfo.nGlyphs, EtoArray);

More information about the lazarus mailing list