Mac compatibility I guess.
This commit is contained in:
parent
5ed318f894
commit
0b3b3dbe34
2 changed files with 6 additions and 4 deletions
|
|
@ -5,14 +5,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <uchar.h>
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
FT_Library library;
|
FT_Library library;
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
if ((error = FT_Init_FreeType(&library)) ||
|
if ((error = FT_Init_FreeType(&library)) ||
|
||||||
(error = FT_New_Face(library, "/usr/share/fonts/fonts-master/apache/robotomono/RobotoMono-Medium.ttf", 0, &face)) ||
|
((error = FT_New_Face(library, "/usr/share/fonts/fonts-master/apache/robotomono/RobotoMono-Medium.ttf", 0, &face)) &&
|
||||||
|
(error = FT_New_Face(library, "/Library/Fonts/RobotoMono-Medium.ttf", 0, &face))) ||
|
||||||
(error = FT_Set_Char_Size(face, 0, 550, 0, 141)) ||
|
(error = FT_Set_Char_Size(face, 0, 550, 0, 141)) ||
|
||||||
(error = FT_Load_Char(face, U'w', FT_LOAD_DEFAULT))) return error;
|
(error = FT_Load_Char(face, U'w', FT_LOAD_DEFAULT))) return error;
|
||||||
int width = face->glyph->advance.x >> 6, height = face->size->metrics.height >> 6, height_bytes = (height + 1) >> 1;
|
int width = face->glyph->advance.x >> 6, height = face->size->metrics.height >> 6, height_bytes = (height + 1) >> 1;
|
||||||
|
|
@ -45,7 +45,7 @@ int main(int argc, char **argv) {
|
||||||
"const uint8_t font[0x100][FONT_WIDTH][FONT_HEIGHT_BYTES] = {\n");
|
"const uint8_t font[0x100][FONT_WIDTH][FONT_HEIGHT_BYTES] = {\n");
|
||||||
uint8_t *bitmap = calloc(width, height_bytes);
|
uint8_t *bitmap = calloc(width, height_bytes);
|
||||||
if (!bitmap) return 1;
|
if (!bitmap) return 1;
|
||||||
for (char32_t c = U'\0'; c <= U'\xFF'; ++c) {
|
for (uint32_t c = U'\0'; c <= U'\xFF'; ++c) {
|
||||||
memset(bitmap, 0, width * height_bytes);
|
memset(bitmap, 0, width * height_bytes);
|
||||||
if ((error = FT_Load_Char(face, c, FT_LOAD_DEFAULT)) ||
|
if ((error = FT_Load_Char(face, c, FT_LOAD_DEFAULT)) ||
|
||||||
(error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL))) return error;
|
(error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL))) return error;
|
||||||
|
|
|
||||||
4
makefile
4
makefile
|
|
@ -2,6 +2,8 @@
|
||||||
# Makefile Options
|
# Makefile Options
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
|
||||||
|
CC = clang
|
||||||
|
|
||||||
NAME ?= TRANSFER
|
NAME ?= TRANSFER
|
||||||
ICON ?= transfer.png
|
ICON ?= transfer.png
|
||||||
DESCRIPTION ?= "Variable Transfer Program"
|
DESCRIPTION ?= "Variable Transfer Program"
|
||||||
|
|
@ -27,4 +29,4 @@ src/font.h src/font.c: font/genfont
|
||||||
@$<
|
@$<
|
||||||
|
|
||||||
font/genfont: font/genfont.c
|
font/genfont: font/genfont.c
|
||||||
@clang -O3 -flto $< `pkg-config --cflags --libs freetype2` -o $@
|
@$(CC) -O3 -flto $< `pkg-config --cflags --libs freetype2` -o $@
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue