font/fontconfig: adhere to correct function signature

This commit is contained in:
Mitchell Hashimoto
2023-10-03 09:18:40 -07:00
parent 1127330b3a
commit 15e6c07bd9
3 changed files with 6 additions and 3 deletions

View File

@ -379,6 +379,7 @@ test "fontconfig" {
const discovery = @import("main.zig").discovery;
const testing = std.testing;
const alloc = testing.allocator;
// Load freetype
var lib = try Library.init();
@ -387,7 +388,7 @@ test "fontconfig" {
// Get a deferred face from fontconfig
var def = def: {
var fc = discovery.Fontconfig.init();
var it = try fc.discover(.{ .family = "monospace", .size = 12 });
var it = try fc.discover(alloc, .{ .family = "monospace", .size = 12 });
defer it.deinit();
break :def (try it.next()).?;
};

View File

@ -835,7 +835,7 @@ test "discover monospace with fontconfig and freetype" {
// Search for fonts
var fc = Discover.init();
var it = try fc.discover(.{ .family = "monospace", .size = 12 });
var it = try fc.discover(alloc, .{ .family = "monospace", .size = 12 });
defer it.deinit();
// Initialize the group with the deferred face

View File

@ -234,7 +234,9 @@ pub const Fontconfig = struct {
/// Discover fonts from a descriptor. This returns an iterator that can
/// be used to build up the deferred fonts.
pub fn discover(self: *const Fontconfig, desc: Descriptor) !DiscoverIterator {
pub fn discover(self: *const Fontconfig, alloc: Allocator, desc: Descriptor) !DiscoverIterator {
_ = alloc;
// Build our pattern that we'll search for
const pat = desc.toFcPattern();
errdefer pat.destroy();