(2012-04-18, 18:56)CrystalP Wrote: @noeikujoo I think it would be better to attack the problem in a lower code layer to get proper font rendering.
For example add a parameter to RenderOutline() so that it does the x/y adjustments, and changes the texture coordinates so that the sub is rendered in the correct position and squished as required by the sbs/ou mode. No need to load the font differently.
Then in GUIWindowFullScreen you'd find for example and in pseudo code:
Code:
switch (g_settings.m_currentVideoSettings.m_Subtitle3DMode)
{
case 0:
RenderOutline (2D)
break
case 1:
case 2:
RenderOutline(SBS_LEFT)
RenderOutline(SBS_RIGHT)
break
case 3:
case 4:
RenderOutline(OU_TOP)
RenderOutline(OU_BOTTOM)
}
A similar approach could be used for DVD or ass subs.
Could you explain it on my code:
Code:
float x = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left;
float y = (float) g_settings.m_ResInfo[res].iSubtitles;
float x1 = maxWidth * 0.25f + g_settings.m_ResInfo[res].Overscan.left * 0.5f - g_settings.m_currentVideoSettings.m_Subtitle3DParallax * 10.0f;
float x2 = maxWidth * 0.75f + g_settings.m_ResInfo[res].Overscan.left * 0.5f + g_settings.m_currentVideoSettings.m_Subtitle3DParallax * 10.0f;
float x3 = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left - g_settings.m_currentVideoSettings.m_Subtitle3DParallax * 10.0f;
float x4 = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left + g_settings.m_currentVideoSettings.m_Subtitle3DParallax * 10.0f;
float y1 = g_settings.m_ResInfo[res].iHeight * 0.02f;
float y2 = g_settings.m_ResInfo[res].iHeight * 0.52f;
float y3 = g_settings.m_ResInfo[res].iHeight * 0.34f;
float y4 = g_settings.m_ResInfo[res].iHeight * 0.84f;
switch (g_settings.m_currentVideoSettings.m_Subtitle3DMode)
{
case 0:
if (subalign == SUBTITLE_ALIGN_MANUAL)
y = (float) g_settings.m_ResInfo[res].iSubtitles - textHeight;
else
{
CRect SrcRect, DestRect;
g_application.m_pPlayer->GetVideoRect(SrcRect, DestRect);
if ((subalign == SUBTITLE_ALIGN_TOP_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))
y = DestRect.y1;
else
y = DestRect.y2;
// use the manual distance to the screenbottom as an offset to the automatic location
if ((subalign == SUBTITLE_ALIGN_BOTTOM_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))
y -= textHeight + g_graphicsContext.GetHeight() - g_settings.m_ResInfo[res].iSubtitles;
else
y += g_graphicsContext.GetHeight() - g_settings.m_ResInfo[res].iSubtitles;
y = std::max(y, (float) g_settings.m_ResInfo[res].Overscan.top);
y = std::min(y, g_settings.m_ResInfo[res].Overscan.bottom - textHeight);
}
m_subsLayout->RenderOutline(x, y, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
break;
case 1:
m_subsLayout->RenderOutline(x1, y4, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
m_subsLayout->RenderOutline(x2, y4, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
break;
case 2:
m_subsLayout->RenderOutline(x1, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
m_subsLayout->RenderOutline(x2, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
break;
case 3:
m_subsLayout->RenderOutline(x3, y3, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
m_subsLayout->RenderOutline(x4, y4, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
break;
case 4:
m_subsLayout->RenderOutline(x3, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
m_subsLayout->RenderOutline(x4, y2, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
break;
}
I have normal font in OU and SBS (its too big). How can I squash it (width for sbs, or height for ou)? Can you add value/function on above code for example to us?