Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Admiral-Fish authored and BernardoGiordano committed Jan 14, 2018
1 parent 20ce8f4 commit 0445e96
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/pp2d/pp2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static C3D_Mtx projectionTopLeft;
static C3D_Mtx projectionTopRight;
static C3D_Mtx projectionBot;
static C3D_Tex* glyphSheets;
static float s_textScale;
static textVertex_s* textVtxArray;
static int textVtxArrayPos;
static C3D_RenderTarget* topLeft;
Expand Down Expand Up @@ -159,6 +160,9 @@ void pp2d_draw_text_wrap(float x, float y, float scaleX, float scaleY, u32 color
float firstX = x;
int lastSheet = -1;

scaleX *= s_textScale;
scaleY *= s_textScale;

do
{
if (!*p) break;
Expand Down Expand Up @@ -391,6 +395,8 @@ Result pp2d_init(void)
tex->lodParam = 0;
#endif
}
charWidthInfo_s* cwi = fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(0x3042));
s_textScale = 20.0f / (cwi->glyphWidth); // 20 is glyphWidth in J machines

textVtxArray = (textVertex_s*)linearAlloc(sizeof(textVertex_s)*TEXT_VTX_ARRAY_COUNT);
C3D_BufInfo* bufInfo = C3D_GetBufInfo();
Expand Down Expand Up @@ -442,6 +448,9 @@ static void pp2d_get_text_size_internal(float* width, float* height, float scale
float x = 0;
float firstX = x;
const uint8_t* p = (const uint8_t*)text;

scaleX *= s_textScale;
scaleY *= s_textScale;

do
{
Expand Down

0 comments on commit 0445e96

Please sign in to comment.