项目符号采用ZapfDingbats字体
This commit is contained in:
+20
-16
@@ -1,18 +1,19 @@
|
||||
type TSFontWare = class
|
||||
public
|
||||
function Create(pdf: PdfFile);
|
||||
function GetFontByText(text: string; name: string; bold: boolean; italic: boolean);
|
||||
function GetAsciiFont(name: string; bold: boolean; italic: boolean);
|
||||
function GetCNSFont(name: string; bold: boolean; italic: boolean);
|
||||
function GetFontByText(text: string; name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
function GetAsciiFont(name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
function GetCNSFont(name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
function GetSymbolFont(): PdfFont;
|
||||
function UseExternalFont();
|
||||
function SetSubstitutionRules(source: string; target: string);
|
||||
function SetDefaultSz(value: real);
|
||||
function GetDefaultSz();
|
||||
function GetDefaultSz(): real;
|
||||
|
||||
private
|
||||
function GetExternalFont(name:string; bold: boolean; italic: boolean);
|
||||
function GetBuiltInCNSFont(name:string; bold: boolean; italic: boolean);
|
||||
function GetBuiltInAsciiFont(name:string; bold: boolean; italic: boolean);
|
||||
function GetExternalFont(name:string; bold: boolean; italic: boolean): PdfFont;
|
||||
function GetBuiltInCNSFont(name:string; bold: boolean; italic: boolean): PdfFont;
|
||||
function GetBuiltInAsciiFont(name:string; bold: boolean; italic: boolean): PdfFont;
|
||||
|
||||
private
|
||||
[weakref]pdf_: PdfFile;
|
||||
@@ -71,7 +72,7 @@ begin
|
||||
return font;
|
||||
end;
|
||||
|
||||
function TSFontWare.GetFontByText(text: string; name: string; bold: boolean; italic: boolean);
|
||||
function TSFontWare.GetFontByText(text: string; name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
begin
|
||||
len := length(text);
|
||||
if len > 1 then
|
||||
@@ -80,12 +81,12 @@ begin
|
||||
return {self.}GetAsciiFont(name, bold, italic);
|
||||
end;
|
||||
|
||||
function TSFontWare.GetCNSFont(name: string; bold: boolean; italic: boolean);
|
||||
function TSFontWare.GetCNSFont(name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
begin
|
||||
return use_built_in_font_ ? {self.}GetBuiltInCNSFont(name, bold, italic) : {self.}GetExternalFont(name, bold, italic);
|
||||
end;
|
||||
|
||||
function TSFontWare.GetBuiltInCNSFont(name: string; bold: boolean; italic: boolean);
|
||||
function TSFontWare.GetBuiltInCNSFont(name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
begin
|
||||
font_name := substitution_rules_[name];
|
||||
if ifnil(font_name) then font_name := "SimSun";
|
||||
@@ -95,16 +96,15 @@ begin
|
||||
font_name += ",Bold";
|
||||
else if italic then
|
||||
font_name += ",Italic";
|
||||
font := pdf_.GetFont(font_name, "GBK-EUC-H");
|
||||
return font;
|
||||
return pdf_.GetFont(font_name, "GBK-EUC-H");
|
||||
end;
|
||||
|
||||
function TSFontWare.GetAsciiFont(name: string; bold: boolean; italic: boolean);
|
||||
function TSFontWare.GetAsciiFont(name: string; bold: boolean; italic: boolean): PdfFont;
|
||||
begin
|
||||
return use_built_in_font_ ? {self.}GetBuiltInAsciiFont(name, bold, italic) : {self.}GetExternalFont(name, bold, italic);
|
||||
end;
|
||||
|
||||
function TSFontWare.GetBuiltInAsciiFont(name:string; bold: boolean; italic: boolean);
|
||||
function TSFontWare.GetBuiltInAsciiFont(name:string; bold: boolean; italic: boolean): PdfFont;
|
||||
begin
|
||||
font_name := substitution_rules_[name];
|
||||
if ifnil(font_name) then font_name := "Times-Roman";
|
||||
@@ -126,11 +126,15 @@ begin
|
||||
else if italic then
|
||||
font_name += "Times-Italic";
|
||||
end
|
||||
font := pdf_.GetFont(font_name, "");
|
||||
return font;
|
||||
return pdf_.GetFont(font_name, "");
|
||||
end;
|
||||
|
||||
function TSFontWare.SetSubstitutionRules(source: string; target: string);
|
||||
begin
|
||||
substitution_rules_[source] := target;
|
||||
end;
|
||||
|
||||
function TSFontWare.GetSymbolFont(): PdfFont;
|
||||
begin
|
||||
return pdf_.GetFont("ZapfDingbats", "");
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user