aboutsummaryrefslogtreecommitdiffstats
path: root/libskrift_open_font_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libskrift_open_font_file.c')
-rw-r--r--libskrift_open_font_file.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libskrift_open_font_file.c b/libskrift_open_font_file.c
new file mode 100644
index 0000000..2a122ef
--- /dev/null
+++ b/libskrift_open_font_file.c
@@ -0,0 +1,18 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+int
+libskrift_open_font_file(LIBSKRIFT_FONT **fontp, const char *path)
+{
+ *fontp = calloc(1, sizeof(**fontp));
+ if (!*fontp)
+ return -1;
+ (*fontp)->refcount = 1;
+ (*fontp)->font = sft_loadfile(path);
+ if (!(*fontp)->font) {
+ free(*fontp);
+ *fontp = NULL;
+ return -1;
+ }
+ return 0;
+}