#1 2013-03-05 13:13:23

ElFab
Member
Registered: 2013-03-05
Posts: 2

Problem with font style is underline

Hi,

I use your library to export Fast-Report report and it it works well.
But, there is one problem when underline is affect to font.style.

in procedure DrawLine in SynPdf.pas, WithClip variable is set to False, but never reset to his old value.
After this, nothing is drawn.

I propose to fix as Below :

procedure DrawLine(var P: TPoint; aH: Single);
var
  tmp: TPdfEnumStatePen;
  BakWithCli: Boolean;
  BakbOpaque: boolean;
begin
  BakWithCli := WithClip;
  BakbOpaque := bOpaque;
  try
    WithClip := False;
    bOpaque := False;

    with DC[nDC] do begin
      tmp := Pen;
      pen.color := font.color;
      pen.width := aSize / 15 / Canvas.GetWorldFactorX / Canvas.FDevScale;
      pen.style := PS_SOLID;
      pen.null := False;
      NeedPen;
      if font.spec.angle=0 then begin
        Canvas.MoveToI(P.X,(P.Y-(H-aH)));
        Canvas.LineToI(P.X+W+wW,(P.Y-(H-aH)));
      end else begin
        Canvas.MoveToI(P.X+(W*acos-(H-aH)*asin), P.Y-(((H-aH)*acos-W*asin)));
        Canvas.LineToI(P.X+((W+wW)*acos-(H-aH)*asin),P.Y-(((H-aH)*acos-(W-wW)*asin)));
      end;
      Canvas.Stroke;
      Pen := tmp;
    end;

  finally
    WithClip := BakWithCli;
    bOpaque := BakbOpaque;
  end;
end;

Fabien.

Offline

#2 2013-03-05 14:12:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: Problem with font style is underline

I suspect both withClip := false and bOpaque := false are just not needed.

It is not even needed to save them.
Since they are not used within the procedure (MoveTo/LineTo do not use those).

Offline

Board footer

Powered by FluxBB