#1 2016-11-21 07:44:49

petrih
Member
Registered: 2015-10-22
Posts: 8

UTF-8 Characters Printed as Boxes

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');

Offline

#2 2016-11-21 09:04:08

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

Re: UTF-8 Characters Printed as Boxes

Which version of Delphi are you using?

Offline

#3 2016-11-21 10:55:56

petrih
Member
Registered: 2015-10-22
Posts: 8

Re: UTF-8 Characters Printed as Boxes

XE8 currently.

Offline

#4 2016-11-21 12:47:04

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

Re: UTF-8 Characters Printed as Boxes

We rely on UniScribe directly for such rendering.
You may try to disable UniScribe, and see how it renders.

Offline

#5 2016-11-21 13:34:40

petrih
Member
Registered: 2015-10-22
Posts: 8

Re: UTF-8 Characters Printed as Boxes

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.

Offline

#6 2016-11-21 14:00:23

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

Re: UTF-8 Characters Printed as Boxes

Are you SURE those glyphs are part of your Arial Unicode MS ?

Offline

Board footer

Powered by FluxBB