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