Inverted text rendering so baseline is origin

main
noah metz 2024-10-17 09:04:35 -06:00
parent 2a99c7be99
commit 2ea9818fb0
2 changed files with 2 additions and 2 deletions

@ -57,7 +57,7 @@ void main() {
float fragU = inVertexPosition.x * symbol.width/font.width;
float fragV = inVertexPosition.y * symbol.height/font.height;
float x = (inVertexPosition.x * symbol.width + symbol.left) * character.size / font.width;
float y = (inVertexPosition.y * symbol.height + symbol.top) * character.size / font.height;
float y = (inVertexPosition.y * symbol.height - symbol.top) * character.size / font.height;
fragUV = vec2(fragU, fragV);
fragColor = character.color;

@ -496,7 +496,7 @@ VkResult load_font(VkDevice device, VmaAllocator allocator, VkDescriptorSetLayou
symbols[i].width = width;
symbols[i].height = height;
symbols[i].left = face->glyph->bitmap_left;
symbols[i].top = ((face->bbox.yMax*size)/face->units_per_EM) - face->glyph->bitmap_top;
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_height = height > max_height ? height : max_height;