diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index ea7e696ef..bdc1dfe14 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -533,7 +533,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 14a8babad..cdea3a467 100644 --- a/src/font/SharedGridSet.zig +++ b/src/font/SharedGridSet.zig @@ -305,7 +305,7 @@ fn collection( .{ .fallback_loaded = try Face.init( self.font_lib, font.embedded.symbols_nerd_font, - load_options.faceOptions(), + load_options.faceOptions().setReferenceMetric(.em_size), ) }, ); diff --git a/src/font/face.zig b/src/font/face.zig index 1642095ce..a211be9bc 100644 --- a/src/font/face.zig +++ b/src/font/face.zig @@ -45,6 +45,13 @@ pub const Options = struct { // the implementation of Collections.adjustedSize() for fallback // rules when the font does not define the specified metric. reference_metric: ReferenceMetric = .ic_width, + + // Convenience function to create a copy with a different reference metric. + pub fn setReferenceMetric(self: Options, reference_metric: ReferenceMetric) Options { + var opts = self; + opts.reference_metric = reference_metric; + return opts; + } }; /// The desired size for loading a font. @@ -242,7 +249,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, @@ -253,22 +260,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; @@ -392,11 +383,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;