freetype: update test fonts path to be used in parent directories
This commit is contained in:
parent
83f051fb58
commit
a6cadba1ba
1 changed files with 10 additions and 6 deletions
|
|
@ -2,8 +2,12 @@ const std = @import("std");
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
const freetype = @import("freetype");
|
const freetype = @import("freetype");
|
||||||
|
|
||||||
const firasans_font_path = "upstream/assets/FiraSans-Regular.ttf";
|
const firasans_font_path = thisDir() ++ "/../upstream/assets/FiraSans-Regular.ttf";
|
||||||
const firasans_font_data = @embedFile("../upstream/assets/FiraSans-Regular.ttf");
|
const firasans_font_data = @embedFile(thisDir() ++ "/../upstream/assets/FiraSans-Regular.ttf");
|
||||||
|
|
||||||
|
fn thisDir() []const u8 {
|
||||||
|
return std.fs.path.dirname(@src().file) orelse ".";
|
||||||
|
}
|
||||||
|
|
||||||
// Remove once the stage2 compiler fixes pkg std not found
|
// Remove once the stage2 compiler fixes pkg std not found
|
||||||
comptime {
|
comptime {
|
||||||
|
|
@ -49,14 +53,14 @@ test "load glyph" {
|
||||||
|
|
||||||
test "attach file" {
|
test "attach file" {
|
||||||
const lib = try freetype.Library.init();
|
const lib = try freetype.Library.init();
|
||||||
const face = try lib.createFace("upstream/assets/DejaVuSans.pfb", 0);
|
const face = try lib.createFace(thisDir() ++ "/../upstream/assets/DejaVuSans.pfb", 0);
|
||||||
try face.attachFile("upstream/assets/DejaVuSans.pfm");
|
try face.attachFile(thisDir() ++ "/../upstream/assets/DejaVuSans.pfm");
|
||||||
}
|
}
|
||||||
|
|
||||||
test "attach from memory" {
|
test "attach from memory" {
|
||||||
const lib = try freetype.Library.init();
|
const lib = try freetype.Library.init();
|
||||||
const face = try lib.createFace("upstream/assets/DejaVuSans.pfb", 0);
|
const face = try lib.createFace(thisDir() ++ "/../upstream/assets/DejaVuSans.pfb", 0);
|
||||||
const file = @embedFile("../upstream/assets/DejaVuSans.pfm");
|
const file = @embedFile(thisDir() ++ "/../upstream/assets/DejaVuSans.pfm");
|
||||||
try face.attachMemory(file);
|
try face.attachMemory(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue