Scale the video subtitle font with the resolution used.

master
cybersphinx 2011-05-13 15:14:19 +02:00
parent 37d5fba2bd
commit b3c2fabf16
4 changed files with 13 additions and 7 deletions

View File

@ -232,6 +232,9 @@ void WzMainWindow::resizeGL(int width, int height)
screenWidth = width; screenWidth = width;
screenHeight = height; screenHeight = height;
scaledFont.setFamily("DejaVu Sans");
scaledFont.setPixelSize(12 * height / 480);
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPushMatrix(); glPushMatrix();
@ -293,6 +296,8 @@ void WzMainWindow::setFontType(enum iV_fonts fontID)
case font_small: case font_small:
setFont(smallFont); setFont(smallFont);
break; break;
case font_scaled:
setFont(scaledFont);
default: default:
break; break;
} }

View File

@ -71,7 +71,7 @@ private:
QCursor *cursors[CURSOR_MAX]; QCursor *cursors[CURSOR_MAX];
QTimer *timer; QTimer *timer;
QTime tickCount; QTime tickCount;
QFont regularFont, boldFont, smallFont; QFont regularFont, boldFont, smallFont, scaledFont;
bool notReadyToPaint; ///< HACK Don't draw during initial show(), since some global variables apparently aren't set up. bool notReadyToPaint; ///< HACK Don't draw during initial show(), since some global variables apparently aren't set up.
static WzMainWindow *myself; static WzMainWindow *myself;

View File

@ -29,6 +29,7 @@ enum iV_fonts
font_regular, font_regular,
font_large, font_large,
font_small, font_small,
font_scaled,
}; };
extern void iV_TextInit(void); extern void iV_TextInit(void);

View File

@ -157,7 +157,7 @@ bool seq_RenderVideoToBuffer(const char* sequenceName, int seqCommand)
{ {
//start the ball rolling //start the ball rolling
iV_SetFont(font_regular); iV_SetFont(font_scaled);
iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_SetTextColour(WZCOL_TEXT_BRIGHT);
/* We do *NOT* want to use the user-choosen resolution when we /* We do *NOT* want to use the user-choosen resolution when we
@ -246,7 +246,7 @@ static bool seq_StartFullScreenVideo(const char* videoName, const char* audioNam
} }
cdAudio_Pause(); cdAudio_Pause();
iV_SetFont(font_regular); iV_SetFont(font_scaled);
iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_SetTextColour(WZCOL_TEXT_BRIGHT);
/* We do not want to enter loop_SetVideoPlaybackMode() when we are /* We do not want to enter loop_SetVideoPlaybackMode() when we are
@ -260,7 +260,7 @@ static bool seq_StartFullScreenVideo(const char* videoName, const char* audioNam
// check to see if we need to pause, and set font each time // check to see if we need to pause, and set font each time
cdAudio_Pause(); cdAudio_Pause();
loop_SetVideoPlaybackMode(); loop_SetVideoPlaybackMode();
iV_SetFont(font_regular); iV_SetFont(font_scaled);
iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_SetTextColour(WZCOL_TEXT_BRIGHT);
} }
@ -476,7 +476,7 @@ bool seq_AddTextForVideo(const char* pText, SDWORD xOffset, SDWORD yOffset, SDWO
// make sure we take xOffset into account, we don't always start at 0 // make sure we take xOffset into account, we don't always start at 0
const unsigned int BUFFER_WIDTH = pie_GetVideoBufferWidth() - xOffset; const unsigned int BUFFER_WIDTH = pie_GetVideoBufferWidth() - xOffset;
iV_SetFont(font_regular); iV_SetFont(font_scaled);
ASSERT(aSeqList[currentSeq].currentText < MAX_TEXT_OVERLAYS, "too many text lines"); ASSERT(aSeqList[currentSeq].currentText < MAX_TEXT_OVERLAYS, "too many text lines");