font: fontconfig adaptations to new api

This commit is contained in:
Mitchell Hashimoto
2023-08-25 14:57:05 -07:00
parent f4738210e1
commit c15cf6d9f1
3 changed files with 5 additions and 6 deletions

View File

@ -360,13 +360,13 @@ test "fontconfig" {
defer def.deinit(); defer def.deinit();
// Verify we can get the name // Verify we can get the name
const n = try def.name(); var buf: [1024]u8 = undefined;
const n = try def.name(&buf);
try testing.expect(n.len > 0); try testing.expect(n.len > 0);
// Load it and verify it works // Load it and verify it works
try def.load(lib, .{ .points = 12 }); const face = try def.load(lib, .{ .points = 12 });
try testing.expect(def.hasCodepoint(' ', null)); try testing.expect(face.glyphIndex(' ') != null);
try testing.expect(def.face.?.glyphIndex(' ') != null);
} }
test "coretext" { test "coretext" {

View File

@ -638,7 +638,7 @@ test "discover monospace with fontconfig and freetype" {
defer lib.deinit(); defer lib.deinit();
var group = try init(alloc, lib, .{ .points = 12 }); var group = try init(alloc, lib, .{ .points = 12 });
defer group.deinit(); defer group.deinit();
try group.addFace(.regular, (try it.next()).?); try group.addFace(.regular, .{ .deferred = (try it.next()).? });
// Should find all visible ASCII // Should find all visible ASCII
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale); var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);

View File

@ -217,7 +217,6 @@ pub const Fontconfig = struct {
defer self.i += 1; defer self.i += 1;
return DeferredFace{ return DeferredFace{
.face = null,
.fc = .{ .fc = .{
.pattern = font_pattern, .pattern = font_pattern,
.charset = (try font_pattern.get(.charset, 0)).char_set, .charset = (try font_pattern.get(.charset, 0)).char_set,