PowerPDF, initial fix for output of text no converted from UTF8 to ansi encoding on linux (which do not do ansi convertion)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@956 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jesusr
2009-09-08 19:28:31 +00:00
parent a2b1693f96
commit 781bcb652c
2 changed files with 18 additions and 0 deletions

View File

@ -2003,10 +2003,14 @@ procedure TPdfCanvas.ShowText(s: string);
var
FString: string;
begin
{$IFDEF LAZ_POWERPDF}
FString := '<' + _UTF8StrToUnicodeHex(s) + '>';
{$ELSE}
if _HasMultiByteString(s) then
FString := '<' + _StrToHex(s) + '>'
else
FString := '(' + _EscapeText(s) + ')';
{$ENDIF}
WriteString(FString + ' Tj'#10);
end;

View File

@ -299,6 +299,7 @@ type
function _GetCharCount(Text: string): integer;
{$IFDEF LAZ_POWERPDF}
function _UTF8StrToUnicodeHex(const Value:string): string;
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; Alias: string);
function PdfLazFindClass(aClassName: string):TPersistentClass;
{$ENDIF}
@ -1143,6 +1144,19 @@ begin
end;
{$IFDEF LAZ_POWERPDF}
function _UTF8StrToUnicodeHex(const Value: string): string;
var
W: Widestring;
i: Integer;
begin
result := '';
W := UTF8Decode(Value);
for i:=1 to Length(W) do begin
Result := Result + IntTohex(Word(W[i]), 4);
end;
end;
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; Alias: string);
begin
Classes.RegisterClass(aClass);