Skip to content

Commit

Permalink
Adjust font size with height/width
Browse files Browse the repository at this point in the history
Interface is still open for improvement, but the main functionality is
done regarding resizing. Closes #30.
  • Loading branch information
tiehuis committed Oct 3, 2016
1 parent 6104976 commit 4129015
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/frontend/SDL2/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ void fsiPreInit(FSPSView *v)
}
}

int calcFontSize(int width)
{
return width / 40;
}

void fsiInit(FSPSView *v)
{
SDL_RWops *rw;
Expand All @@ -49,7 +54,7 @@ void fsiInit(FSPSView *v)
}

rw = SDL_RWFromConstMem(ttfFontSpec, ttfFontSpecLen);
v->font = TTF_OpenFontRW(rw, 1, DEFAULT_FONT_SIZE);
v->font = TTF_OpenFontRW(rw, 1, calcFontSize(v->width));
if (v->font == NULL) {
fsLogFatal("TTF_OpenFontIndexRW error: %s", TTF_GetError());
TTF_Quit();
Expand Down

0 comments on commit 4129015

Please sign in to comment.