#1 2013-07-16 09:52:21

TSW
Member
Registered: 2013-07-16
Posts: 3

Embedded font problems with barcode font "Code 2 of 5 interleaved"

Hello!

I've got a problem with embedding the font "Code 2 of 5 interleaved" ( Grandzebu. 2005. All Rights Reserved - GNU General Public License ).
The font is not rendered correctly if i don't embed the whole TTF ( EmbeddedWholeTTF:=FALSE ).
The font is listed as embeded ( pdffont )

Code2of5interleaved                  TrueType          yes no  no      14  0
Code2of5interleaved                  CID TrueType      yes no  yes   16  0

but even if i have installed the font on my pc, no text(code) is visible.

the main problem is, if i set EmbeddedWholeTTF:=TRUE, the pdf file gets really fast, really big. Maybe a problem with the font "Arial Unicode MS". Because if i do not exclude this font with (EmbeddedTTFIgnore) , two pdf pages are about 45MB.

there is another topic with the same problem "http://synopse.info/forum/viewtopic.php?id=889" (Embedding a TTF barcode font).
Sadly the author did not wrote how he fixed the problem.

Any other font works.

Using synpdf 1.18.
i'm drawing from an already created canvas to the TPDFDocumentGDI.vclcanvas

Best
Sven

Offline

#2 2013-07-16 13:39:47

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

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

The sub-font embedding is done by using the dedicated Windows API.
If this API is not able to embed this symbol font, it is weird.

Perhaps, you can ask "Acrobater", which wrote http://synopse.info/forum/viewtopic.php?pid=5409#p5409

The later version did not help, but I think it is likely that this problem is because the font is non-standard in some way. We've found a way around the problem now so it is not a hold up anymore.

Offline

#3 2013-07-16 15:13:36

TSW
Member
Registered: 2013-07-16
Posts: 3

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

CreateFontPackage returns 0 = ok.
But interesting is that the font uses only widechar. i.e 61473,61477,61490,61562,61563,61641,61642

Offline

#4 2013-07-17 06:27:23

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

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

Could you try to add a ' ' codebar char in the emf, to force use of ascii chars?
Perhaps there is an issue if the font does not use ascii chars (even if I remember that is has already been tested and should be fixed).
Ensure you use the latest version of SynPdf.

Offline

#5 2013-07-17 10:33:51

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

Another option could be to draw the barcode directly without using a font. I've pulled out of an old project my attempt at 'interleaved 2 of 5' below which might be helpful.

type
  TBarCodeWidths = array[0..4] of shortint;

const
  bar0 : TBarCodeWidths = (10,10,30,30,10);
  bar1 : TBarCodeWidths = (30,10,10,10,30);
  bar2 : TBarCodeWidths = (10,30,10,10,30);
  bar3 : TBarCodeWidths = (30,30,10,10,10);
  bar4 : TBarCodeWidths = (10,10,30,10,30);
  bar5 : TBarCodeWidths = (30,10,30,10,10);
  bar6 : TBarCodeWidths = (10,30,30,10,10);
  bar7 : TBarCodeWidths = (10,10,10,30,30);
  bar8 : TBarCodeWidths = (30,10,10,30,10);
  bar9 : TBarCodeWidths = (10,30,10,30,10);

var
  digits: string;
  x, y, barHeight: integer;
  barA, barB : TBarCodeWidths;
  digit1, digit2 : char;

begin
  ...
              while length(digits)<6 do digits := '0'+digits;
              canvas.Brush.Style := bsSolid;
              canvas.Brush.Color := clBlack;
              barheight := 60;
              x := 0;
              y := 0;
              Canvas.FillRect(Rect(y,x,y+10,x+BarHeight));
              y := y+20 ;
              Canvas.FillRect(Rect(y,x,y+10,x+BarHeight));
              y := y+20 ;
              for ii := 0 to 2 do begin
                Digit1 := digits[(ii*2)+1];
                Digit2 := digits[(ii*2)+2];
                Case digit1 of
                  '0' : for z := 0 to 4 do bara[z] := bar0[z];
                  '1' : for z := 0 to 4 do bara[z] := bar1[z];
                  '2' : for z := 0 to 4 do bara[z] := bar2[z];
                  '3' : for z := 0 to 4 do bara[z] := bar3[z];
                  '4' : for z := 0 to 4 do bara[z] := bar4[z];
                  '5' : for z := 0 to 4 do bara[z] := bar5[z];
                  '6' : for z := 0 to 4 do bara[z] := bar6[z];
                  '7' : for z := 0 to 4 do bara[z] := bar7[z];
                  '8' : for z := 0 to 4 do bara[z] := bar8[z];
                  '9' : for z := 0 to 4 do bara[z] := bar9[z];
                end;
                Case digit2 of
                  '0' : for z := 0 to 4 do barb[z] := bar0[z];
                  '1' : for z := 0 to 4 do barb[z] := bar1[z];
                  '2' : for z := 0 to 4 do barb[z] := bar2[z];
                  '3' : for z := 0 to 4 do barb[z] := bar3[z];
                  '4' : for z := 0 to 4 do barb[z] := bar4[z];
                  '5' : for z := 0 to 4 do barb[z] := bar5[z];
                  '6' : for z := 0 to 4 do barb[z] := bar6[z];
                  '7' : for z := 0 to 4 do barb[z] := bar7[z];
                  '8' : for z := 0 to 4 do barb[z] := bar8[z];
                  '9' : for z := 0 to 4 do barb[z] := bar9[z];
                end;
                for z := 0 to 4 do begin
                  Canvas.FillRect(Rect(y,x,(y+bara[z]),x+BarHeight));
                  y := y+bara[z]+barb[z] ;
                end;
              end;
              canvas.FillRect(Rect(y,x,y+30,x+BarHeight));
              canvas.FillRect(Rect(y+40,x,y+50,x+BarHeight));

...

Offline

#6 2013-07-18 09:24:51

TSW
Member
Registered: 2013-07-16
Posts: 3

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

thank you, both of you.
I did a workaround by embedding every font completly if they have at least one widechar.
it works fine. We are using "2 of 5" and "code 128" both of them only work, if they are completly embedded.

Offline

#7 2013-12-31 03:45:32

makaveiljojo
Member
Registered: 2013-12-31
Posts: 2

Re: Embedded font problems with barcode font "Code 2 of 5 interleaved"

TSW wrote:

thank you, both of you.
I did a workaround by embedding every font completly if they have at least one widechar.
it works fine. We are using "2 of 5" and "code 128" both of them only work, if they are completly embedded.

Hi, I got some similiar issue here. But I'm little bit confused about "completly" embedded, "completly" like how? I'm new at this and embedding interleaved 2 of 5 is such a headache for me. Thanks in advance!

Offline

Board footer

Powered by FluxBB