From 645a6f6c4077f42dbd49f0c0ac2703896e59485d Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 17 Nov 2017 18:05:58 -0500 Subject: [PATCH] Finished the mac font setup --- platform_mac/mac_4ed.cpp | 30 ++++++++++++++++++++++++++++++ platform_mac/mac_4ed.m | 1 + 2 files changed, 31 insertions(+) diff --git a/platform_mac/mac_4ed.cpp b/platform_mac/mac_4ed.cpp index c90d9370..434314ac 100644 --- a/platform_mac/mac_4ed.cpp +++ b/platform_mac/mac_4ed.cpp @@ -341,8 +341,38 @@ internal void osx_get_loadable_fonts(Partition *part, Font_Setup_List *list){ OSX_Loadable_Fonts fonts = osx_list_loadable_fonts(); for (i32 i = 0; i < fonts.count; ++i){ + char *name = fonts.names[i]; + char *path = fonts.paths[i]; + Temp_Memory reset= begin_temp_memory(part); + Font_Setup *setup = push_array(part, Font_Setup, 1); + + if (setup != 0){ + memset(setup, 0, sizeof(*setup)); + + i32 len = str_size(path); + if (len < sizeof(setup->stub.name)){ + i32 name_len = str_size(name); + if (name_len < sizeof(setup->name)){ + setup->stub.load_from_path = true; + memcpy(setup->stub.name, path, len + 1); + setup->stub.len = len; + setup->has_display_name = true; + setup->len = name_len; + memcpy(setup->name, name, name_len + 1); + sll_push(list->first, list->last, setup); + } + else{ + end_temp_memory(reset); + } + } + else{ + end_temp_memory(reset); + } + } } + + free(fonts.names); } #include diff --git a/platform_mac/mac_4ed.m b/platform_mac/mac_4ed.m index 37c55cca..ed7a1ae8 100644 --- a/platform_mac/mac_4ed.m +++ b/platform_mac/mac_4ed.m @@ -773,6 +773,7 @@ osx_list_loadable_fonts(void){ fprintf(stdout, "found: %s\nat: %s\n", name, path); fflush(stdout); } + return(result); }