diff options
Diffstat (limited to 'include/myfont')
-rw-r--r-- | include/myfont/cmap.h | 6 | ||||
-rw-r--r-- | include/myfont/glyf.h | 14 | ||||
-rw-r--r-- | include/myfont/head.h | 6 | ||||
-rw-r--r-- | include/myfont/hhea.h | 4 | ||||
-rw-r--r-- | include/myfont/hmtx.h | 4 | ||||
-rw-r--r-- | include/myfont/loca.h | 6 | ||||
-rw-r--r-- | include/myfont/maxp.h | 4 | ||||
-rw-r--r-- | include/myfont/myfont.h | 33 | ||||
-rw-r--r-- | include/myfont/myosi.h | 3 | ||||
-rw-r--r-- | include/myfont/name.h | 6 | ||||
-rw-r--r-- | include/myfont/os_2.h | 6 | ||||
-rw-r--r-- | include/myfont/pclt.h | 4 | ||||
-rw-r--r-- | include/myfont/vhea.h | 4 | ||||
-rw-r--r-- | include/myfont/vmtx.h | 4 |
14 files changed, 54 insertions, 50 deletions
diff --git a/include/myfont/cmap.h b/include/myfont/cmap.h index 8eae7b9..583f756 100644 --- a/include/myfont/cmap.h +++ b/include/myfont/cmap.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -208,9 +208,9 @@ typedef myfont_table_cmap_t; #include <myfont/myfont.h> -myfont_status_t myfont_load_table_cmap(myfont_font_t *mf); +mystatus_t myfont_load_table_cmap(myfont_font_t* mf, uint8_t* data, size_t data_size); -uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, myfont_status_t* status); +uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, mystatus_t* status); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/glyf.h b/include/myfont/glyf.h index 2d2e223..8c146db 100644 --- a/include/myfont/glyf.h +++ b/include/myfont/glyf.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -99,13 +99,13 @@ typedef myfont_table_glyf_t; struct myfont_font; -myfont_status_t myfont_load_table_glyf(struct myfont_font *mf); +mystatus_t myfont_load_table_glyf(myfont_font_t *mf, uint8_t* data, size_t data_size); -myfont_status_t myfont_glyf_load(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint16_t glyph_index); -myfont_status_t myfont_glyf_load_data(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint32_t offset); -myfont_status_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset); -myfont_status_t myfont_glyf_load_simple_flags(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset); -myfont_status_t myfont_glyf_load_simple_coordinates(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset); +mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint16_t glyph_index); +mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint32_t offset); +mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset); +mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset); +mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/head.h b/include/myfont/head.h index e17dc74..f24655a 100644 --- a/include/myfont/head.h +++ b/include/myfont/head.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -53,9 +53,9 @@ typedef myfont_table_head_t; struct myfont_font; -myfont_status_t myfont_load_table_head(struct myfont_font *mf); +mystatus_t myfont_load_table_head(myfont_font_t *mf, uint8_t* data, size_t data_size); -float myfont_head_yMax_pixel(struct myfont_font *mf, float font_size); +float myfont_head_yMax_pixel(myfont_font_t *mf, float font_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/hhea.h b/include/myfont/hhea.h index d0406f7..582df31 100644 --- a/include/myfont/hhea.h +++ b/include/myfont/hhea.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -54,7 +54,7 @@ typedef myfont_table_hhea_t; struct myfont_font; -myfont_status_t myfont_load_table_hhea(struct myfont_font *mf); +mystatus_t myfont_load_table_hhea(myfont_font_t *mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/hmtx.h b/include/myfont/hmtx.h index 7a2609b..bda5ae3 100644 --- a/include/myfont/hmtx.h +++ b/include/myfont/hmtx.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -45,7 +45,7 @@ typedef myfont_table_hmtx_t; struct myfont_font; -myfont_status_t myfont_load_table_hmtx(struct myfont_font *mf); +mystatus_t myfont_load_table_hmtx(myfont_font_t* mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/loca.h b/include/myfont/loca.h index 2419f52..8dd8db6 100644 --- a/include/myfont/loca.h +++ b/include/myfont/loca.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ typedef myfont_table_loca_t; struct myfont_font; -myfont_status_t myfont_load_table_loca(struct myfont_font *mf); +mystatus_t myfont_load_table_loca(myfont_font_t *mf, uint8_t* data, size_t data_size); -uint32_t myfont_loca_get_offset(struct myfont_font *mf, uint16_t glyph_index); +uint32_t myfont_loca_get_offset(myfont_font_t *mf, uint16_t glyph_index); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/maxp.h b/include/myfont/maxp.h index c078be8..d151c3c 100644 --- a/include/myfont/maxp.h +++ b/include/myfont/maxp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -51,7 +51,7 @@ typedef myfont_table_maxp_t; struct myfont_font; -myfont_status_t myfont_load_table_maxp(struct myfont_font *mf); +mystatus_t myfont_load_table_maxp(myfont_font_t *mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/myfont.h b/include/myfont/myfont.h index a51c4b8..5f1e0a2 100644 --- a/include/myfont/myfont.h +++ b/include/myfont/myfont.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,8 @@ #define MyFONT_MyFONT_H #pragma once +#include <string.h> + #include <myfont/myosi.h> #include <myfont/cmap.h> #include <myfont/head.h> @@ -36,7 +38,13 @@ #include <myfont/pclt.h> #include <myfont/loca.h> -#include <myhtml/utils/mchar_async.h> +#include <mycore/utils/mchar_async.h> + +#define MyFONT_VERSION_MAJOR 0 +#define MyFONT_VERSION_MINOR 0 +#define MyFONT_VERSION_PATCH 2 + +#define MyFONT_VERSION_STRING MyCORE_STR(MyFONT_VERSION_MAJOR) MyCORE_STR(.) MyCORE_STR(MyFONT_VERSION_MINOR) MyCORE_STR(.) MyCORE_STR(MyFONT_VERSION_PATCH) #ifdef __cplusplus extern "C" { @@ -83,16 +91,12 @@ struct myfont_font { myfont_table_pclt_t table_pclt; myfont_table_loca_t table_loca; - char* file_path; - size_t file_size; - uint8_t* file_data; - mchar_async_t* mchar; size_t mchar_node_id; }; myfont_font_t * myfont_create(void); -myfont_status_t myfont_init(myfont_font_t *mf); +mystatus_t myfont_init(myfont_font_t *mf); void myfont_clean(myfont_font_t *mf); myfont_font_t * myfont_destroy(myfont_font_t *mf, bool self_destroy); @@ -100,10 +104,11 @@ void * myfont_malloc(myfont_font_t* mf, size_t size); void * myfont_calloc(myfont_font_t* mf, size_t count, size_t size); void myfont_free(myfont_font_t *mf, void* data); -myfont_status_t myfont_load(myfont_font_t *mf, const char *filepath); +mystatus_t myfont_load(myfont_font_t* mf, uint8_t* data, size_t data_size); +mystatus_t myfont_load_from_file(myfont_font_t* mf, const char* filepath, uint8_t** return_data, size_t* data_size); +void * myfont_destroy_font_data(myfont_font_t* mf, uint8_t* return_data); -void myfont_font_print_exists_table(myfont_font_t *mf, FILE *file); -myfont_status_t myfont_check_required_tables(myfont_font_t *mf); +mystatus_t myfont_check_required_tables(myfont_font_t *mf); float myfont_metrics_baseline(myfont_font_t *mf, float font_size); float myfont_metrics_ascender(myfont_font_t *mf, float font_size); @@ -113,11 +118,11 @@ float myfont_metrics_x_height(myfont_font_t *mf, float font_size); float myfont_metrics_cap_height(myfont_font_t *mf, float font_size); float myfont_metrics_font_height(myfont_font_t *mf, float font_size); -float myfont_metrics_width(myfont_font_t *mf, unsigned long codepoint, float font_size, myfont_status_t* status); -float myfont_metrics_height(myfont_font_t *mf, unsigned long codepoint, float font_size, myfont_status_t* status); -float myfont_metrics_glyph_offset_y(myfont_font_t *mf, unsigned long codepoint, float font_size, myfont_status_t* status); +float myfont_metrics_width(myfont_font_t *mf, unsigned long codepoint, float font_size, mystatus_t* status); +float myfont_metrics_height(myfont_font_t *mf, unsigned long codepoint, float font_size, mystatus_t* status); +float myfont_metrics_glyph_offset_y(myfont_font_t *mf, unsigned long codepoint, float font_size, mystatus_t* status); -myfont_status_t myfont_load_table(myfont_font_t *mf, void *table, size_t size, enum myfont_table_key tkey); +mystatus_t myfont_load_table(myfont_font_t *mf, void *table, size_t size, enum myfont_table_key tkey); int16_t myfont_table_version_major(uint32_t version); int16_t myfont_table_version_minor(uint32_t version); diff --git a/include/myfont/myosi.h b/include/myfont/myosi.h index 410f1f2..caecfc4 100644 --- a/include/myfont/myosi.h +++ b/include/myfont/myosi.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -85,7 +85,6 @@ extern "C" { // base /* Very important!!! - see modest/myosi.h:modest_status_t */ enum myfont_status { MyFONT_STATUS_OK = 0x000000, diff --git a/include/myfont/name.h b/include/myfont/name.h index e3a7010..153f596 100644 --- a/include/myfont/name.h +++ b/include/myfont/name.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -60,8 +60,8 @@ typedef myfont_table_name_t; struct myfont_font; -myfont_status_t myfont_load_table_name(struct myfont_font *mf); - +mystatus_t myfont_load_table_name(myfont_font_t *mf, uint8_t* data, size_t data_size); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/include/myfont/os_2.h b/include/myfont/os_2.h index f7462cc..52468a3 100644 --- a/include/myfont/os_2.h +++ b/include/myfont/os_2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -90,9 +90,9 @@ typedef myfont_table_os_2_t; struct myfont_font; -myfont_status_t myfont_load_table_os_2(struct myfont_font *mf); +mystatus_t myfont_load_table_os_2(myfont_font_t* mf, uint8_t* data, size_t data_size); -int8_t myfont_os_2_panose(struct myfont_font *mf, myfont_table_os_2_panose_t id); +int8_t myfont_os_2_panose(myfont_font_t* mf, myfont_table_os_2_panose_t id); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/pclt.h b/include/myfont/pclt.h index 9ea8343..c37fd8c 100644 --- a/include/myfont/pclt.h +++ b/include/myfont/pclt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -52,7 +52,7 @@ typedef myfont_table_pclt_t; struct myfont_font; -myfont_status_t myfont_load_table_pclt(struct myfont_font *mf); +mystatus_t myfont_load_table_pclt(myfont_font_t* mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/vhea.h b/include/myfont/vhea.h index 0735be1..e2a1faf 100644 --- a/include/myfont/vhea.h +++ b/include/myfont/vhea.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -54,7 +54,7 @@ typedef myfont_table_vhea_t; struct myfont_font; -myfont_status_t myfont_load_table_vhea(struct myfont_font *mf); +mystatus_t myfont_load_table_vhea(myfont_font_t* mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/myfont/vmtx.h b/include/myfont/vmtx.h index 2d8cbe5..bd4645d 100644 --- a/include/myfont/vmtx.h +++ b/include/myfont/vmtx.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Alexander Borisov + Copyright (C) 2016-2017 Alexander Borisov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -45,7 +45,7 @@ typedef myfont_table_vmtx_t; struct myfont_font; -myfont_status_t myfont_load_table_vmtx(struct myfont_font *mf); +mystatus_t myfont_load_table_vmtx(myfont_font_t* mf, uint8_t* data, size_t data_size); #ifdef __cplusplus } /* extern "C" */ |