2017-11-16 23:03:36 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 16.11.2017
|
|
|
|
*
|
|
|
|
* Data types for the freetype font provider.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_FONT_PROVIDER_FREETYPE_H)
|
|
|
|
#define FCODER_FONT_PROVIDER_FREETYPE_H
|
|
|
|
|
|
|
|
struct Font_Slot{
|
|
|
|
b32 is_active;
|
|
|
|
Font_Settings settings;
|
|
|
|
Font_Metrics metrics;
|
|
|
|
Font_Page_Storage pages;
|
|
|
|
};
|
|
|
|
|
2017-11-19 23:00:26 +00:00
|
|
|
struct Font_Slot_Page{
|
|
|
|
Font_Slot_Page *next;
|
|
|
|
Font_Slot_Page *prev;
|
|
|
|
|
|
|
|
u64 *is_active;
|
|
|
|
Font_Settings *settings;
|
|
|
|
Font_Metrics *metrics;
|
|
|
|
Font_Page_Storage *pages;
|
|
|
|
|
|
|
|
i32 used_count;
|
|
|
|
i32 fill_count;
|
|
|
|
i32 max;
|
2017-11-20 23:31:57 +00:00
|
|
|
Face_ID first_id;
|
2017-11-19 23:00:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Font_Slot_Page_And_Index{
|
|
|
|
Font_Slot_Page *page;
|
|
|
|
i32 index;
|
|
|
|
};
|
|
|
|
|
|
|
|
// NOTE(allen): SLOT_PER_PAGE must be >= 1
|
|
|
|
global int32_t SLOT_PER_PAGE = 32;
|
|
|
|
global int32_t SLOT_SIZE = sizeof(Font_Settings) + sizeof(Font_Metrics) + sizeof(Font_Page_Storage);
|
|
|
|
global int32_t SLOT_PAGE_SIZE = sizeof(Font_Slot_Page) + ((SLOT_PER_PAGE + 63)/64)*8 + SLOT_PER_PAGE*SLOT_SIZE;
|
|
|
|
|
2017-11-16 23:03:36 +00:00
|
|
|
struct Font_Vars{
|
2017-11-19 23:00:26 +00:00
|
|
|
Font_Slot_Page slot_pages_sentinel;
|
|
|
|
i32 used_slot_count;
|
|
|
|
i32 max_slot_count;
|
2017-11-20 23:31:57 +00:00
|
|
|
Face_ID largest_font_id;
|
2017-11-17 19:22:12 +00:00
|
|
|
|
2017-11-20 00:47:55 +00:00
|
|
|
// HACK(allen): // HACK(allen): // HACK(allen):
|
|
|
|
// TODO(allen): Upgrade this to have "unlimited" resizable memory.
|
2017-11-17 19:22:12 +00:00
|
|
|
Font_Loadable_Description loadables[4096];
|
|
|
|
i32 loadable_count;
|
|
|
|
|
|
|
|
u32 pt_size;
|
|
|
|
b32 use_hinting;
|
2017-11-16 23:03:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
global Font_Vars fontvars = {0};
|
|
|
|
|
|
|
|
struct Font_Setup{
|
2017-11-17 19:22:12 +00:00
|
|
|
Font_Setup *next;
|
2017-11-16 23:03:36 +00:00
|
|
|
Font_Loadable_Stub stub;
|
2017-11-17 21:20:25 +00:00
|
|
|
|
|
|
|
b32 has_display_name;
|
|
|
|
i32 len;
|
|
|
|
char name[64];
|
2017-11-16 23:03:36 +00:00
|
|
|
};
|
|
|
|
|
2017-11-17 19:22:12 +00:00
|
|
|
struct Font_Setup_List{
|
|
|
|
Font_Setup *first;
|
|
|
|
Font_Setup *last;
|
|
|
|
};
|
|
|
|
|
|
|
|
// NOTE(allen): Procedures to be implemented per-OS for the freetype font provider.
|
2017-11-20 17:51:02 +00:00
|
|
|
struct Font_Path{
|
|
|
|
Temp_Memory temp;
|
|
|
|
char *name;
|
|
|
|
i32 len;
|
|
|
|
b32 used_base_file;
|
|
|
|
};
|
|
|
|
|
2017-11-17 19:22:12 +00:00
|
|
|
struct Font_Raw_Data{
|
|
|
|
Temp_Memory temp;
|
|
|
|
u8 *data;
|
|
|
|
i32 size;
|
2017-11-20 17:51:02 +00:00
|
|
|
b32 used_base_file;
|
2017-11-17 19:22:12 +00:00
|
|
|
};
|
|
|
|
|
2017-11-20 17:51:02 +00:00
|
|
|
enum{
|
|
|
|
SystemFontMethod_FilePath,
|
|
|
|
SystemFontMethod_RawData,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Sys_Font_Path(name, parameters) Font_Path system_font_path(char *name, Font_Parameters *parameters)
|
|
|
|
internal Sys_Font_Path(name, parameters);
|
|
|
|
|
|
|
|
#define Sys_Font_Path_Not_Used \
|
|
|
|
internal Sys_Font_Path(n,p){ \
|
|
|
|
Font_Path path = {0}; LOG("there is no font path retrieval procedure available\n"); return(path);}
|
|
|
|
|
|
|
|
#define Sys_Font_Data(name, parameters) Font_Raw_Data system_font_data(char *name, Font_Parameters *parameters)
|
|
|
|
internal Sys_Font_Data(name, parameters);
|
2017-11-17 19:22:12 +00:00
|
|
|
|
2017-11-17 20:26:29 +00:00
|
|
|
#define Sys_Font_Data_Not_Used \
|
2017-11-20 17:51:02 +00:00
|
|
|
internal Sys_Font_Data(n,p){ \
|
|
|
|
Font_Raw_Data data = {0}; LOG("there is no font data retrieval procedure available\n"); return(data);}
|
2017-11-17 19:22:12 +00:00
|
|
|
|
2017-11-16 23:03:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|