From 70a2a0556dc818c71811fcc1e3bb10a6f54f6829 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 24 Sep 2023 08:42:12 -0700 Subject: [PATCH] font: fontconfig should not omit earlier fonts --- src/cli/list_fonts.zig | 6 ++++-- src/font/discovery.zig | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cli/list_fonts.zig b/src/cli/list_fonts.zig index 5312e4c6a..1b7c9bcb5 100644 --- a/src/cli/list_fonts.zig +++ b/src/cli/list_fonts.zig @@ -72,9 +72,11 @@ fn runArgs(alloc_gpa: Allocator, argsIter: anytype) !u8 { }; const full_name = try alloc.dupe(u8, full_name_buf); - try families.append(family); const gop = try map.getOrPut(family); - if (!gop.found_existing) gop.value_ptr.* = .{}; + if (!gop.found_existing) { + try families.append(family); + gop.value_ptr.* = .{}; + } try gop.value_ptr.append(alloc, full_name); } diff --git a/src/font/discovery.zig b/src/font/discovery.zig index 7bd7900f5..19b7141d6 100644 --- a/src/font/discovery.zig +++ b/src/font/discovery.zig @@ -198,7 +198,7 @@ pub const Fontconfig = struct { pat.defaultSubstitute(); // Search - const res = self.fc_config.fontSort(pat, true, null); + const res = self.fc_config.fontSort(pat, false, null); if (res.result != .match) return error.FontConfigFailed; errdefer res.fs.destroy();