|
|
@ -678,6 +678,9 @@ VkResult load_font(
|
|
|
|
for(uint32_t i = 0; i < face->num_glyphs; i++) {
|
|
|
|
for(uint32_t i = 0; i < face->num_glyphs; i++) {
|
|
|
|
if(glyph_index == 0) {
|
|
|
|
if(glyph_index == 0) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
} else if(c > 255) {
|
|
|
|
|
|
|
|
c = FT_Get_Next_Char(face, c, &glyph_index);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FT_Load_Glyph(face, glyph_index, load_flags);
|
|
|
|
FT_Load_Glyph(face, glyph_index, load_flags);
|
|
|
|
uint32_t width = face->glyph->bitmap.width;
|
|
|
|
uint32_t width = face->glyph->bitmap.width;
|
|
|
@ -705,7 +708,13 @@ VkResult load_font(
|
|
|
|
FT_Load_Glyph(face, glyph_index, load_flags);
|
|
|
|
FT_Load_Glyph(face, glyph_index, load_flags);
|
|
|
|
symbols[i].width = (float)face->glyph->bitmap.width/(float)max_width;
|
|
|
|
symbols[i].width = (float)face->glyph->bitmap.width/(float)max_width;
|
|
|
|
symbols[i].height = (float)face->glyph->bitmap.rows/(float)max_height;
|
|
|
|
symbols[i].height = (float)face->glyph->bitmap.rows/(float)max_height;
|
|
|
|
symbols[i].advance = (float)face->glyph->advance.x*16.0/(float)face->units_per_EM/(float)max_width;
|
|
|
|
if(face->units_per_EM == 2048) {
|
|
|
|
|
|
|
|
symbols[i].advance[0] = (float)face->glyph->advance.x*30/(float)face->units_per_EM /(float)max_width;
|
|
|
|
|
|
|
|
symbols[i].advance[1] = (float)face->glyph->advance.y*30/(float)face->units_per_EM /(float)max_height;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
symbols[i].advance[0] = (float)face->glyph->advance.x*16/(float)face->units_per_EM /(float)max_width;
|
|
|
|
|
|
|
|
symbols[i].advance[1] = (float)face->glyph->advance.y*16/(float)face->units_per_EM /(float)max_height;
|
|
|
|
|
|
|
|
}
|
|
|
|
symbols[i].left = (float)face->glyph->bitmap_left/(float)max_width;
|
|
|
|
symbols[i].left = (float)face->glyph->bitmap_left/(float)max_width;
|
|
|
|
symbols[i].top = (float)face->glyph->bitmap_top/(float)max_height;
|
|
|
|
symbols[i].top = (float)face->glyph->bitmap_top/(float)max_height;
|
|
|
|
for(uint32_t y = 0; y < face->glyph->bitmap.rows; y++) {
|
|
|
|
for(uint32_t y = 0; y < face->glyph->bitmap.rows; y++) {
|
|
|
@ -1099,6 +1108,11 @@ VkResult create_ui_context(
|
|
|
|
context->containers = malloc(max_containers*sizeof(Container));
|
|
|
|
context->containers = malloc(max_containers*sizeof(Container));
|
|
|
|
memset(context->containers, 0, max_containers*sizeof(Container));
|
|
|
|
memset(context->containers, 0, max_containers*sizeof(Container));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(load_font(0, "fonts/eracake.ttf", 256, VK_TRUE, gpu, context));
|
|
|
|
|
|
|
|
VK_RESULT(load_font(1, "fonts/yumoda.ttf", 256, VK_TRUE, gpu, context));
|
|
|
|
|
|
|
|
VK_RESULT(load_font(2, "fonts/runescape.ttf", 16, VK_FALSE, gpu, context));
|
|
|
|
|
|
|
|
VK_RESULT(load_font(3, "fonts/apple_2.ttf", 256, VK_FALSE, gpu, context));
|
|
|
|
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|