#1 2015-03-21 10:42:13

falcon_b
Member
Registered: 2015-02-26
Posts: 3

TextPositioning suggestion

Look in SynPdf.pas at TPdfEnum.TextOut

To get better results if positioning method is tpSetTextJustification, rendering should switch to tpExactTextCharacterPositining if special char spacing is used.

    if R.emrtext.offDx>0 then begin
      DX := pointer(PtrUInt(@R)+R.emrtext.offDx);
      W := DXTextWidth(DX, R.emrText.nChars);
//BS.2015.03.21. - Start
      if Positioning=tpSetTextJustification then
        Positioning := tpExactTextCharacterPositining;
//BS.2015.03.21. - End
      if W<R.rclBounds.Right-R.rclBounds.Left then // offDX=0 or within box
        DX := nil;
    end else
      DX := nil;


Best regards
Sándor Bógáncs

Offline

#2 2015-03-22 09:17:36

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

Re: TextPositioning suggestion

Isn't it what tpExactTextCharacterPositining is for?

In practice, I do not see any benefit of this patch.
It will just bypass tpSetTextJustification, and replace it by tpExactTextCharacterPositining, for most generated text...

What is wrong with using tpExactTextCharacterPositining for the whole conversion?

Offline

#3 2015-03-22 10:39:24

falcon_b
Member
Registered: 2015-02-26
Posts: 3

Re: TextPositioning suggestion

Using exact position result the following:
test

As you can see the space betweeen the letters are different and the document looks ugly. The only way to keep it looking good is using SetTextJustification. But it doesn't handle character spacing. This is why I switched to the exact method in this case.

If you have any idea how to fix the character shifting problem, please let me know. It is important, that I'm using fastreport to generate PDF with the component posted in this forum.

Offline

Board footer

Powered by FluxBB