mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 01:49:25 +02:00
LCL, fix escaping invalid postscript string chars, issue #15920
git-svn-id: trunk@24001 -
This commit is contained in:
parent
6e3d7d6e7d
commit
48d85e8ca9
@ -95,7 +95,6 @@ Type
|
||||
procedure UpdateFillColor;
|
||||
procedure UpdateFont;
|
||||
function MappedFontName: string;
|
||||
function MapedString(const St : string):string;
|
||||
|
||||
procedure MoveToLastPos;
|
||||
procedure SetBrushFillPattern(Lst : TStringList; SetBorder,SetFill : Boolean);
|
||||
@ -887,19 +886,6 @@ begin
|
||||
Result:=Result+'-'+Atr;
|
||||
end;
|
||||
|
||||
//Replace the controls chars by PostScript string
|
||||
function TPostScriptPrinterCanvas.MapedString(const St: string): string;
|
||||
begin
|
||||
Result:=St;
|
||||
Result:=StringReplace(Result,'\','\\',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,'(','\(',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,')','\)',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,#10,'\n',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,#13,'\r',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,#8, '\b',[rfReplaceAll]);
|
||||
Result:=StringReplace(Result,#9, '\t',[rfReplaceAll]);
|
||||
end;
|
||||
|
||||
//Move pen at last pos
|
||||
procedure TPostScriptPrinterCanvas.MoveToLastPos;
|
||||
var
|
||||
@ -2003,14 +1989,14 @@ begin
|
||||
PosUnder:=(Abs(Round(GetFontSize/3))*-1)+2;
|
||||
rotate();
|
||||
Write(format('%f %f uli',[pp.fx,pp.fy],FFs));
|
||||
FPSUnicode.OutputString(MapedString(Text));
|
||||
FPSUnicode.OutputString(Text);
|
||||
write(Format('%.3f %d ule',[PenUnder,PosUnder],FFs));
|
||||
end
|
||||
else
|
||||
begin
|
||||
write(Format('%f %f moveto',[pp.fx,pp.fy],FFs));
|
||||
rotate();
|
||||
FPSUnicode.OutputString(MapedString(Text));
|
||||
FPSUnicode.OutputString(Text);
|
||||
end;
|
||||
|
||||
if saved then
|
||||
|
@ -316,7 +316,7 @@ var
|
||||
{$ENDIF}
|
||||
w: word;
|
||||
i, b: Integer;
|
||||
c: byte;
|
||||
c: char;
|
||||
SubStr,FontStr: string;
|
||||
FontIndex: Integer;
|
||||
|
||||
@ -343,11 +343,11 @@ begin
|
||||
FontStr := SelectFont(Font, FontSize, FontStyle, b);
|
||||
end;
|
||||
|
||||
c := byte(w-FBlocks[b].Ini);
|
||||
if (c<32) {or (c>128)} then
|
||||
SubStr := SubStr + Octal(c)
|
||||
c := Char(Byte(w-FBlocks[b].Ini));
|
||||
if c in [#0..#31,'(',')','\'] then
|
||||
SubStr := SubStr + Octal(ord(c))
|
||||
else
|
||||
SubStr := SubStr + char(c);
|
||||
SubStr := SubStr + c;
|
||||
end;
|
||||
|
||||
EmitSubStr;
|
||||
|
Loading…
Reference in New Issue
Block a user