freetype: support compiling with stage2 (-fno-stage1)

This commit is contained in:
PiergiorgioZagaria 2022-07-06 11:59:28 +02:00 committed by Stephen Gutekanst
parent d3b03901fb
commit b4ac18ec57
10 changed files with 61 additions and 29 deletions

View file

@ -1,6 +1,11 @@
const std = @import("std");
const freetype = @import("freetype");
// Remove once the stage2 compiler fixes pkg std not found
comptime {
_ = @import("utils");
}
const OutlinePrinter = struct {
library: freetype.Library,
face: freetype.Face,
@ -14,13 +19,14 @@ const OutlinePrinter = struct {
const Self = @This();
var buf = [_]u8{0} ** (1024 * 10);
pub fn init(file: std.fs.File) freetype.Error!Self {
var lib = try freetype.Library.init();
return Self{
.library = lib,
.face = try lib.newFace("upstream/assets/FiraSans-Regular.ttf", 0),
.output_file = file,
.path_stream = std.io.fixedBufferStream(&std.mem.zeroes([1024 * 10]u8)),
.path_stream = std.io.fixedBufferStream(&buf),
.xMin = 0,
.yMin = 0,
.width = 0,

View file

@ -2,6 +2,11 @@
const std = @import("std");
const freetype = @import("freetype");
// Remove once the stage2 compiler fixes pkg std not found
comptime {
_ = @import("utils");
}
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();