#1 2022-04-06 13:28:23

SvenJ
Member
Registered: 2022-04-06
Posts: 4

Problem with Code 128 and Code2of5interleaved

Hi,

we are using SynPDF to create our PDF files in Delphi6.
Now we ported our applications to Delphi11 and we have a problem with the Font "Code 128" and "Code2of5interleaved"

In Delphi 6 we are using SynPDF 1.18 from 2013 and both Fonts are recognized as UNICODE in TPdfFontTrueType.Create and so fUnicode is TRUE for PrepareForSaving;
Both Fonts correctly implemented into the PDF.

but in the SynPDF version from 2022 both Fonts are not recognized as UNICODE and both Fonts displayed only as empty squares in any PDF Viewer.

Example
synpdf.png

Can anyone help what we are doing wrong?

Thx
Sven

Edit : for testing i used the old code from 2013 from synpdf in Delphi 11 and i have the same problem. somehow FindOrAddUsedWideChar isnt called in Delphi 11 in GetWideCharWidth.
where in my D6 project the font is added as unicode.

Last edited by SvenJ (2022-04-06 15:27:50)

Offline

#2 2022-04-07 06:58:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
Website

Re: Problem with Code 128 and Code2of5interleaved

On the same Windows system?

Offline

#3 2022-04-07 07:15:36

SvenJ
Member
Registered: 2022-04-06
Posts: 4

Re: Problem with Code 128 and Code2of5interleaved

Yes on the same Windows System.

Offline

#4 2022-04-07 07:32:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
Website

Re: Problem with Code 128 and Code2of5interleaved

Perhaps the

self := self.WinAnsiFont;

line was wrongly interpreted by the Delphi 11 compiler...

Do https://synopse.info/fossil/info/b711245224 fix your issue?
(I don't have Delphi 11 so I can't verify)

Offline

#5 2022-04-07 07:47:30

SvenJ
Member
Registered: 2022-04-06
Posts: 4

Re: Problem with Code 128 and Code2of5interleaved

hey. no that doesnt help.
but i have a dirty solution that works.

the both fonts are not recognized as SymbolFonts. so i added following to the code and it works.

procedure TPdfWrite.AddUnicodeHexTextNoUniScribe(PW: PWideChar;
  TTF: TPdfFontTrueType; NextLine: boolean; Canvas: TPdfCanvas);
var Ansi: integer;
    isSymbolFont: Boolean;
begin

  if TTF<>nil then begin
    if TTF.UnicodeFont<>nil then isSymbolFont := TTF.UnicodeFont.fIsSymbolFont
    else begin
      isSymbolFont := TTF.fIsSymbolFont;
      (* ------------------ > *)if TTF.fName = 'Code128' then isSymbolFont:=TRUE; // if Code128 then force isSymbolFont
    end;

Offline

#6 2022-04-07 10:45:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
Website

Re: Problem with Code 128 and Code2of5interleaved

Could you check in TPdfTTF.Create why fIsSymbolFont := true is not set for your Code128 font on Delphi 11?

Are you sure the WideChar supplied for printing the barcode are correct?
How do you create the page?
Perhaps it is an encoding problem due to the Delphi Unicode.

Offline

#7 2022-04-07 12:13:45

SvenJ
Member
Registered: 2022-04-06
Posts: 4

Re: Problem with Code 128 and Code2of5interleaved

Hey.

ab wrote:

Could you check in TPdfTTF.Create why fIsSymbolFont := true is not set for your Code128 font on Delphi 11?

TPdfTTF.Create is never been called for that Font. its only been called when i add my change from above.

ab wrote:

Are you sure the WideChar supplied for printing the barcode are correct?

how can i verify this?

ab wrote:

How do you create the page?

we are using GMPrintSuite and draw onto TPDFDocumentGDI.vclcanvas

preview.p1.Pages[i].DrawToCanvas(lpdf.vclcanvas,SCREEN_PPI,SCREEN_PPI,false);

Offline

#8 2022-04-27 17:16:17

rvk
Member
Registered: 2022-04-14
Posts: 47

Re: Problem with Code 128 and Code2of5interleaved

SvenJ wrote:

but in the SynPDF version from 2022 both Fonts are not recognized as UNICODE and both Fonts displayed only as empty squares in any PDF Viewer.

I had the same issue. See topic https://synopse.info/forum/viewtopic.php?pid=37219
This has been fixed in revision 211.
Maybe it works for you now too.

Offline

Board footer

Powered by FluxBB