Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 8694e61316 |
8 changed files with 63502 additions and 6046 deletions
BIN
resource/font/SourceSans3-Bold.ttf
Normal file
BIN
resource/font/SourceSans3-Bold.ttf
Normal file
Binary file not shown.
BIN
resource/font/SourceSans3-Regular.ttf
Normal file
BIN
resource/font/SourceSans3-Regular.ttf
Normal file
Binary file not shown.
34758
src/text/font/boldttf.c
34758
src/text/font/boldttf.c
File diff suppressed because it is too large
Load diff
34771
src/text/font/ttf.c
34771
src/text/font/ttf.c
File diff suppressed because it is too large
Load diff
|
|
@ -53,7 +53,7 @@ static int ft2_MwDrawText(MwWidget handle, MwPoint* point, const char* text, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x += ttf->face->glyph->metrics.horiAdvance / 64;
|
x += ttf->face->glyph->metrics.horiAdvance >> 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = MwLoadRaw(handle, px, tw, th);
|
p = MwLoadRaw(handle, px, tw, th);
|
||||||
|
|
@ -92,7 +92,7 @@ static int ft2_MwTextWidth(MwWidget handle, const char* text) {
|
||||||
|
|
||||||
FT_Load_Char(ttf->face, c, FT_LOAD_RENDER);
|
FT_Load_Char(ttf->face, c, FT_LOAD_RENDER);
|
||||||
|
|
||||||
tw += ttf->face->glyph->metrics.horiAdvance / 64;
|
tw += ttf->face->glyph->metrics.horiAdvance >> 6;
|
||||||
if(tw > mtw) mtw = tw;
|
if(tw > mtw) mtw = tw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ static void draw(MwWidget handle) {
|
||||||
p.x = (r.width - (r.width / w * w)) / 2 + (MwGetInteger(handle, MwNisRounded) ? MwGetInteger(handle, MwNroundness) : 0);
|
p.x = (r.width - (r.width / w * w)) / 2 + (MwGetInteger(handle, MwNisRounded) ? MwGetInteger(handle, MwNroundness) : 0);
|
||||||
p.y = r.height / 2;
|
p.y = r.height / 2;
|
||||||
|
|
||||||
len = (r.width - p.x * 2) / w;
|
len = (r.width - p.x * 2) / (w / 1.5);
|
||||||
|
|
||||||
if(len >= 0) {
|
if(len >= 0) {
|
||||||
show = malloc(len * 4 + 1);
|
show = malloc(len * 4 + 1);
|
||||||
|
|
@ -67,10 +67,6 @@ static void draw(MwWidget handle) {
|
||||||
|
|
||||||
MwDrawText(handle, &p, show, 0, MwALIGNMENT_BEGINNING, text);
|
MwDrawText(handle, &p, show, 0, MwALIGNMENT_BEGINNING, text);
|
||||||
|
|
||||||
textlen = (t->cursor - 1) % len + 1;
|
|
||||||
for(i = 0; i < textlen; i++) show[i] = 'M';
|
|
||||||
show[i] = 0;
|
|
||||||
|
|
||||||
currc.x = p.x + MwTextWidth(handle, show);
|
currc.x = p.x + MwTextWidth(handle, show);
|
||||||
currc.y = (r.height - h) / 2;
|
currc.y = (r.height - h) / 2;
|
||||||
currc.width = 1;
|
currc.width = 1;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ int main(int argc, char** argv) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("/**\n");
|
printf("/**\n");
|
||||||
printf(" * Copyright notice:\n");
|
printf(" * Copyright notice:\n");
|
||||||
printf(" * \"%s\"\n", rec.u.atom);
|
|
||||||
printf(" */\n");
|
printf(" */\n");
|
||||||
printf("MwFont MwFontData[] = {\n");
|
printf("MwFont MwFontData[] = {\n");
|
||||||
for(i = 0; i < 0x100; i++) {
|
for(i = 0; i < 0x100; i++) {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
for out in src/font/ttf.c src/font/boldttf.c; do
|
for out in src/text/font/ttf.c src/text/font/boldttf.c; do
|
||||||
echo '#include <Mw/Milsko.h>' > $out
|
echo '#include <Mw/Milsko.h>' > $out
|
||||||
echo '' >> $out
|
echo '' >> $out
|
||||||
echo '#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)' >> $out
|
echo '#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)' >> $out
|
||||||
done
|
done
|
||||||
xxd -n MwTTFData -i resource/font/IBMPlexMono.ttf | sed s/_len/Size/ >> src/font/ttf.c
|
xxd -n MwTTFData -i resource/font/SourceSans3-Regular.ttf | sed s/_len/Size/ >> src/text/font/ttf.c
|
||||||
xxd -n MwBoldTTFData -i resource/font/IBMPlexMono-Bold.ttf | sed s/_len/Size/ >> src/font/boldttf.c
|
xxd -n MwBoldTTFData -i resource/font/SourceSans3-Bold.ttf | sed s/_len/Size/ >> src/text/font/boldttf.c
|
||||||
for out in src/font/ttf.c src/font/boldttf.c; do
|
for out in src/text/font/ttf.c src/text/font/boldttf.c; do
|
||||||
echo '#endif' >> $out
|
echo '#endif' >> $out
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue