initial commit
This commit is contained in:
commit
64d168f53b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.a
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "thirdparty/libschrift"]
|
||||||
|
path = thirdparty/libschrift
|
||||||
|
url = https://github.com/tomolt/libschrift
|
||||||
4
Makefile
Normal file
4
Makefile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
all:
|
||||||
|
make -C thirdparty/libschrift
|
||||||
|
mkdir -p linux-x64
|
||||||
|
cp thirdparty/libschrift/libschrift.a linux-x64/libschrift.a
|
||||||
58
libschrift.c3
Normal file
58
libschrift.c3
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
module schrift;
|
||||||
|
|
||||||
|
alias SftFont = void*;
|
||||||
|
alias SftUChar = uint;
|
||||||
|
alias SftGlyph = uint;
|
||||||
|
|
||||||
|
const int SFT_DOWNWARD_Y = 0x01;
|
||||||
|
|
||||||
|
struct Sft
|
||||||
|
{
|
||||||
|
SftFont font;
|
||||||
|
double xScale;
|
||||||
|
double yScale;
|
||||||
|
double xOffset;
|
||||||
|
double yOffset;
|
||||||
|
int flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SftLMetrics
|
||||||
|
{
|
||||||
|
double ascender;
|
||||||
|
double descender;
|
||||||
|
double lineGap;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SftGMetrics
|
||||||
|
{
|
||||||
|
double advanceWidth;
|
||||||
|
double leftSideBearing;
|
||||||
|
int yOffset;
|
||||||
|
int minWidth;
|
||||||
|
int minHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SftKerning
|
||||||
|
{
|
||||||
|
double xShift;
|
||||||
|
double yShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SftImage
|
||||||
|
{
|
||||||
|
void *pixels;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn ZString sft_version() @extern("sft_version");
|
||||||
|
|
||||||
|
extern fn SftFont loadmem(void* mem, usz size) @extern("sft_loadmem");
|
||||||
|
extern fn SftFont loadfile(ZString filename) @extern("sft_loadfile");
|
||||||
|
extern fn void freefont(SftFont font) @extern("sft_freefont");
|
||||||
|
|
||||||
|
extern fn int lmetrics(Sft* sft, SftLMetrics* metrics) @extern("sft_lmetrics");
|
||||||
|
extern fn int lookup(Sft* sft, SftUChar codepoint, SftGlyph* glyph) @extern("sft_lookup");
|
||||||
|
extern fn int gmetrics(Sft* sft, SftGlyph glyph, SftGMetrics* metrics) @extern("sft_gmetrics");
|
||||||
|
extern fn int kerning(Sft* sft, SftGlyph leftGlyph, SftGlyph rightGlyph, SftKerning* kerning) @extern("sft_kerning");
|
||||||
|
extern fn int render(Sft* sft, SftGlyph glyph, SftImage image) @extern("sft_render");
|
||||||
9
manifest.json
Normal file
9
manifest.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"provides" : "schrift",
|
||||||
|
"targets" : {
|
||||||
|
"linux-x64" : {
|
||||||
|
"dependencies" : [],
|
||||||
|
"linked-libraries" : ["schrift", "c"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
project.json
Normal file
14
project.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"langrev": "1",
|
||||||
|
"warnings": [ "no-unused" ],
|
||||||
|
"dependency-search-paths": [ ".." ],
|
||||||
|
"dependencies": [ "schrift" ],
|
||||||
|
"authors": [ "Alessandro Mauri <alemauri001@gmail.com>", "Thomas Oltmann <thomas.oltmann.hhg@gmail.com>" ],
|
||||||
|
"version": "0.1.0",
|
||||||
|
"sources": [ ],
|
||||||
|
"output": "build",
|
||||||
|
"target": "linux-x64",
|
||||||
|
"features": [],
|
||||||
|
"cpu": "generic",
|
||||||
|
"opt": "O0",
|
||||||
|
}
|
||||||
1
thirdparty/libschrift
vendored
Submodule
1
thirdparty/libschrift
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 24737d2922b23df4a5692014f5ba03da0c296112
|
||||||
Loading…
x
Reference in New Issue
Block a user