cocoa: updating font dialog to return the selected font size. bug #33990

git-svn-id: trunk@62528 -
This commit is contained in:
dmitry 2020-01-11 23:57:57 +00:00
parent d9fdf6d15e
commit 4ac51dd8f4
2 changed files with 6 additions and 1 deletions

View File

@ -1300,7 +1300,7 @@ begin
Result := SizeOf(TLogFont);
FillChar(ALogFont^, SizeOf(ALogFont^), 0);
ALogFont^.lfFaceName := AFont.Name;
ALogFont^.lfHeight := AFont.Size;
ALogFont^.lfHeight := -AFont.Size;
Traits := NSFontManager.sharedFontManager.traitsOfFont(AFont.Font);
if (Traits and NSFontBoldTrait) <> 0 then
ALogFont^.lfWeight := FW_BOLD

View File

@ -137,6 +137,9 @@ type
implementation
uses
CocoaInt;
// API irony.
// In LCL the base dialog is TOpenDialog (savedialog inherits from it)
// In Cocoa the base dialog is SaveDialog (opendialog inherites from it)
@ -654,6 +657,8 @@ begin
oldFont := oldHandle.Font;
//oldFont := NSFont.fontWithName_size(NSFont.systemFontOfSize(0).fontDescriptor.postscriptName, 0);
newFont := FontPanel.panelConvertFont(oldFont);
if (CocoaBasePPI<>72) then
newFont := NSFont.fontWithDescriptor_size(newFont.fontDescriptor, newFont.pointSize * CocoaBasePPI / 72);
newHandle := TCocoaFont.Create(newFont);
FontDialog.Font.Handle := HFONT(newHandle);
end;