#1 Re: PDF Engine » UTF-8 Characters Printed as Boxes » 2016-11-21 13:34:40

Tried turning UniScribe on and off with various settings, no luck. Interestingly with UniScribe on 4 byte characters render as single boxes, with UniScribe off those characters are rendered as two overlapping boxes.

#3 PDF Engine » UTF-8 Characters Printed as Boxes » 2016-11-21 07:44:49

petrih
Replies: 5

Hello!

I'm having problems with some 3 and 4 byte characters in PDFs, they come out as [] boxes. I've got the example code here, as I understand the font should have the glyph (fallback font is the same Arial Unicode MS as well) but it won't print many 3-4 byte characters. Is this just something not supported yet or am I missing something? smile

  Doc:=TPdfDocumentGDI.Create;
  Doc.AddPage;
  Rect := TRect.Create(10, 10, 200, 200);
  Doc.VCLCanvas.Font.Name := 'Arial Unicode MS';
  Doc.VCLCanvas.TextRect(Rect, 20, 20, '?'); // Text is either directly pasted character from http://www.i18nguy.com/unicode/supplementary-test.html#utf8 or read from .txt file
  Doc.SaveToFile('test.pdf');

#4 Re: PDF Engine » Text font messed up with small font and clear brush » 2016-06-01 10:43:23

Meaning the ScreenLogPixels-property? Tried messing with it but seems it doesn't affect this. Interesting thing is that if I draw text at font 9, every textrect after it is drawn properly.

  Doc:=TPdfDocumentGDI.Create;
  Doc.ScreenLogPixels := 72;
  Doc.AddPage;

  Doc.VCLCanvas.Brush.Style:=bsClear;
  Doc.VCLCanvas.Font.Name := 'Arial';
  Doc.VCLCanvas.Font.Size := 1;
  Rect := TRect.Create(195,28,594,41);
  Doc.VCLCanvas.TextRect(Rect, 218, 28, '...');

  Rect.Top := 45;
  Rect.Bottom := 59;
  Doc.VCLCanvas.Font.Size := 8;
  Doc.VCLCanvas.TextRect(Rect, 218, 45, 'Test');
  Rect.Top := 60;
  Rect.Bottom := 76;
  Doc.VCLCanvas.Font.Size := 9;
  Doc.VCLCanvas.TextRect(Rect, 218, 60, 'Test');
  Rect.Top := 77;
  Rect.Bottom := 92;
  Doc.VCLCanvas.Font.Size := 8;
  Doc.VCLCanvas.TextRect(Rect, 218, 77, 'Test');

  Doc.SaveToFile('test.pdf');

Running this gives pdf looking bit like this, in 200% zoom in pdf viewer:
Z9vtWDZ.png?1
Topmost line is the three dots drawn in font size 1, which triggers weird font for subsequent textrects. Second line is the font size 8 Test-text, which is in the weird font. Third line is font size 9 Test-text, which is drawn as expected and after this any further textrects are in the expected font, such as the fourth line size 8 Test-text.

#5 Re: PDF Engine » Text font messed up with small font and clear brush » 2016-06-01 05:57:34

Thanks for tip! Tested without PixelsPerInc and still some problems. Font size 9 prints out as it should be now, but at least font sizes 8, 10 and 11 (possibly more) still has the same problem.

procedure TForm1.Button3Click(Sender: TObject);
var
  Doc: TPdfDocumentGDI;
  Rect: TRect;
begin
  Doc:=TPdfDocumentGDI.Create;
  Doc.AddPage;

  Doc.VCLCanvas.Brush.Style:=bsClear;
  Doc.VCLCanvas.Font.Name := 'Arial';
  Doc.VCLCanvas.Font.Size := 1;
  Rect := TRect.Create(195,28,594,41);
  Doc.VCLCanvas.TextRect(Rect, 218, 28, '...');


  Rect.Top := 45;
  Rect.Bottom := 59;
  Doc.VCLCanvas.Font.Size := 10; // this works with 9, but breaks with 8, 10, 11
  Doc.VCLCanvas.TextRect(Rect, 218, 45, 'Test');

  Doc.SaveToFile('test.pdf');
end;

#6 PDF Engine » Text font messed up with small font and clear brush » 2016-05-31 09:09:37

petrih
Replies: 4

Here's an example code:

procedure TForm1.Button1Click(Sender: TObject);
var
  Doc: TPdfDocumentGDI;
  Rect: TRect;
begin
  Doc:=TPdfDocumentGDI.Create;
  Doc.AddPage;

  Doc.VCLCanvas.Brush.Style:=bsClear;
  Doc.VCLCanvas.Font.Name := 'Arial';
  Doc.VCLCanvas.Font.Size := 1;
  Doc.VCLCanvas.Font.PixelsPerInch := 75;

  Rect := TRect.Create(2,0,594,16);
  Doc.VCLCanvas.TextRect(Rect, 2, 0, '...');

  Rect.Top := 16;
  Rect.Bottom := 31;
  Doc.VCLCanvas.Font.Size := 9;
  Doc.VCLCanvas.TextRect(Rect, 2, 19, 'Abc');

  Doc.SaveToFile('test.pdf');
end;

It creates a simple pdf, draws '...' to the canvas at font size 1, then draws 'Abc' at font size 9 under it and finally saves it to a file.

The problem is that 'Abc' is sort of stretched across, completely messing the text:
9NozuxJ.png

Any idea what is causing this or is it a bug in the PDF engine?

#7 Re: PDF Engine » Problem validating PDF/A format » 2015-10-23 08:25:06

Oops, sorry, fumbled with Fossil a bit. I made a pull request on Github instead. smile

#8 Re: PDF Engine » Problem validating PDF/A format » 2015-10-23 05:37:17

Hi!
I've studied the problem and the date synchronization issues come from CreationDate and ModDate lacking the timezone designator in the document information dictionary, which is 'Z' for the current xmp definition. I pushed this commit on Fossil.

StructTreeRoot validation for the site linked can be satisfied just by having an empty StructTreeRoot object in the document catalog dictionary, but I'm not sure if it's really required for the standard. What its purpose is, is explained in http://partners.adobe.com/public/develo … erence.pdf section 9.6.1 Structure Hierarchy.

Board footer

Powered by FluxBB