mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
coretext: the size needs to be in pixels! (see comment)
This commit is contained in:
@ -41,8 +41,10 @@ pub const Face = struct {
|
|||||||
/// because the font is loaded at a default size during discovery, and then
|
/// because the font is loaded at a default size during discovery, and then
|
||||||
/// adjusted to the final size for final load.
|
/// adjusted to the final size for final load.
|
||||||
pub fn initFontCopy(base: *macos.text.Font, size: font.face.DesiredSize) !Face {
|
pub fn initFontCopy(base: *macos.text.Font, size: font.face.DesiredSize) !Face {
|
||||||
// Create a copy
|
// Create a copy. The copyWithAttributes docs say the size is in points,
|
||||||
const ct_font = try base.copyWithAttributes(@floatFromInt(size.points), null);
|
// but we need to scale the points by the DPI and to do that we use our
|
||||||
|
// function called "pixels".
|
||||||
|
const ct_font = try base.copyWithAttributes(@floatFromInt(size.pixels()), null);
|
||||||
errdefer ct_font.release();
|
errdefer ct_font.release();
|
||||||
|
|
||||||
var hb_font = try harfbuzz.coretext.createFont(ct_font);
|
var hb_font = try harfbuzz.coretext.createFont(ct_font);
|
||||||
|
Reference in New Issue
Block a user