diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index f1a6f80c8..c03746a48 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -531,7 +531,7 @@ pub fn add( const nf_symbols = b.dependency("nerd_fonts_symbols_only", .{}); step.root_module.addAnonymousImport( "nerd_fonts_symbols_only", - .{ .root_source_file = nf_symbols.path("SymbolsNerdFontMono-Regular.ttf") }, + .{ .root_source_file = nf_symbols.path("SymbolsNerdFont-Regular.ttf") }, ); } diff --git a/src/font/SharedGridSet.zig b/src/font/SharedGridSet.zig index 14b0c6f68..5f388e09d 100644 --- a/src/font/SharedGridSet.zig +++ b/src/font/SharedGridSet.zig @@ -299,14 +299,17 @@ fn collection( ); // Nerd-font symbols fallback. + // For proper icon scaling, this should be loaded at the same point + // size as the primary font and not undergo size normalization, + // hence we use the em size as scale reference. _ = try c.add( self.alloc, .regular, - .init(.{ .fallback_loaded = try Face.init( + .initWithScaleReference(.{ .fallback_loaded = try .init( self.font_lib, font.embedded.symbols_nerd_font, load_options.faceOptions(), - ) }), + ) }, .em_size), ); // On macOS, always search for and add the Apple Emoji font diff --git a/src/font/face.zig b/src/font/face.zig index fc5118c3d..cf2ed7218 100644 --- a/src/font/face.zig +++ b/src/font/face.zig @@ -222,7 +222,7 @@ pub const RenderOptions = struct { ) GlyphSize { var g = glyph; - var available_width: f64 = @floatFromInt( + const available_width: f64 = @floatFromInt( metrics.cell_width * @min( self.max_constraint_width, constraint_width, @@ -233,22 +233,6 @@ pub const RenderOptions = struct { .icon => metrics.icon_height, }); - // We make the opinionated choice here to reduce the width - // of icon-height symbols by the same amount horizontally, - // since otherwise wide aspect ratio icons like folders end - // up far too wide. - // - // But we *only* do this if the constraint width is 2, since - // otherwise it would make them way too small when sized for - // a single cell. - const is_icon_width = self.height == .icon and @min(self.max_constraint_width, constraint_width) > 1; - const orig_avail_width = available_width; - if (is_icon_width) { - const cell_height: f64 = @floatFromInt(metrics.cell_height); - const ratio = available_height / cell_height; - available_width *= ratio; - } - const w = available_width - self.pad_left * available_width - self.pad_right * available_width; @@ -372,11 +356,6 @@ pub const RenderOptions = struct { .center => g.y = (h - g.height) / 2, } - // Add offset for icon width restriction, to keep it centered. - if (is_icon_width) { - g.x += (orig_avail_width - available_width) / 2; - } - // Re-add our padding before returning. g.x += self.pad_left * available_width; g.y += self.pad_bottom * available_height;