mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-01 03:36:07 +02:00
git-svn-id: trunk@57669 -
This commit is contained in:
parent
67119a8356
commit
4bf891d80c
@ -195,7 +195,7 @@ type
|
||||
strict private
|
||||
FFont: NSFont;
|
||||
FName: AnsiString;
|
||||
FSize: CGFloat;
|
||||
FSize: Integer;
|
||||
FStyle: TCocoaFontStyle;
|
||||
FAntialiased: Boolean;
|
||||
FIsSystemFont: Boolean;
|
||||
@ -210,7 +210,7 @@ type
|
||||
property Antialiased: Boolean read FAntialiased;
|
||||
property Font: NSFont read FFont;
|
||||
property Name: String read FName;
|
||||
property Size: CGFloat read FSize;
|
||||
property Size: Integer read FSize;
|
||||
property Style: TCocoaFontStyle read FStyle;
|
||||
property RotationDeg: Single read FRotationDeg;
|
||||
end;
|
||||
@ -559,8 +559,6 @@ var
|
||||
Win32Weight, LoopCount: Integer;
|
||||
CocoaWeight: NSInteger;
|
||||
FTmpFont: NSFont;
|
||||
const
|
||||
DPI = 96; // todo: what about Retina displays and scaled displays?
|
||||
begin
|
||||
inherited Create(AGlobal);
|
||||
|
||||
@ -580,14 +578,8 @@ begin
|
||||
|
||||
if ALogFont.lfHeight = 0 then
|
||||
FSize := Round(NSFont.systemFontSize)
|
||||
else begin
|
||||
// lfHeight is height in pixels (TFont.ReferenceNeeded), FSize is in points
|
||||
// (TFont has property "Size" - which is size in points, but it's not passed to LOGFONT)
|
||||
// todo: check for the actual DPI
|
||||
// also, negative height and positive height are different hights, thus
|
||||
// abs() is not really accurate
|
||||
FSize := Round(Abs(ALogFont.lfHeight * 72 / DPI)*10)/10;
|
||||
end;
|
||||
else
|
||||
FSize := Abs(ALogFont.lfHeight);
|
||||
|
||||
// create font attributes
|
||||
Win32Weight := ALogFont.lfWeight;
|
||||
|
@ -1174,8 +1174,6 @@ var
|
||||
AExtLogPen: PExtLogPen absolute Buf;
|
||||
AFont: TCocoaFont absolute AObject;
|
||||
ALogFont: PLogFont absolute Buf;
|
||||
const
|
||||
DPI = 96;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
@ -1305,7 +1303,7 @@ begin
|
||||
Result := SizeOf(TLogFont);
|
||||
FillChar(ALogFont^, SizeOf(ALogFont^), 0);
|
||||
ALogFont^.lfFaceName := AFont.Name;
|
||||
ALogFont^.lfHeight := -Round( AFont.Size * DPI / 72);
|
||||
ALogFont^.lfHeight := AFont.Size;
|
||||
Traits := NSFontManager.sharedFontManager.traitsOfFont(AFont.Font);
|
||||
if (Traits and NSFontBoldTrait) <> 0 then
|
||||
ALogFont^.lfWeight := FW_BOLD
|
||||
|
Loading…
Reference in New Issue
Block a user