You are not logged in.
Pages: 1
As i want to convert the QuickReport to PDF and after reading this post: http://synopse.info/forum/viewtopic.php?id=138 and followed the steps, i found that it works great on the english words but the chinese words inside the report became garbled, so, is it the pdf engine doesn't support chinese words or i am missing something? Thank you! Below is the code snippet i used to convert the report -
pdf:=TPdfDocument.Create;
try
QRep.Prepare;
for i:=1 to QRep.QRPrinter.PageCount do begin
aMeta := QRep.QRPrinter.GetPage(i);
try
pdf.DefaultPageWidth := MulDiv(aMeta.Width, 72, pdf.ScreenLogPixels);
pdf.DefaultPageHeight := MulDiv(aMeta.Height, 72, pdf.ScreenLogPixels);
pdf.AddPage;
pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
finally
aMeta.Free;
end;
end;
pdf.SaveToFile(fileName);
finally
pdf.Free;
end;
Offline
As stated by the documentation, font fallback is not handled yet:
- the PDF engine don't handle Font Fallback yet: the font you use
must contain ALL glyphs necessary for the supplied unicode text - squares
or blanks will be drawn for any missing glyph/character
This is a common issue with the current implementation.
If you search in the forum, you'll find out it is the case. See http://synopse.info/forum/viewtopic.php?id=530 and http://synopse.info/forum/viewtopic.php?id=309 and many other.
We should implement font fallback perhaps not with a TTF font or UniScribe (a very complex solution), but via built-in fonts of Acrobat Reader, i.e. the TPdfFontCIDFontType2 class.
/// an embedded Composite CIDFontType2
// - i.e. a CIDFont whose glyph descriptions are based on TrueType font technology
// - typicaly handle Japan or Chinese standard fonts
// - used with MBCS encoding, not WinAnsi
TPdfFontCIDFontType2 = class(TPdfFont)
{ TODO: implement standard TPdfFontCIDFontType2 MBCS font }
end;
So you did nothing wrong, it is just a current limitation of the unit.
Perhaps you may help fixing it?
Offline
I've just added font fallback for:
- SynPDF unit (PDF file generation);
- SynGDIPlus unit (anti-aliased drawing).
Of course, both of these new features are handled by the SQlite3Pages unit, i.e. for report anti-aliased drawing preview and PDF generation.
By the way, the TGDIPages class handle now by default Unicode text, even with Delphi versions prior to 2009 (via the SynUnicode string type, which maps WideString before Delphi 2009, then UnicodeString starting with Delphi 2009).
See http://synopse.info/fossil/info/d51f063e76
This should fix your issue with Chinese characters.
They are now able to use a fallback font (by default, 'Arial Unicode MS') if some characters not included within the current font glyphs are encountered.
Offline
Today, for the first time learning to use logging, found that the Chinese logging into a ? Symbol, Will need any special configuration?
Environment:
mORMot: 1.17
OS: Windows XP sp3
IDE : Delphi7
Last edited by Feng (2013-05-15 07:46:08)
Offline
Today, for the first time learning to use logging, found that the Chinese logging into a ? Symbol, Will need any special configuration?
Environment:
mORMot: 1.17
OS: Windows XP sp3
IDE : Delphi7
Download the latest version 1.18, the problem is still not resolved for help.
Offline
Eventually found the source of the problem:
The format of the log is written not in UTF-8 format, but the Logview open call UTF8ToString.
Offline
Logs are created in UTF-8 format, but with no BOM prolog.
Indeed, this is the case.
Offline
ab wrote:Logs are created in UTF-8 format, but with no BOM prolog.
Indeed, this is the case.
The feeling is not the lack of the BOM prolog.,Hexadecimal open the file to see the file is not Unicode-encoded.
Offline
How do you write your Chinese content to the log?
Which version of Delphi are you using? (Unicode ready?)
I write this:
with TSynLog.Family do
begin
Level := LOG_VERBOSE;
OnArchive := EventArchiveSynLZ;
ArchiveAfterDays := 1; // archive after one day
end;
TSynLog.Add.Log(sllInfo, '准备开始下载文件 ...');
My version of IDE is Delphi7(build 4.453)
Offline
Just because it is Delphi 7, does not support the unicode, right?
Offline
In fact, Delphi 7 does not know that RawUTF8 is UTF-8 encoded... but Delphi 2009+ would be able to do the conversion to UTF-8 as expected.
So you can do this conversion via a StringToUTF8() call.
It will work for both Delphi 7 and Delphi 2009+.
And it will be faster than the default conversion code used in Delphi 2009+.
Our internal practice is to only log in English.
Some values can be in UTF-8/Unicode, but the log text is in English only, for coherency.
Of course, this is a matter of taste. But it explain why we did not make any specific handling of string here, since English text is the same in Delphi 7 after UTF-8 encoding.
Offline
Pages: 1