From fc67757066dffc774025950a54505353e7e37fb3 Mon Sep 17 00:00:00 2001 From: fincs Date: Tue, 7 Nov 2017 23:06:20 +0100 Subject: [PATCH] fontCalcGlyphPos: Correct vertical texture coordinates --- libctru/source/font.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libctru/source/font.c b/libctru/source/font.c index e7d3f55..29d9e35 100644 --- a/libctru/source/font.c +++ b/libctru/source/font.c @@ -99,13 +99,13 @@ void fontCalcGlyphPos(fontGlyphPos_s* out, int glyphIndex, u32 flags, float scal int rowId = glInSheet % tglp->nRows; float tx = (float)(rowId*(tglp->cellWidth+1)+1) / tglp->sheetWidth; - float ty = 1.0f - (float)((lineId+1)*(tglp->cellHeight+1)+1) / tglp->sheetHeight; + float ty = 1.0f - (float)(lineId*(tglp->cellHeight+1)+1) / tglp->sheetHeight; float tw = (float)cwi->glyphWidth / tglp->sheetWidth; float th = (float)tglp->cellHeight / tglp->sheetHeight; out->texcoord.left = tx; - out->texcoord.top = ty+th; + out->texcoord.top = ty; out->texcoord.right = tx+tw; - out->texcoord.bottom = ty; + out->texcoord.bottom = ty-th; if (flags & GLYPH_POS_CALC_VTXCOORD) {