#1 Re: PDF Engine » TextPositioning suggestion » 2015-03-22 10:39:24

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.

#2 PDF Engine » TextPositioning suggestion » 2015-03-21 10:42:13

falcon_b
Replies: 2

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

#3 PDF Engine » Bug in SynPdf.pas » 2015-02-26 19:40:56

falcon_b
Replies: 1

in
procedure TPdfDocumentGDI.SaveToStream(AStream: TStream; ForceModDate: TDateTime=0);

change

        FCanvas.RenderMetaFile(P.fVCLCurrentMetaFile,1,0,0,
          fUseMetaFileTextPositioning,KerningHScaleBottom,KerningHScaleBottom,
          fDisableTextClipping);

to

        FCanvas.RenderMetaFile(P.fVCLCurrentMetaFile,1,0,0,
          fUseMetaFileTextPositioning,KerningHScaleBottom,KerningHScaleTop,
          fDisableTextClipping);


in
procedure TPdfDocumentGDI.SaveToStreamDirectPageFlush;

change

        FCanvas.RenderMetaFile(P.fVCLCurrentMetaFile,1,0,0,
          fUseMetaFileTextPositioning,KerningHScaleBottom,KerningHScaleBottom,
          fDisableTextClipping);

to

        FCanvas.RenderMetaFile(P.fVCLCurrentMetaFile,1,0,0,
          fUseMetaFileTextPositioning,KerningHScaleBottom,KerningHScaleTop,
          fDisableTextClipping);

Board footer

Powered by FluxBB