examples/gkurve: update to latest freetype API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
112b837cae
commit
53a1a2e9fd
2 changed files with 4 additions and 4 deletions
|
|
@ -96,7 +96,7 @@ fn write(ctx: WriterContext, bytes: []const u8) WriterError!usize {
|
||||||
// Add 1 pixel padding to texture to avoid bleeding over other textures
|
// Add 1 pixel padding to texture to avoid bleeding over other textures
|
||||||
var glyph_data = try ctx.label.allocator.alloc(zigimg.color.Rgba32, (glyph_width + 2) * (glyph_height + 2));
|
var glyph_data = try ctx.label.allocator.alloc(zigimg.color.Rgba32, (glyph_width + 2) * (glyph_height + 2));
|
||||||
defer ctx.label.allocator.free(glyph_data);
|
defer ctx.label.allocator.free(glyph_data);
|
||||||
const glyph_buffer = glyph_bitmap.buffer();
|
const glyph_buffer = glyph_bitmap.buffer().?;
|
||||||
for (glyph_data) |*data, i| {
|
for (glyph_data) |*data, i| {
|
||||||
const x = i % (glyph_width + 2);
|
const x = i % (glyph_width + 2);
|
||||||
const y = i / (glyph_width + 2);
|
const y = i / (glyph_width + 2);
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ fn write(ctx: WriterContext, bytes: []const u8) WriterError!usize {
|
||||||
switch (char) {
|
switch (char) {
|
||||||
'\n' => {
|
'\n' => {
|
||||||
offset[0] = 0;
|
offset[0] = 0;
|
||||||
offset[1] -= @intToFloat(f32, ctx.label.face.sizeMetrics().?.height >> 6);
|
offset[1] -= @intToFloat(f32, ctx.label.face.size().metrics().height >> 6);
|
||||||
std.debug.todo("New line not implemented yet");
|
std.debug.todo("New line not implemented yet");
|
||||||
},
|
},
|
||||||
' ' => {
|
' ' => {
|
||||||
|
|
@ -123,7 +123,7 @@ fn write(ctx: WriterContext, bytes: []const u8) WriterError!usize {
|
||||||
const v = try ctx.label.char_map.getOrPut(char);
|
const v = try ctx.label.char_map.getOrPut(char);
|
||||||
if (!v.found_existing) {
|
if (!v.found_existing) {
|
||||||
try ctx.label.face.loadChar(char, .{ .no_scale = true, .no_bitmap = true });
|
try ctx.label.face.loadChar(char, .{ .no_scale = true, .no_bitmap = true });
|
||||||
const glyph = ctx.label.face.glyph;
|
const glyph = ctx.label.face.glyph();
|
||||||
|
|
||||||
// Use a big scale and then scale to the actual text size
|
// Use a big scale and then scale to the actual text size
|
||||||
const multiplier = 1024 << 6;
|
const multiplier = 1024 << 6;
|
||||||
|
|
@ -167,7 +167,7 @@ fn write(ctx: WriterContext, bytes: []const u8) WriterError!usize {
|
||||||
.shift = 0,
|
.shift = 0,
|
||||||
.delta = 0,
|
.delta = 0,
|
||||||
};
|
};
|
||||||
try ctx.label.face.glyph.outline().?.decompose(&outline_ctx, callbacks);
|
try ctx.label.face.glyph().outline().?.decompose(&outline_ctx, callbacks);
|
||||||
|
|
||||||
uniteOutsideAndInsideVertices(&outline_ctx);
|
uniteOutsideAndInsideVertices(&outline_ctx);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue