diff --git a/src/App.zig b/src/App.zig index 784d390ef..b0cfd0e1c 100644 --- a/src/App.zig +++ b/src/App.zig @@ -67,7 +67,7 @@ pub fn run(self: App) !void { gl.clearColor(0.2, 0.3, 0.3, 1.0); gl.clear(gl.c.GL_COLOR_BUFFER_BIT); - try self.text.render("hello", 25.0, 25.0, 1.0, .{ 0.5, 0.8, 0.2 }); + try self.text.render("sh $ /bin/bash -c \"echo hello\"", 25.0, 25.0, 1.0, .{ 0.5, 0.8, 0.2 }); try self.window.swapBuffers(); try glfw.waitEvents(); diff --git a/src/TextRenderer.zig b/src/TextRenderer.zig index 4ea49875a..0c0a23723 100644 --- a/src/TextRenderer.zig +++ b/src/TextRenderer.zig @@ -53,17 +53,6 @@ pub fn init(alloc: std.mem.Allocator) !TextRenderer { return error.GlyphLoadFailed; } - if (face.*.glyph.*.bitmap.buffer == null) { - // Unrenderable characters - chars.appendAssumeCapacity(.{ - .tex = undefined, - .size = undefined, - .bearing = undefined, - .advance = undefined, - }); - continue; - } - // Generate the texture const tex = try gl.Texture.create(); var binding = try tex.bind(gl.c.GL_TEXTURE_2D); @@ -177,7 +166,7 @@ pub fn render( const char = self.chars.items[c]; const xpos = curx + (char.bearing[0] * scale); - const ypos = y + (char.bearing[1] * scale); + const ypos = y - ((char.size[1] - char.bearing[1]) * scale); const w = char.size[0] * scale; const h = char.size[1] * scale; diff --git a/src/opengl/Texture.zig b/src/opengl/Texture.zig index d3af48ad6..eafb8979b 100644 --- a/src/opengl/Texture.zig +++ b/src/opengl/Texture.zig @@ -38,7 +38,7 @@ pub const Binding = struct { border: c.GLint, format: c.GLenum, typ: c.GLenum, - data: *const anyopaque, + data: ?*const anyopaque, ) !void { c.glTexImage2D( b.target,