You've already forked lazarus-ccr
PowerPDF, optimization for code size and speed, from Luiz Americo, issue 23328
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2654 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -53,8 +53,6 @@ uses
|
|||||||
SysUtils, Classes
|
SysUtils, Classes
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
, Types
|
, Types
|
||||||
{$ELSE}
|
|
||||||
, Windows
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF LAZ_POWERPDF}
|
{$IFDEF LAZ_POWERPDF}
|
||||||
, LCLProc
|
, LCLProc
|
||||||
@ -275,7 +273,7 @@ type
|
|||||||
|
|
||||||
TPdfXref = class(TPdfObjectMgr)
|
TPdfXref = class(TPdfObjectMgr)
|
||||||
private
|
private
|
||||||
FXrefEntries: TList;
|
FXrefEntries: TFpList;
|
||||||
function GetItem(ObjectID: integer): TPdfXrefEntry;
|
function GetItem(ObjectID: integer): TPdfXrefEntry;
|
||||||
function GetItemCount: integer;
|
function GetItemCount: integer;
|
||||||
protected
|
protected
|
||||||
@ -309,8 +307,8 @@ type
|
|||||||
FXref: TPdfXref;
|
FXref: TPdfXref;
|
||||||
FInfo: TPdfInfo;
|
FInfo: TPdfInfo;
|
||||||
FHasDoc: boolean;
|
FHasDoc: boolean;
|
||||||
FFontList: TList;
|
FFontList: TFpList;
|
||||||
FObjectList: TList;
|
FObjectList: TFpList;
|
||||||
FOutlineRoot: TPdfOutlineRoot;
|
FOutlineRoot: TPdfOutlineRoot;
|
||||||
FXObjectList: TPdfArray;
|
FXObjectList: TPdfArray;
|
||||||
FDefaultPageWidth: Word;
|
FDefaultPageWidth: Word;
|
||||||
@ -325,21 +323,21 @@ type
|
|||||||
procedure CreateInfo;
|
procedure CreateInfo;
|
||||||
procedure CreateOutlines;
|
procedure CreateOutlines;
|
||||||
function CreateCatalog: TPdfDictionary;
|
function CreateCatalog: TPdfDictionary;
|
||||||
function CreateFont(FontName: string): TPdfFont;
|
function CreateFont(const FontName: string): TPdfFont;
|
||||||
function CreatePages(Parent: TPdfDictionary): TPdfDictionary;
|
function CreatePages(Parent: TPdfDictionary): TPdfDictionary;
|
||||||
public
|
public
|
||||||
procedure RegisterXObject(AObject: TPdfXObject; AName: string);
|
procedure RegisterXObject(AObject: TPdfXObject; const AName: string);
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure NewDoc;
|
procedure NewDoc;
|
||||||
procedure FreeDoc;
|
procedure FreeDoc;
|
||||||
procedure AddPage;
|
procedure AddPage;
|
||||||
procedure AddXObject(AName: string; AXObject: TPdfXObject);
|
procedure AddXObject(const AName: string; AXObject: TPdfXObject);
|
||||||
procedure SaveToStream(AStream: TStream);
|
procedure SaveToStream(AStream: TStream);
|
||||||
procedure SetVirtualMode;
|
procedure SetVirtualMode;
|
||||||
function GetFont(FontName: string): TPdfFont;
|
function GetFont(const FontName: string): TPdfFont;
|
||||||
function GetXObject(AName: string): TPdfXObject;
|
function GetXObject(const AName: string): TPdfXObject;
|
||||||
function CreateAnnotation(AType: TPdfAnnotationSubType; ARect: TPdfRect): TPdfDictionary;
|
function CreateAnnotation(AType: TPdfAnnotationSubType; const ARect: TPdfRect): TPdfDictionary;
|
||||||
function CreateDestination: TPdfDestination;
|
function CreateDestination: TPdfDestination;
|
||||||
property HasDoc: boolean read FHasDoc;
|
property HasDoc: boolean read FHasDoc;
|
||||||
property Canvas: TPdfCanvas read GetCanvas;
|
property Canvas: TPdfCanvas read GetCanvas;
|
||||||
@ -392,7 +390,7 @@ type
|
|||||||
FIsVirtual: boolean;
|
FIsVirtual: boolean;
|
||||||
procedure SetPageWidth(AValue: integer);
|
procedure SetPageWidth(AValue: integer);
|
||||||
procedure SetPageHeight(AValue: integer);
|
procedure SetPageHeight(AValue: integer);
|
||||||
procedure WriteString(S: string);
|
procedure WriteString(const S: string);
|
||||||
function GetDoc: TPdfDoc;
|
function GetDoc: TPdfDoc;
|
||||||
function GetPage: TPdfDictionary;
|
function GetPage: TPdfDictionary;
|
||||||
function GetPageWidth: Integer;
|
function GetPageWidth: Integer;
|
||||||
@ -441,7 +439,7 @@ type
|
|||||||
procedure SetWordSpace(wordSpace: Single); { Tw }
|
procedure SetWordSpace(wordSpace: Single); { Tw }
|
||||||
procedure SetHorizontalScaling(hScaling: Word); { Tz }
|
procedure SetHorizontalScaling(hScaling: Word); { Tz }
|
||||||
procedure SetLeading(leading: Single); { TL }
|
procedure SetLeading(leading: Single); { TL }
|
||||||
procedure SetFontAndSize(fontname: string; size: Single); { Tf }
|
procedure SetFontAndSize(const fontname: string; size: Single); { Tf }
|
||||||
procedure SetTextRenderingMode(mode: TTextRenderingMode); { Tr }
|
procedure SetTextRenderingMode(mode: TTextRenderingMode); { Tr }
|
||||||
procedure SetTextRise(rise: Word); { Ts }
|
procedure SetTextRise(rise: Word); { Ts }
|
||||||
procedure BeginText; { BT }
|
procedure BeginText; { BT }
|
||||||
@ -449,11 +447,11 @@ type
|
|||||||
procedure MoveTextPoint(tx, ty: Single); { Td }
|
procedure MoveTextPoint(tx, ty: Single); { Td }
|
||||||
procedure SetTextMatrix(a, b, c, d, x, y: Single); { Tm }
|
procedure SetTextMatrix(a, b, c, d, x, y: Single); { Tm }
|
||||||
procedure MoveToNextLine; { T* }
|
procedure MoveToNextLine; { T* }
|
||||||
procedure ShowText(s: string); { Tj }
|
procedure ShowText(const s: string); { Tj }
|
||||||
procedure ShowTextNextLine(s: string); { ' }
|
procedure ShowTextNextLine(const s: string); { ' }
|
||||||
|
|
||||||
{* external objects *}
|
{* external objects *}
|
||||||
procedure ExecuteXObject(xObject: string); { Do }
|
procedure ExecuteXObject(const xObject: string); { Do }
|
||||||
|
|
||||||
{* Device-dependent color space operators *}
|
{* Device-dependent color space operators *}
|
||||||
procedure SetRGBFillColor(Value: TPdfColor); { rg }
|
procedure SetRGBFillColor(Value: TPdfColor); { rg }
|
||||||
@ -461,16 +459,16 @@ type
|
|||||||
|
|
||||||
{* utility routines *}
|
{* utility routines *}
|
||||||
procedure SetPage(APage: TPdfDictionary);
|
procedure SetPage(APage: TPdfDictionary);
|
||||||
procedure SetFont(AName: string; ASize: Single);
|
procedure SetFont(const AName: string; ASize: Single);
|
||||||
procedure TextOut(X, Y: Single; Text: string);
|
procedure TextOut(X, Y: Single; const Text: string);
|
||||||
procedure TextRect(ARect: TPdfRect; Text: string;
|
procedure TextRect(ARect: TPdfRect; Text: string;
|
||||||
Alignment: TPdfAlignment; Clipping: boolean);
|
Alignment: TPdfAlignment; Clipping: boolean);
|
||||||
procedure MultilineTextRect(ARect: TPdfRect;
|
procedure MultilineTextRect(ARect: TPdfRect;
|
||||||
Text: string; WordWrap: boolean);
|
const Text: string; WordWrap: boolean);
|
||||||
procedure DrawXObject(X, Y, AWidth, AHeight: Single;
|
procedure DrawXObject(X, Y, AWidth, AHeight: Single;
|
||||||
AXObjectName: string);
|
const AXObjectName: string);
|
||||||
procedure DrawXObjectEx(X, Y, AWidth, AHeight: Single;
|
procedure DrawXObjectEx(X, Y, AWidth, AHeight: Single;
|
||||||
ClipX, ClipY, ClipWidth, ClipHeight: Single; AXObjectName: string);
|
ClipX, ClipY, ClipWidth, ClipHeight: Single; const AXObjectName: string);
|
||||||
procedure Ellipse(x, y, width, height: Single);
|
procedure Ellipse(x, y, width, height: Single);
|
||||||
procedure RoundRect(x, y, width, height, rx, ry: Single; SqrCorners:TPdfCorners=[]);
|
procedure RoundRect(x, y, width, height, rx, ry: Single; SqrCorners:TPdfCorners=[]);
|
||||||
function TextWidth(Text: string): Single;
|
function TextWidth(Text: string): Single;
|
||||||
@ -485,7 +483,7 @@ type
|
|||||||
property PageHeight: integer read GetPageHeight write SetPageHeight;
|
property PageHeight: integer read GetPageHeight write SetPageHeight;
|
||||||
|
|
||||||
{* Text rotated up *}
|
{* Text rotated up *}
|
||||||
procedure TextOutRotatedUp(X, Y: Single; Text: string);
|
procedure TextOutRotatedUp(X, Y: Single; const Text: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfDictionaryWrapper = class(TPersistent)
|
TPdfDictionaryWrapper = class(TPersistent)
|
||||||
@ -502,17 +500,17 @@ type
|
|||||||
TPdfInfo = class(TPdfDictionaryWrapper)
|
TPdfInfo = class(TPdfDictionaryWrapper)
|
||||||
private
|
private
|
||||||
function GetAuthor: string;
|
function GetAuthor: string;
|
||||||
procedure SetAuthor(Value: string);
|
procedure SetAuthor(const Value: string);
|
||||||
function GetCreationDate: TDateTime;
|
function GetCreationDate: TDateTime;
|
||||||
procedure SetCreationDate(Value: TDateTime);
|
procedure SetCreationDate(Value: TDateTime);
|
||||||
function GetCreator: string;
|
function GetCreator: string;
|
||||||
procedure SetCreator(Value: string);
|
procedure SetCreator(const Value: string);
|
||||||
function GetKeywords: string;
|
function GetKeywords: string;
|
||||||
procedure SetKeywords(Value: string);
|
procedure SetKeywords(const Value: string);
|
||||||
function GetSubject: string;
|
function GetSubject: string;
|
||||||
procedure SetSubject(Value: string);
|
procedure SetSubject(const Value: string);
|
||||||
function GetTitle: string;
|
function GetTitle: string;
|
||||||
procedure SetTitle(Value: string);
|
procedure SetTitle(const Value: string);
|
||||||
function GetModDate: TDateTime;
|
function GetModDate: TDateTime;
|
||||||
procedure SetModDate(Value: TDateTime);
|
procedure SetModDate(Value: TDateTime);
|
||||||
public
|
public
|
||||||
@ -562,8 +560,8 @@ type
|
|||||||
procedure AddStrElements(ADic: TPdfDictionary; ATable: array of TPDF_STR_TBL);
|
procedure AddStrElements(ADic: TPdfDictionary; ATable: array of TPDF_STR_TBL);
|
||||||
procedure AddIntElements(ADic: TPdfDictionary; ATable: array of TPDF_INT_TBL);
|
procedure AddIntElements(ADic: TPdfDictionary; ATable: array of TPDF_INT_TBL);
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); virtual;
|
constructor Create(AXref: TPdfXref; const AName: string); virtual;
|
||||||
function GetCharWidth(AText: string; APos: integer): integer; virtual;
|
function GetCharWidth(const AText: string; APos: integer): integer; virtual;
|
||||||
property Name: string read FName;
|
property Name: string read FName;
|
||||||
property UnderlinePosition: Integer read FUnderlinePosition write FUnderlinePosition;
|
property UnderlinePosition: Integer read FUnderlinePosition write FUnderlinePosition;
|
||||||
property UnderlineThickness: Integer read FUnderlineThickness write FUnderlineThickness;
|
property UnderlineThickness: Integer read FUnderlineThickness write FUnderlineThickness;
|
||||||
@ -754,7 +752,7 @@ constructor TPdfXref.Create;
|
|||||||
var
|
var
|
||||||
RootEntry: TPdfXrefEntry;
|
RootEntry: TPdfXrefEntry;
|
||||||
begin
|
begin
|
||||||
FXrefEntries := TList.Create;
|
FXrefEntries := TFpList.Create;
|
||||||
RootEntry := TPdfXrefEntry.Create(nil);
|
RootEntry := TPdfXrefEntry.Create(nil);
|
||||||
RootEntry.GenerationNumber := PDF_MAX_GENERATION_NUM;
|
RootEntry.GenerationNumber := PDF_MAX_GENERATION_NUM;
|
||||||
FXrefEntries.Add(RootEntry);
|
FXrefEntries.Add(RootEntry);
|
||||||
@ -890,7 +888,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// CreateFont
|
// CreateFont
|
||||||
function TPdfDoc.CreateFont(FontName: string): TPdfFont;
|
function TPdfDoc.CreateFont(const FontName: string): TPdfFont;
|
||||||
var
|
var
|
||||||
PdfFont: TPdfFont;
|
PdfFont: TPdfFont;
|
||||||
begin
|
begin
|
||||||
@ -910,7 +908,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// RegisterXObject
|
// RegisterXObject
|
||||||
procedure TPdfDoc.RegisterXObject(AObject: TPdfXObject; AName: string);
|
procedure TPdfDoc.RegisterXObject(AObject: TPdfXObject; const AName: string);
|
||||||
begin
|
begin
|
||||||
// check object and register it.
|
// check object and register it.
|
||||||
if AObject = nil then
|
if AObject = nil then
|
||||||
@ -969,7 +967,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// GetFont
|
// GetFont
|
||||||
function TPdfDoc.GetFont(FontName: string): TPdfFont;
|
function TPdfDoc.GetFont(const FontName: string): TPdfFont;
|
||||||
var
|
var
|
||||||
FFont: TPdfFont;
|
FFont: TPdfFont;
|
||||||
i :integer;
|
i :integer;
|
||||||
@ -993,7 +991,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// GetXObject
|
// GetXObject
|
||||||
function TPdfDoc.GetXObject(AName: string): TPdfXObject;
|
function TPdfDoc.GetXObject(const AName: string): TPdfXObject;
|
||||||
var
|
var
|
||||||
FXObject: TPdfXObject;
|
FXObject: TPdfXObject;
|
||||||
i :integer;
|
i :integer;
|
||||||
@ -1012,7 +1010,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// CreateAnnotation
|
// CreateAnnotation
|
||||||
function TPdfDoc.CreateAnnotation(AType: TPdfAnnotationSubType; ARect: TPdfRect): TPdfDictionary;
|
function TPdfDoc.CreateAnnotation(AType: TPdfAnnotationSubType; const ARect: TPdfRect): TPdfDictionary;
|
||||||
var
|
var
|
||||||
FAnnotation: TPdfDictionary;
|
FAnnotation: TPdfDictionary;
|
||||||
FArray: TPdfArray;
|
FArray: TPdfArray;
|
||||||
@ -1069,9 +1067,9 @@ begin
|
|||||||
FXref := TPdfXref.Create;
|
FXref := TPdfXref.Create;
|
||||||
FHeader := TPdfHeader.Create;
|
FHeader := TPdfHeader.Create;
|
||||||
FTrailer := TPdfTrailer.Create(FXref);
|
FTrailer := TPdfTrailer.Create(FXref);
|
||||||
FFontList := TList.Create;
|
FFontList := TFpList.Create;
|
||||||
FXObjectList := TPdfArray.CreateArray(FXref);
|
FXObjectList := TPdfArray.CreateArray(FXref);
|
||||||
FObjectList := TList.Create;
|
FObjectList := TFpList.Create;
|
||||||
|
|
||||||
FRoot := TPdfCatalog.Create;
|
FRoot := TPdfCatalog.Create;
|
||||||
FRoot.SetData(CreateCatalog);
|
FRoot.SetData(CreateCatalog);
|
||||||
@ -1090,7 +1088,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// AddXObject
|
// AddXObject
|
||||||
procedure TPdfDoc.AddXObject(AName: string; AXObject: TPdfXObject);
|
procedure TPdfDoc.AddXObject(const AName: string; AXObject: TPdfXObject);
|
||||||
begin
|
begin
|
||||||
if GetXObject(AName) <> nil then
|
if GetXObject(AName) <> nil then
|
||||||
raise Exception.CreateFmt('AddImage --the image named %s is already exists..', [AName]);
|
raise Exception.CreateFmt('AddImage --the image named %s is already exists..', [AName]);
|
||||||
@ -1402,7 +1400,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// WriteString
|
// WriteString
|
||||||
procedure TPdfCanvas.WriteString(S: string);
|
procedure TPdfCanvas.WriteString(const S: string);
|
||||||
begin
|
begin
|
||||||
if (not FIsVirtual) and (FContents <> nil) then
|
if (not FIsVirtual) and (FContents <> nil) then
|
||||||
_WriteString(S, FContents.Stream);
|
_WriteString(S, FContents.Stream);
|
||||||
@ -1502,7 +1500,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// SetFont
|
// SetFont
|
||||||
procedure TPdfCanvas.SetFont(AName: string; ASize: Single);
|
procedure TPdfCanvas.SetFont(const AName: string; ASize: Single);
|
||||||
var
|
var
|
||||||
FFont: TPdfFont;
|
FFont: TPdfFont;
|
||||||
FFontList: TPdfDictionary;
|
FFontList: TPdfDictionary;
|
||||||
@ -1523,7 +1521,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// TextOut
|
// TextOut
|
||||||
procedure TPdfCanvas.TextOut(X, Y: Single; Text: string);
|
procedure TPdfCanvas.TextOut(X, Y: Single; const Text: string);
|
||||||
var
|
var
|
||||||
UPos, UWidth: Single;
|
UPos, UWidth: Single;
|
||||||
begin
|
begin
|
||||||
@ -1595,7 +1593,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// MultilineTextRect
|
// MultilineTextRect
|
||||||
procedure TPdfCanvas.MultilineTextRect(ARect: TPdfRect; Text: string;
|
procedure TPdfCanvas.MultilineTextRect(ARect: TPdfRect; const Text: string;
|
||||||
WordWrap: boolean);
|
WordWrap: boolean);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -1702,7 +1700,7 @@ end;
|
|||||||
|
|
||||||
// DrawXObject
|
// DrawXObject
|
||||||
procedure TPdfCanvas.DrawXObject(X, Y, AWidth, AHeight: Single;
|
procedure TPdfCanvas.DrawXObject(X, Y, AWidth, AHeight: Single;
|
||||||
AXObjectName: string);
|
const AXObjectName: string);
|
||||||
var
|
var
|
||||||
XObject: TPdfXObject;
|
XObject: TPdfXObject;
|
||||||
FXObjectList: TPdfDictionary;
|
FXObjectList: TPdfDictionary;
|
||||||
@ -1724,7 +1722,7 @@ end;
|
|||||||
|
|
||||||
// DrawXObjectEx
|
// DrawXObjectEx
|
||||||
procedure TPdfCanvas.DrawXObjectEx(X, Y, AWidth, AHeight: Single;
|
procedure TPdfCanvas.DrawXObjectEx(X, Y, AWidth, AHeight: Single;
|
||||||
ClipX, ClipY, ClipWidth, ClipHeight: Single; AXObjectName: string);
|
ClipX, ClipY, ClipWidth, ClipHeight: Single; const AXObjectName: string);
|
||||||
var
|
var
|
||||||
XObject: TPdfXObject;
|
XObject: TPdfXObject;
|
||||||
FXObjectList: TPdfDictionary;
|
FXObjectList: TPdfDictionary;
|
||||||
@ -2015,7 +2013,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// SetFontAndSize
|
// SetFontAndSize
|
||||||
procedure TPdfCanvas.SetFontAndSize(fontname: string; size: Single);
|
procedure TPdfCanvas.SetFontAndSize(const fontname: string; size: Single);
|
||||||
var
|
var
|
||||||
S: string;
|
S: string;
|
||||||
begin
|
begin
|
||||||
@ -2079,7 +2077,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// ShowText
|
// ShowText
|
||||||
procedure TPdfCanvas.ShowText(s: string);
|
procedure TPdfCanvas.ShowText(const s: string);
|
||||||
var
|
var
|
||||||
FString: string;
|
FString: string;
|
||||||
begin
|
begin
|
||||||
@ -2091,7 +2089,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// ShowTextNextLine
|
// ShowTextNextLine
|
||||||
procedure TPdfCanvas.ShowTextNextLine(s: string);
|
procedure TPdfCanvas.ShowTextNextLine(const s: string);
|
||||||
var
|
var
|
||||||
FString: string;
|
FString: string;
|
||||||
begin
|
begin
|
||||||
@ -2105,7 +2103,7 @@ end;
|
|||||||
{* external objects *}
|
{* external objects *}
|
||||||
|
|
||||||
// ExecuteXObject
|
// ExecuteXObject
|
||||||
procedure TPdfCanvas.ExecuteXObject(xObject: string);
|
procedure TPdfCanvas.ExecuteXObject(const xObject: string);
|
||||||
var
|
var
|
||||||
S: string;
|
S: string;
|
||||||
begin
|
begin
|
||||||
@ -2262,7 +2260,7 @@ begin
|
|||||||
Index := i + 1;
|
Index := i + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPdfCanvas.TextOutRotatedUp(X, Y: Single; Text: string);
|
procedure TPdfCanvas.TextOutRotatedUp(X, Y: Single; const Text: string);
|
||||||
begin
|
begin
|
||||||
BeginText;
|
BeginText;
|
||||||
SetTextMatrix(0, 1, -1, 0, X, Y); // down to up
|
SetTextMatrix(0, 1, -1, 0, X, Y); // down to up
|
||||||
@ -2297,7 +2295,7 @@ end;
|
|||||||
{ TPdfInfo }
|
{ TPdfInfo }
|
||||||
|
|
||||||
// SetAuthor
|
// SetAuthor
|
||||||
procedure TPdfInfo.SetAuthor(Value: string);
|
procedure TPdfInfo.SetAuthor(const Value: string);
|
||||||
begin
|
begin
|
||||||
FData.AddItem('Author', TPdfText.CreateText(Value));
|
FData.AddItem('Author', TPdfText.CreateText(Value));
|
||||||
end;
|
end;
|
||||||
@ -2315,25 +2313,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// SetCreator
|
// SetCreator
|
||||||
procedure TPdfInfo.SetCreator(Value: string);
|
procedure TPdfInfo.SetCreator(const Value: string);
|
||||||
begin
|
begin
|
||||||
FData.AddItem('Creator', TPdfText.CreateText(Value));
|
FData.AddItem('Creator', TPdfText.CreateText(Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// SetTitle
|
// SetTitle
|
||||||
procedure TPdfInfo.SetTitle(Value: string);
|
procedure TPdfInfo.SetTitle(const Value: string);
|
||||||
begin
|
begin
|
||||||
FData.AddItem('Title', TPdfText.CreateText(Value));
|
FData.AddItem('Title', TPdfText.CreateText(Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// SetSubject
|
// SetSubject
|
||||||
procedure TPdfInfo.SetSubject(Value: string);
|
procedure TPdfInfo.SetSubject(const Value: string);
|
||||||
begin
|
begin
|
||||||
FData.AddItem('Subject', TPdfText.CreateText(Value));
|
FData.AddItem('Subject', TPdfText.CreateText(Value));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// SetKeywords
|
// SetKeywords
|
||||||
procedure TPdfInfo.SetKeywords(Value: string);
|
procedure TPdfInfo.SetKeywords(const Value: string);
|
||||||
begin
|
begin
|
||||||
FData.AddItem('Keywords', TPdfText.CreateText(Value));
|
FData.AddItem('Keywords', TPdfText.CreateText(Value));
|
||||||
end;
|
end;
|
||||||
@ -2653,13 +2651,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// GetCharWidth
|
// GetCharWidth
|
||||||
function TPdfFont.GetCharWidth(AText: string; APos: integer): integer;
|
function TPdfFont.GetCharWidth(const AText: string; APos: integer): integer;
|
||||||
begin
|
begin
|
||||||
result := 0;
|
result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
constructor TPdfFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FName := AName;
|
FName := AName;
|
||||||
|
@ -500,78 +500,78 @@ type
|
|||||||
FArray: array[0..255] of Word;
|
FArray: array[0..255] of Word;
|
||||||
public
|
public
|
||||||
procedure SetData(Value: TPdfDictionary); override;
|
procedure SetData(Value: TPdfDictionary); override;
|
||||||
function GetCharWidth(AText: string; APos: integer): integer; override;
|
function GetCharWidth(const AText: string; APos: integer): integer; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfFixedWidth = class(TPdfType1Font)
|
TPdfFixedWidth = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfFixedWidthBold = class(TPdfType1Font)
|
TPdfFixedWidthBold = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfFixedWidthItalic = class(TPdfType1Font)
|
TPdfFixedWidthItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfFixedWidthBoldItalic = class(TPdfType1Font)
|
TPdfFixedWidthBoldItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfArial = class(TPdfType1Font)
|
TPdfArial = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfArialBold = class(TPdfType1Font)
|
TPdfArialBold = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfArialItalic = class(TPdfType1Font)
|
TPdfArialItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfArialBoldItalic = class(TPdfType1Font)
|
TPdfArialBoldItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfTimesRoman = class(TPdfType1Font)
|
TPdfTimesRoman = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfTimesBold = class(TPdfType1Font)
|
TPdfTimesBold = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfTimesItalic = class(TPdfType1Font)
|
TPdfTimesItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfTimesBoldItalic = class(TPdfType1Font)
|
TPdfTimesBoldItalic = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfScript = class(TPdfType1Font)
|
TPdfScript = class(TPdfType1Font)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TPdfType1Font }
|
{ TPdfType1Font }
|
||||||
function TPdfType1Font.GetCharWidth(AText: string; APos: integer): integer;
|
function TPdfType1Font.GetCharWidth(const AText: string; APos: integer): integer;
|
||||||
begin
|
begin
|
||||||
result := FArray[ord(AText[APos])];
|
result := FArray[ord(AText[APos])];
|
||||||
end;
|
end;
|
||||||
@ -604,7 +604,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ FixedWidth }
|
{ FixedWidth }
|
||||||
constructor TPdfFixedWidth.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfFixedWidth.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -628,7 +628,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ FixedWidthBold }
|
{ FixedWidthBold }
|
||||||
constructor TPdfFixedWidthBold.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfFixedWidthBold.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -648,7 +648,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ FixedWidthItalic }
|
{ FixedWidthItalic }
|
||||||
constructor TPdfFixedWidthItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfFixedWidthItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -668,7 +668,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ FixedWidthBoldItalic }
|
{ FixedWidthBoldItalic }
|
||||||
constructor TPdfFixedWidthBoldItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfFixedWidthBoldItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -688,7 +688,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Arial }
|
{ Arial }
|
||||||
constructor TPdfArial.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfArial.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -710,7 +710,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Arial-Bold }
|
{ Arial-Bold }
|
||||||
constructor TPdfArialBold.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfArialBold.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -733,7 +733,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Arial-Italic }
|
{ Arial-Italic }
|
||||||
constructor TPdfArialItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfArialItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -755,7 +755,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Arial-BoldItalic }
|
{ Arial-BoldItalic }
|
||||||
constructor TPdfArialBoldItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfArialBoldItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -778,7 +778,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPdfTimesRoman }
|
{ TPdfTimesRoman }
|
||||||
constructor TPdfTimesRoman.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfTimesRoman.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -798,7 +798,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPdfTimesBold }
|
{ TPdfTimesBold }
|
||||||
constructor TPdfTimesBold.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfTimesBold.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -818,7 +818,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPdfTimesItalic }
|
{ TPdfTimesItalic }
|
||||||
constructor TPdfTimesItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfTimesItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -838,7 +838,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPdfTimesBoldItalic }
|
{ TPdfTimesBoldItalic }
|
||||||
constructor TPdfTimesBoldItalic.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfTimesBoldItalic.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -858,7 +858,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPdfScript }
|
{ TPdfScript }
|
||||||
constructor TPdfScript.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfScript.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FWidths: TPdfArray;
|
FWidths: TPdfArray;
|
||||||
FFontDescriptor: TPdfDictionary;
|
FFontDescriptor: TPdfDictionary;
|
||||||
|
@ -65,14 +65,14 @@ type
|
|||||||
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); virtual;
|
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); virtual;
|
||||||
function GetFontName: string; virtual;
|
function GetFontName: string; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfGBFixedFont = class(TPdfGBFont)
|
TPdfGBFixedFont = class(TPdfGBFont)
|
||||||
protected
|
protected
|
||||||
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); override;
|
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); override;
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfChinese = class(TPdfGBFixedFont)
|
TPdfChinese = class(TPdfGBFixedFont)
|
||||||
@ -115,7 +115,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
constructor TPdfGBFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfGBFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FFontDescriptor: TPdfDictionary;
|
FFontDescriptor: TPdfDictionary;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -179,7 +179,7 @@ begin
|
|||||||
ADescendantFont.AddItem('W', FWidths);
|
ADescendantFont.AddItem('W', FWidths);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TPdfGBFixedFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfGBFixedFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(AXref, AName);
|
inherited Create(AXref, AName);
|
||||||
AddStrElements(Data, TYPE0_GB_FONT_STR_TABLE);
|
AddStrElements(Data, TYPE0_GB_FONT_STR_TABLE);
|
||||||
|
@ -223,7 +223,7 @@ type
|
|||||||
TPdfType0Font = class(TPdfFont)
|
TPdfType0Font = class(TPdfFont)
|
||||||
private
|
private
|
||||||
FCharToCMap: TCharToCMap;
|
FCharToCMap: TCharToCMap;
|
||||||
FArray: TList;
|
FArray: TFpList;
|
||||||
FDW: Word;
|
FDW: Word;
|
||||||
FMissingWidth: Word;
|
FMissingWidth: Word;
|
||||||
protected
|
protected
|
||||||
@ -232,7 +232,7 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure SetData(AData: TPdfDictionary); override;
|
procedure SetData(AData: TPdfDictionary); override;
|
||||||
procedure SetCharToCMap(AFunc: TCharToCMap); virtual;
|
procedure SetCharToCMap(AFunc: TCharToCMap); virtual;
|
||||||
function GetCharWidth(AText: string; APos: integer): integer; override;
|
function GetCharWidth(const AText: string; APos: integer): integer; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfJpFont = class(TPdfType0Font)
|
TPdfJpFont = class(TPdfType0Font)
|
||||||
@ -241,14 +241,14 @@ type
|
|||||||
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); virtual;
|
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); virtual;
|
||||||
function GetFontName: string; virtual;
|
function GetFontName: string; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfJpFixedFont = class(TPdfJpFont)
|
TPdfJpFixedFont = class(TPdfJpFont)
|
||||||
protected
|
protected
|
||||||
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); override;
|
procedure AddDescendantFontItem(ADescendantFont: TPdfDictionary); override;
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfGothic = class(TPdfJpFixedFont)
|
TPdfGothic = class(TPdfJpFixedFont)
|
||||||
@ -301,7 +301,7 @@ type
|
|||||||
|
|
||||||
TPdfJpProportionalFont = class(TPdfJpFont)
|
TPdfJpProportionalFont = class(TPdfJpFont)
|
||||||
public
|
public
|
||||||
constructor Create(AXref: TPdfXref; AName: string); override;
|
constructor Create(AXref: TPdfXref; const AName: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfPGothic = class(TPdfJpProportionalFont)
|
TPdfPGothic = class(TPdfJpProportionalFont)
|
||||||
@ -380,7 +380,7 @@ begin
|
|||||||
FDW := DescendantFont.PdfNumberByName('DW').Value;
|
FDW := DescendantFont.PdfNumberByName('DW').Value;
|
||||||
Discriptor := DescendantFont.PdfDictionaryByName('FontDescriptor');
|
Discriptor := DescendantFont.PdfDictionaryByName('FontDescriptor');
|
||||||
FMissingWidth := Discriptor.PdfNumberByName('MissingWidth').Value;
|
FMissingWidth := Discriptor.PdfNumberByName('MissingWidth').Value;
|
||||||
FArray := TList.Create;
|
FArray := TFpList.Create;
|
||||||
WidthsRoot := DescendantFont.PdfArrayByName('W');
|
WidthsRoot := DescendantFont.PdfArrayByName('W');
|
||||||
|
|
||||||
// create widths array from "W"attribute.
|
// create widths array from "W"attribute.
|
||||||
@ -451,7 +451,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// GetCharWidth
|
// GetCharWidth
|
||||||
function TPdfType0Font.GetCharWidth(AText: string; APos: integer): integer;
|
function TPdfType0Font.GetCharWidth(const AText: string; APos: integer): integer;
|
||||||
var
|
var
|
||||||
CID: integer;
|
CID: integer;
|
||||||
begin
|
begin
|
||||||
@ -506,7 +506,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
constructor TPdfJpFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfJpFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
var
|
var
|
||||||
FFontDescriptor: TPdfDictionary;
|
FFontDescriptor: TPdfDictionary;
|
||||||
FFont: TPdfDictionary;
|
FFont: TPdfDictionary;
|
||||||
@ -570,7 +570,7 @@ begin
|
|||||||
ADescendantFont.AddItem('W', FWidths);
|
ADescendantFont.AddItem('W', FWidths);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TPdfJpFixedFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfJpFixedFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(AXref, AName);
|
inherited Create(AXref, AName);
|
||||||
AddStrElements(Data, TYPE0_JP_FONT_STR_TABLE);
|
AddStrElements(Data, TYPE0_JP_FONT_STR_TABLE);
|
||||||
@ -765,7 +765,7 @@ end;
|
|||||||
{ TPdfJpProportionalFont }
|
{ TPdfJpProportionalFont }
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
constructor TPdfJpProportionalFont.Create(AXref: TPdfXref; AName: string);
|
constructor TPdfJpProportionalFont.Create(AXref: TPdfXref; const AName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(AXref, AName);
|
inherited Create(AXref, AName);
|
||||||
AddStrElements(Data, TYPE0_JPP_FONT_STR_TABLE);
|
AddStrElements(Data, TYPE0_JPP_FONT_STR_TABLE);
|
||||||
|
@ -160,7 +160,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure InternalWriteStream(const AStream: TStream); override;
|
procedure InternalWriteStream(const AStream: TStream); override;
|
||||||
public
|
public
|
||||||
constructor CreateString(AValue: string);
|
constructor CreateString(const AValue: string);
|
||||||
property Value: string read FValue write FValue;
|
property Value: string read FValue write FValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure InternalWriteStream(const AStream: TStream); override;
|
procedure InternalWriteStream(const AStream: TStream); override;
|
||||||
public
|
public
|
||||||
constructor CreateText(AValue: string);
|
constructor CreateText(const AValue: string);
|
||||||
property Value: String read FValue write FValue;
|
property Value: String read FValue write FValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ type
|
|||||||
|
|
||||||
TPdfArray = class(TPdfObject)
|
TPdfArray = class(TPdfObject)
|
||||||
private
|
private
|
||||||
FArray: TList;
|
FArray: TFpList;
|
||||||
FObjectMgr: TPdfObjectMgr;
|
FObjectMgr: TPdfObjectMgr;
|
||||||
function GetItems(Index: integer): TPdfObject;
|
function GetItems(Index: integer): TPdfObject;
|
||||||
function GetItemCount: integer;
|
function GetItemCount: integer;
|
||||||
@ -198,8 +198,8 @@ type
|
|||||||
constructor CreateNumArray(AObjectMgr: TPdfObjectMgr; AArray: array of Integer);
|
constructor CreateNumArray(AObjectMgr: TPdfObjectMgr; AArray: array of Integer);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AddItem(AItem: TPdfObject);
|
procedure AddItem(AItem: TPdfObject);
|
||||||
function FindName(AName: string): TPdfName;
|
function FindName(const AName: string): TPdfName;
|
||||||
function RemoveName(AName: string): boolean;
|
function RemoveName(const AName: string): boolean;
|
||||||
property Items[Index: integer]: TPdfObject read GetItems;
|
property Items[Index: integer]: TPdfObject read GetItems;
|
||||||
property ItemCount: integer read GetItemCount;
|
property ItemCount: integer read GetItemCount;
|
||||||
property ObjectMgr: TPdfObjectMgr read FObjectMgr;
|
property ObjectMgr: TPdfObjectMgr read FObjectMgr;
|
||||||
@ -212,8 +212,8 @@ type
|
|||||||
FIsInternal: boolean;
|
FIsInternal: boolean;
|
||||||
function GetKey: string;
|
function GetKey: string;
|
||||||
public
|
public
|
||||||
constructor Create(AKey: string; AValue: TPdfObject);
|
constructor Create(const AKey: string; AValue: TPdfObject);
|
||||||
constructor CreateAsInternal(AKey: string; AValue: TPdfObject; AVoid: Pointer);
|
constructor CreateAsInternal(const AKey: string; AValue: TPdfObject; AVoid: Pointer);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property Key: string read GetKey;
|
property Key: string read GetKey;
|
||||||
property Value: TPdfObject read FValue;
|
property Value: TPdfObject read FValue;
|
||||||
@ -222,7 +222,7 @@ type
|
|||||||
|
|
||||||
TPdfDictionary = class(TPdfObject)
|
TPdfDictionary = class(TPdfObject)
|
||||||
private
|
private
|
||||||
FArray: TList;
|
FArray: TFpList;
|
||||||
FObjectMgr: TPdfObjectMgr;
|
FObjectMgr: TPdfObjectMgr;
|
||||||
function GetItems(Index: integer): TPdfDictionaryElement;
|
function GetItems(Index: integer): TPdfDictionaryElement;
|
||||||
function GetItemCount: integer;
|
function GetItemCount: integer;
|
||||||
@ -231,20 +231,20 @@ type
|
|||||||
public
|
public
|
||||||
constructor CreateDictionary(AObjectMgr: TPdfObjectMgr);
|
constructor CreateDictionary(AObjectMgr: TPdfObjectMgr);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function ValueByName(AKey: string): TPdfObject;
|
function ValueByName(const AKey: string): TPdfObject;
|
||||||
function PdfBooleanByName(AKey: string): TPdfBoolean;
|
function PdfBooleanByName(const AKey: string): TPdfBoolean;
|
||||||
function PdfNumberByName(AKey: string): TPdfNumber;
|
function PdfNumberByName(const AKey: string): TPdfNumber;
|
||||||
function PdfTextByName(AKey: string): TPdfText;
|
function PdfTextByName(const AKey: string): TPdfText;
|
||||||
function PdfRealByName(AKey: string): TPdfReal;
|
function PdfRealByName(const AKey: string): TPdfReal;
|
||||||
function PdfStringByName(AKey: string): TPdfString;
|
function PdfStringByName(const AKey: string): TPdfString;
|
||||||
function PdfNameByName(AKey: string): TPdfName;
|
function PdfNameByName(const AKey: string): TPdfName;
|
||||||
function PdfDictionaryByName(AKey: string): TPdfDictionary;
|
function PdfDictionaryByName(const AKey: string): TPdfDictionary;
|
||||||
function PdfArrayByName(AKey: string): TPdfArray;
|
function PdfArrayByName(const AKey: string): TPdfArray;
|
||||||
procedure AddItem(AKey: string; AValue: TPdfObject);
|
procedure AddItem(const AKey: string; AValue: TPdfObject);
|
||||||
procedure AddNumberItem(AKey: string; AValue: Integer);
|
procedure AddNumberItem(const AKey: string; AValue: Integer);
|
||||||
procedure AddNameItem(AKey: string; AValue: string);
|
procedure AddNameItem(const AKey: string; AValue: string);
|
||||||
procedure AddInternalItem(AKey: string; AValue: TPdfObject);
|
procedure AddInternalItem(const AKey: string; AValue: TPdfObject);
|
||||||
procedure RemoveItem(AKey: string);
|
procedure RemoveItem(const AKey: string);
|
||||||
property Items[Index: integer]: TPdfDictionaryElement read GetItems;
|
property Items[Index: integer]: TPdfDictionaryElement read GetItems;
|
||||||
property ItemCount: integer read GetItemCount;
|
property ItemCount: integer read GetItemCount;
|
||||||
property ObjectMgr: TPdfObjectMgr read FObjectMgr;
|
property ObjectMgr: TPdfObjectMgr read FObjectMgr;
|
||||||
@ -298,13 +298,13 @@ type
|
|||||||
function _FloatToStrR(Value: Extended): string;
|
function _FloatToStrR(Value: Extended): string;
|
||||||
function _GetUnicodeHeader: string;
|
function _GetUnicodeHeader: string;
|
||||||
function _PdfRect(Left, Top, Right, Bottom: Single): TPdfRect;
|
function _PdfRect(Left, Top, Right, Bottom: Single): TPdfRect;
|
||||||
function _GetCharCount(Text: string): integer;
|
function _GetCharCount(const Text: string): integer;
|
||||||
|
|
||||||
{$IFDEF LAZ_POWERPDF}
|
{$IFDEF LAZ_POWERPDF}
|
||||||
function _UTF8StrToUnicodeHex(const Value:string): string;
|
function _UTF8StrToUnicodeHex(const Value:string): string;
|
||||||
function _UTF8ToWinAnsi(const value:string; InvalidChar:char='?'): string;
|
function _UTF8ToWinAnsi(const value:string; InvalidChar:char='?'): string;
|
||||||
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; Alias: string);
|
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; const Alias: string);
|
||||||
function PdfLazFindClass(aClassName: string):TPersistentClass;
|
function PdfLazFindClass(const aClassName: string):TPersistentClass;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -470,7 +470,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// CreateString
|
// CreateString
|
||||||
constructor TPdfString.CreateString(AValue: string);
|
constructor TPdfString.CreateString(const AValue: string);
|
||||||
begin
|
begin
|
||||||
Create;
|
Create;
|
||||||
Value := AValue;
|
Value := AValue;
|
||||||
@ -493,7 +493,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// CreateText
|
// CreateText
|
||||||
constructor TPdfText.CreateText(AValue: string);
|
constructor TPdfText.CreateText(const AValue: string);
|
||||||
begin
|
begin
|
||||||
Create;
|
Create;
|
||||||
Value := AValue;
|
Value := AValue;
|
||||||
@ -575,7 +575,7 @@ end;
|
|||||||
constructor TPdfArray.CreateArray(AObjectMgr: TPdfObjectMgr);
|
constructor TPdfArray.CreateArray(AObjectMgr: TPdfObjectMgr);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FArray := TList.Create;
|
FArray := TFpList.Create;
|
||||||
FObjectMgr := AObjectMgr;
|
FObjectMgr := AObjectMgr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FArray := TList.Create;
|
FArray := TFpList.Create;
|
||||||
FObjectMgr := AObjectMgr;
|
FObjectMgr := AObjectMgr;
|
||||||
|
|
||||||
for i := 0 to High(AArray) do
|
for i := 0 to High(AArray) do
|
||||||
@ -621,7 +621,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// FindName
|
// FindName
|
||||||
function TPdfArray.FindName(AName: string): TPdfName;
|
function TPdfArray.FindName(const AName: string): TPdfName;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
FPdfName: TPdfName;
|
FPdfName: TPdfName;
|
||||||
@ -641,7 +641,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// RemoveName
|
// RemoveName
|
||||||
function TPdfArray.RemoveName(AName: string): boolean;
|
function TPdfArray.RemoveName(const AName: string): boolean;
|
||||||
var
|
var
|
||||||
AObject: TPdfObject;
|
AObject: TPdfObject;
|
||||||
begin
|
begin
|
||||||
@ -665,7 +665,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
constructor TPdfDictionaryElement.Create(AKey: string; AValue: TPdfObject);
|
constructor TPdfDictionaryElement.Create(const AKey: string; AValue: TPdfObject);
|
||||||
begin
|
begin
|
||||||
FKey := TPdfName.Create;
|
FKey := TPdfName.Create;
|
||||||
FKey.Value := AKey;
|
FKey.Value := AKey;
|
||||||
@ -676,7 +676,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// CreateAsInternal
|
// CreateAsInternal
|
||||||
constructor TPdfDictionaryElement.CreateAsInternal(AKey: string; AValue: TPdfObject; AVoid: Pointer);
|
constructor TPdfDictionaryElement.CreateAsInternal(const AKey: string; AValue: TPdfObject; AVoid: Pointer);
|
||||||
begin
|
begin
|
||||||
Create(AKey, AValue);
|
Create(AKey, AValue);
|
||||||
FIsInternal := true;
|
FIsInternal := true;
|
||||||
@ -729,7 +729,7 @@ end;
|
|||||||
constructor TPdfDictionary.CreateDictionary(AObjectMgr: TPdfObjectMgr);
|
constructor TPdfDictionary.CreateDictionary(AObjectMgr: TPdfObjectMgr);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FArray := TList.Create;
|
FArray := TFpList.Create;
|
||||||
FObjectMgr := AObjectMgr;
|
FObjectMgr := AObjectMgr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// ValueByName
|
// ValueByName
|
||||||
function TPdfDictionary.ValueByName(AKey: string): TPdfObject;
|
function TPdfDictionary.ValueByName(const AKey: string): TPdfObject;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
FElement: TPdfDictionaryElement;
|
FElement: TPdfDictionaryElement;
|
||||||
@ -774,55 +774,55 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfNumberByName
|
// PdfNumberByName
|
||||||
function TPdfDictionary.PdfNumberByName(AKey: string): TPdfNumber;
|
function TPdfDictionary.PdfNumberByName(const AKey: string): TPdfNumber;
|
||||||
begin
|
begin
|
||||||
result := TPdfNumber(ValueByName(AKey));
|
result := TPdfNumber(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfTextByName
|
// PdfTextByName
|
||||||
function TPdfDictionary.PdfTextByName(AKey: string): TPdfText;
|
function TPdfDictionary.PdfTextByName(const AKey: string): TPdfText;
|
||||||
begin
|
begin
|
||||||
result := TPdfText(ValueByName(AKey));
|
result := TPdfText(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfRealByName
|
// PdfRealByName
|
||||||
function TPdfDictionary.PdfRealByName(AKey: string): TPdfReal;
|
function TPdfDictionary.PdfRealByName(const AKey: string): TPdfReal;
|
||||||
begin
|
begin
|
||||||
result := TPdfReal(ValueByName(AKey));
|
result := TPdfReal(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfStringByName
|
// PdfStringByName
|
||||||
function TPdfDictionary.PdfStringByName(AKey: string): TPdfString;
|
function TPdfDictionary.PdfStringByName(const AKey: string): TPdfString;
|
||||||
begin
|
begin
|
||||||
result := TPdfString(ValueByName(AKey));
|
result := TPdfString(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfNameByName
|
// PdfNameByName
|
||||||
function TPdfDictionary.PdfNameByName(AKey: string): TPdfName;
|
function TPdfDictionary.PdfNameByName(const AKey: string): TPdfName;
|
||||||
begin
|
begin
|
||||||
result := TPdfName(ValueByName(AKey));
|
result := TPdfName(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfDictionaryByName
|
// PdfDictionaryByName
|
||||||
function TPdfDictionary.PdfDictionaryByName(AKey: string): TPdfDictionary;
|
function TPdfDictionary.PdfDictionaryByName(const AKey: string): TPdfDictionary;
|
||||||
begin
|
begin
|
||||||
result := TPdfDictionary(ValueByName(AKey));
|
result := TPdfDictionary(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfArrayByName
|
// PdfArrayByName
|
||||||
function TPdfDictionary.PdfArrayByName(AKey: string): TPdfArray;
|
function TPdfDictionary.PdfArrayByName(const AKey: string): TPdfArray;
|
||||||
begin
|
begin
|
||||||
result := TPdfArray(ValueByName(AKey));
|
result := TPdfArray(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// PdfBooleanByName
|
// PdfBooleanByName
|
||||||
function TPdfDictionary.PdfBooleanByName(AKey: string): TPdfBoolean;
|
function TPdfDictionary.PdfBooleanByName(const AKey: string): TPdfBoolean;
|
||||||
begin
|
begin
|
||||||
result := TPdfBoolean(ValueByName(AKey));
|
result := TPdfBoolean(ValueByName(AKey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// AddItem
|
// AddItem
|
||||||
procedure TPdfDictionary.AddItem(AKey: string; AValue: TPdfObject);
|
procedure TPdfDictionary.AddItem(const AKey: string; AValue: TPdfObject);
|
||||||
var
|
var
|
||||||
FItem: TPdfDictionaryElement;
|
FItem: TPdfDictionaryElement;
|
||||||
FTmpObject: TPdfVirtualObject;
|
FTmpObject: TPdfVirtualObject;
|
||||||
@ -841,19 +841,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// AddNumberItem
|
// AddNumberItem
|
||||||
procedure TPdfDictionary.AddNumberItem(AKey: string; AValue: Integer);
|
procedure TPdfDictionary.AddNumberItem(const AKey: string; AValue: Integer);
|
||||||
begin
|
begin
|
||||||
AddItem(AKey, TPdfNumber.CreateNumber(AValue));
|
AddItem(AKey, TPdfNumber.CreateNumber(AValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// AddNameItem
|
// AddNameItem
|
||||||
procedure TPdfDictionary.AddNameItem(AKey: string; AValue: string);
|
procedure TPdfDictionary.AddNameItem(const AKey: string; AValue: string);
|
||||||
begin
|
begin
|
||||||
AddItem(AKey, TPdfName.CreateName(AValue));
|
AddItem(AKey, TPdfName.CreateName(AValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// AddInternalItem
|
// AddInternalItem
|
||||||
procedure TPdfDictionary.AddInternalItem(AKey: string; AValue: TPdfObject);
|
procedure TPdfDictionary.AddInternalItem(const AKey: string; AValue: TPdfObject);
|
||||||
var
|
var
|
||||||
FItem: TPdfDictionaryElement;
|
FItem: TPdfDictionaryElement;
|
||||||
FTmpObject: TPdfVirtualObject;
|
FTmpObject: TPdfVirtualObject;
|
||||||
@ -872,7 +872,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// RemoveItem
|
// RemoveItem
|
||||||
procedure TPdfDictionary.RemoveItem(AKey: string);
|
procedure TPdfDictionary.RemoveItem(const AKey: string);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
FElement: TPdfDictionaryElement;
|
FElement: TPdfDictionaryElement;
|
||||||
@ -1178,7 +1178,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// _GetCharCount
|
// _GetCharCount
|
||||||
function _GetCharCount(Text: string): integer;
|
function _GetCharCount(const Text: string): integer;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
@ -1214,7 +1214,7 @@ begin
|
|||||||
result := result + CP1252(word(w[i]), InvalidChar);
|
result := result + CP1252(word(w[i]), InvalidChar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; Alias: string);
|
procedure PdfLazRegisterClassAlias(aClass: TPersistentClass; const Alias: string);
|
||||||
begin
|
begin
|
||||||
Classes.RegisterClass(aClass);
|
Classes.RegisterClass(aClass);
|
||||||
if AliasList=nil then
|
if AliasList=nil then
|
||||||
@ -1222,7 +1222,7 @@ begin
|
|||||||
AliasList.AddObject(Alias, TObject(aClass));
|
AliasList.AddObject(Alias, TObject(aClass));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function PdfLazFindClass(aClassName: String): TPersistentClass;
|
function PdfLazFindClass(const aClassName: String): TPersistentClass;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user