|
|
@ -417,11 +417,6 @@ VkResult load_font(
|
|
|
|
uint32_t width = face->glyph->bitmap.width;
|
|
|
|
uint32_t width = face->glyph->bitmap.width;
|
|
|
|
uint32_t height = face->glyph->bitmap.rows;
|
|
|
|
uint32_t height = face->glyph->bitmap.rows;
|
|
|
|
tmp_charmap[i] = c;
|
|
|
|
tmp_charmap[i] = c;
|
|
|
|
symbols[i].width = width;
|
|
|
|
|
|
|
|
symbols[i].height = height;
|
|
|
|
|
|
|
|
symbols[i].left = face->glyph->bitmap_left;
|
|
|
|
|
|
|
|
symbols[i].top = face->glyph->bitmap_top;
|
|
|
|
|
|
|
|
symbols[i].advance = face->glyph->advance.x*16/face->units_per_EM;
|
|
|
|
|
|
|
|
max_width = width > max_width ? width : max_width;
|
|
|
|
max_width = width > max_width ? width : max_width;
|
|
|
|
max_height = height > max_height ? height : max_height;
|
|
|
|
max_height = height > max_height ? height : max_height;
|
|
|
|
symbol_count += 1;
|
|
|
|
symbol_count += 1;
|
|
|
@ -442,6 +437,11 @@ VkResult load_font(
|
|
|
|
for(uint32_t i = 0; i < symbol_count; i++) {
|
|
|
|
for(uint32_t i = 0; i < symbol_count; i++) {
|
|
|
|
glyph_index = FT_Get_Char_Index(face, memory->charmap[i]);
|
|
|
|
glyph_index = FT_Get_Char_Index(face, memory->charmap[i]);
|
|
|
|
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].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;
|
|
|
|
|
|
|
|
symbols[i].left = (float)face->glyph->bitmap_left/(float)max_width;
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
for(uint32_t x = 0; x < face->glyph->bitmap.width; x++) {
|
|
|
|
for(uint32_t x = 0; x < face->glyph->bitmap.width; x++) {
|
|
|
|
uint64_t level = face->glyph->bitmap.buffer[y*face->glyph->bitmap.width+x];
|
|
|
|
uint64_t level = face->glyph->bitmap.buffer[y*face->glyph->bitmap.width+x];
|
|
|
@ -564,8 +564,8 @@ VkResult load_font(
|
|
|
|
|
|
|
|
|
|
|
|
VkSamplerCreateInfo sampler_info = {
|
|
|
|
VkSamplerCreateInfo sampler_info = {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
|
|
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
|
|
|
.magFilter = VK_FILTER_NEAREST,
|
|
|
|
.magFilter = VK_FILTER_CUBIC_IMG,
|
|
|
|
.minFilter = VK_FILTER_LINEAR,
|
|
|
|
.minFilter = VK_FILTER_CUBIC_IMG,
|
|
|
|
.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
|
.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
|
.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
|
.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
|
.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
|
.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
|
|
@ -754,10 +754,8 @@ VkResult create_ui_context(
|
|
|
|
VK_RESULT(create_transfer_buffer(allocator, sizeof(UIContext), &transfer, &transfer_memory, (void**)&mapped));
|
|
|
|
VK_RESULT(create_transfer_buffer(allocator, sizeof(UIContext), &transfer, &transfer_memory, (void**)&mapped));
|
|
|
|
|
|
|
|
|
|
|
|
memory->data.font_infos = buffer_address(device, memory->font_infos);
|
|
|
|
memory->data.font_infos = buffer_address(device, memory->font_infos);
|
|
|
|
memory->data.screen[0] = swapchain_extent.width;
|
|
|
|
memory->data.scale[0] = window_scale[0] / swapchain_extent.width;
|
|
|
|
memory->data.screen[1] = swapchain_extent.height;
|
|
|
|
memory->data.scale[1] = window_scale[1] / swapchain_extent.height;
|
|
|
|
memory->data.scale[0] = window_scale[0];
|
|
|
|
|
|
|
|
memory->data.scale[1] = window_scale[1];
|
|
|
|
|
|
|
|
memcpy(mapped, &memory->data, sizeof(UIContext));
|
|
|
|
memcpy(mapped, &memory->data, sizeof(UIContext));
|
|
|
|
|
|
|
|
|
|
|
|
VkCommandBuffer command_buffer = command_begin_single(device, transfer_pool);
|
|
|
|
VkCommandBuffer command_buffer = command_begin_single(device, transfer_pool);
|
|
|
@ -835,7 +833,7 @@ VkResult set_ui_codes(
|
|
|
|
if(mapped == 0xFFFFFFFF) {
|
|
|
|
if(mapped == 0xFFFFFFFF) {
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buffer[i] = mapped;
|
|
|
|
buffer[i + offset] = mapped;
|
|
|
|
i += 1;
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|