LazReport, fix selecting the right font after switching of printers, fix icons in font list to show what fonts came from printer

git-svn-id: trunk@43186 -
This commit is contained in:
jesus 2013-10-09 05:34:44 +00:00
parent 6099679fa6
commit 7ac8ef0af4
2 changed files with 27 additions and 15 deletions

View File

@ -1926,7 +1926,7 @@ inherited frDesignerForm: TfrDesignerForm
object C2: TComboBox object C2: TComboBox
Tag = 7 Tag = 7
Left = 1 Left = 1
Height = 21 Height = 19
Top = 2 Top = 2
Width = 155 Width = 155
ItemHeight = 13 ItemHeight = 13
@ -1935,6 +1935,7 @@ inherited frDesignerForm: TfrDesignerForm
OnGetItems = C2GetItems OnGetItems = C2GetItems
ParentFont = False ParentFont = False
Sorted = True Sorted = True
Style = csOwnerDrawFixed
TabOrder = 1 TabOrder = 1
end end
end end

View File

@ -2892,6 +2892,7 @@ procedure TfrDesignerForm.GetFontList;
var var
DC: HDC; DC: HDC;
Lf: TLogFont; Lf: TLogFont;
S: String;
{$IFDEF USE_PRINTER_FONTS} {$IFDEF USE_PRINTER_FONTS}
Lst: TStrings; Lst: TStrings;
i: Integer; i: Integer;
@ -2929,18 +2930,28 @@ begin
end; end;
{$ENDIF} {$ENDIF}
if C2.Items.Count>0 then if (SelNum>0) and (FirstSelected is TfrMemoView) then
LastFontName := C2.Items[0] begin
else // font of selected memo has preference, select it
LastFontName := ''; LastFontname := TfrMemoView(FirstSelected).Font.Name;
LastFontSize := TfrMemoView(FirstSelected).Font.Size;
if C2.Items.IndexOf('Arial') <> -1 then end else
LastFontName := 'Arial' if C2.Items.IndexOf(LastFontName)>=0 then
else if C2.Items.IndexOf('helvetica [urw]')<>-1 then // last font name remains valid, keep it together with lastFontSize
LastFontName := 'helvetica [urw]' else begin
else if C2.Items.IndexOf('Arial Cyr') <> -1 then // setup an initial font name and size
LastFontName := 'Arial Cyr'; if C2.Items.Count>0 then
LastFontSize := 10; LastFontName := C2.Items[0]
else
LastFontName := '';
if C2.Items.IndexOf('Arial') <> -1 then
LastFontName := 'Arial'
else if C2.Items.IndexOf('helvetica [urw]')<>-1 then
LastFontName := 'helvetica [urw]'
else if C2.Items.IndexOf('Arial Cyr') <> -1 then
LastFontName := 'Arial Cyr';
LastFontSize := 10;
end;
end; end;
procedure TfrDesignerForm.FormCreate(Sender: TObject); procedure TfrDesignerForm.FormCreate(Sender: TObject);
@ -4841,9 +4852,9 @@ begin
if t is TfrMemoView then if t is TfrMemoView then
with t as TfrMemoView do with t as TfrMemoView do
case b of case b of
7: if C2.ItemIndex <> 0 then 7: if C2.ItemIndex >= 0 then
begin begin
Font.Name := C2.Text; Font.Name := C2.Items[C2.ItemIndex];
LastFontName := Font.Name; LastFontName := Font.Name;
end; end;
8: begin 8: begin