#1 2013-03-05 16:47:53

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

SetWordSpace in SynPdf.pas

Hi,

I detect a problem when SetWordSpace is called in function TextOut in SynPdf.pas (line 8908).
After WordSpace is set, it's set to all following elements.

to fix this :

if Canvas.fUseSetTextJustification and (nspace>0) and ((W-measW)>(nspace*2)) then
        // we should have had a SetTextJustification() call -> modify word space
        with Canvas do
          SetWordSpace(((W-measW) * fscaleX)/nspace)
      else begin
        Canvas.SetWordSpace(0);
        // check if DX[] width differs from PDF width
        nspace := 0;
        hscale := (W*100) / measW;

I add SetWordSpace(0) in else condition.


and in SetWordSpace function :

procedure TPdfCanvas.SetWordSpace(wordSpace: Single);
begin
  //if FPage.WordSpace=wordSpace then Exit;
  FPage.SetWordSpace(wordSpace);
  if FContents<>nil then
    FContents.Writer.AddWithSpace(wordSpace).Add('Tw'#10);
end;

If you have a better solution...

Fabien.

Offline

#2 2013-03-06 09:06:12

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

Re: SetWordSpace in SynPdf.pas

AFAIK there is already this code line later in the method:

    if nspace>0 then
      Canvas.SetWordSpace(0);

So I suspect forcing Canvas.SetWordSpace(0) does not make sense.

Offline

Board footer

Powered by FluxBB