ADD: Load/save font quality

This commit is contained in:
Alexander Koblov 2015-06-06 14:03:11 +00:00
commit 6ae1ae3994
3 changed files with 34 additions and 20 deletions

View file

@ -115,11 +115,11 @@ type
// ------------------------------------------------------------------------
procedure GetFont(const aNode: TXmlNode; Path: TXmlPath;
out Name: UTF8String; out Size: Integer; out Style: Integer;
const DefName: UTF8String; const DefSize: Integer; const DefStyle: Integer);
out Name: UTF8String; out Size: Integer; out Style, Quality: Integer;
const DefName: UTF8String; const DefSize: Integer; const DefStyle, DefQuality: Integer);
procedure SetFont(const aNode: TXmlNode; Path: TXmlPath;
const Name: UTF8String; const Size: Integer; const Style: Integer);
const Name: UTF8String; const Size: Integer; const Style, Quality: Integer);
// ------------------------------------------------------------------------
@ -732,25 +732,28 @@ begin
end;
end;
procedure TXmlConfig.GetFont(const aNode: TXmlNode; Path: TXmlPath;
out Name: UTF8String; out Size: Integer; out Style: Integer;
const DefName: UTF8String; const DefSize: Integer; const DefStyle: Integer);
procedure TXmlConfig.GetFont(const aNode: TXmlNode; Path: TXmlPath; out
Name: UTF8String; out Size: Integer; out Style, Quality: Integer;
const DefName: UTF8String; const DefSize: Integer; const DefStyle,
DefQuality: Integer);
begin
if Path <> '' then
Path := Path + '/';
Name := GetValue(aNode, Path + 'Name', DefName);
Size := GetValue(aNode, Path + 'Size', DefSize);
Style := GetValue(aNode, Path + 'Style', DefStyle);
Quality := GetValue(aNode, Path + 'Quality', DefQuality);
end;
procedure TXmlConfig.SetFont(const aNode: TXmlNode; Path: TXmlPath;
const Name: UTF8String; const Size: Integer; const Style: Integer);
const Name: UTF8String; const Size: Integer; const Style, Quality: Integer);
begin
if Path <> '' then
Path := Path + '/';
SetValue(aNode, Path + 'Name', Name);
SetValue(aNode, Path + 'Size', Size);
SetValue(aNode, Path + 'Style', Style);
SetValue(aNode, Path + 'Quality', Quality);
end;
end.

View file

@ -758,8 +758,9 @@ end;
procedure TPanelColumnsClass.Load(AConfig: TXmlConfig; ANode: TXmlNode);
var
AColumn: TPanelColumn;
Quality: Integer;
SubNode: TXmlNode;
AColumn: TPanelColumn;
begin
FCustomView := AConfig.GetValue(ANode, 'CustomView', False);
FCursorBorder := AConfig.GetAttr(ANode, 'CursorBorder/Enabled', gUseCursorBorder);
@ -783,8 +784,8 @@ begin
AColumn.FuncString := AConfig.GetValue(SubNode, 'FuncString', '');
AColumn.Width := AConfig.GetValue(SubNode, 'Width', 50);
AColumn.Align := TAlignment(AConfig.GetValue(SubNode, 'Align', Integer(0)));
AConfig.GetFont(SubNode, 'Font', AColumn.FontName, AColumn.FontSize, Integer(AColumn.FontStyle),
gFonts[dcfMain].Name, gFonts[dcfMain].Size, Integer(gFonts[dcfMain].Style));
AConfig.GetFont(SubNode, 'Font', AColumn.FontName, AColumn.FontSize, Integer(AColumn.FontStyle), Quality,
gFonts[dcfMain].Name, gFonts[dcfMain].Size, Integer(gFonts[dcfMain].Style), Quality);
AColumn.TextColor := TColor(AConfig.GetValue(SubNode, 'TextColor', gForeColor));
AColumn.Background := TColor(AConfig.GetValue(SubNode, 'Background', gBackColor));
AColumn.Background2 := TColor(AConfig.GetValue(SubNode, 'Background2', gBackColor2));
@ -829,7 +830,8 @@ begin
AConfig.AddValue(SubNode, 'FuncString', AColumn.FuncString);
AConfig.AddValue(SubNode, 'Width', AColumn.Width);
AConfig.AddValue(SubNode, 'Align', Integer(AColumn.Align));
AConfig.SetFont(SubNode, 'Font', AColumn.FontName, AColumn.FontSize, Integer(AColumn.FontStyle));
AConfig.SetFont(SubNode, 'Font', AColumn.FontName,
AColumn.FontSize, Integer(AColumn.FontStyle), 0);
if AColumn.TextColor <> clNone then
AConfig.AddValue(SubNode, 'TextColor', AColumn.TextColor);

View file

@ -86,6 +86,7 @@ type
Name: String;
Size: Integer;
Style: TFontStyles;
Quality: TFontQuality;
end;
TDCFontsOptions = array[TDCFont] of TDCFontOptions;
@ -896,9 +897,10 @@ procedure FontToFontOptions(Font: TFont; out Options: TDCFontOptions);
begin
with Options do
begin
Name := Font.Name;
Size := Font.Size;
Style := Font.Style;
Name := Font.Name;
Size := Font.Size;
Style := Font.Style;
Quality := Font.Quality;
end;
end;
@ -906,9 +908,10 @@ procedure FontOptionsToFont(Options: TDCFontOptions; Font: TFont);
begin
with Options do
begin
Font.Name := Name;
Font.Size := Size;
Font.Style := Style;
Font.Name := Name;
Font.Size := Size;
Font.Style := Style;
Font.Quality := Quality;
end;
end;
@ -1153,21 +1156,27 @@ begin
gFonts[dcfMain].Name := 'default';
gFonts[dcfMain].Size := 10;
gFonts[dcfMain].Style := [fsBold];
gFonts[dcfMain].Quality := fqDefault;
gFonts[dcfEditor].Name := MonoSpaceFont;
gFonts[dcfEditor].Size := 14;
gFonts[dcfEditor].Style := [];
gFonts[dcfEditor].Quality := fqDefault;
gFonts[dcfViewer].Name := MonoSpaceFont;
gFonts[dcfViewer].Size := 14;
gFonts[dcfViewer].Style := [];
gFonts[dcfViewer].Quality := fqDefault;
gFonts[dcfLog].Name := MonoSpaceFont;
gFonts[dcfLog].Size := 12;
gFonts[dcfLog].Style := [];
gFonts[dcfLog].Quality := fqDefault;
gFonts[dcfViewerBook].Name := 'default';
gFonts[dcfViewerBook].Size := 16;
gFonts[dcfViewerBook].Style := [fsBold];
gFonts[dcfViewerBook].Quality := fqDefault;
gFonts[dcfConsole].Name := MonoSpaceFont;
gFonts[dcfConsole].Size := 12;
gFonts[dcfConsole].Style := [];
gFonts[dcfConsole].Quality := fqDefault;
{ Colors page }
gUseCursorBorder := False;
@ -1956,8 +1965,8 @@ procedure LoadXmlConfig;
procedure GetDCFont(Node: TXmlNode; var FontOptions: TDCFontOptions);
begin
if Assigned(Node) then
gConfig.GetFont(Node, '', FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style),
FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style));
gConfig.GetFont(Node, '', FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style), Integer(FontOptions.Quality),
FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style), Integer(FontOptions.Quality));
end;
procedure LoadOption(Node: TXmlNode; var Options: TDrivesListButtonOptions; Option: TDrivesListButtonOption; AName: String);
var
@ -2509,7 +2518,7 @@ procedure SaveXmlConfig;
procedure SetDCFont(Node: TXmlNode; const FontOptions: TDCFontOptions);
begin
if Assigned(Node) then
gConfig.SetFont(Node, '', FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style));
gConfig.SetFont(Node, '', FontOptions.Name, FontOptions.Size, Integer(FontOptions.Style), Integer(FontOptions.Quality));
end;
var
Root, Node, SubNode: TXmlNode;