1
0
forked from 0ad/0ad

Variable fonts in the GUI

This was SVN commit r858.
This commit is contained in:
Ykkrosh 2004-07-31 13:37:35 +00:00
parent fe061f4f11
commit 520ff37f70
2 changed files with 7 additions and 4 deletions

View File

@ -44,11 +44,14 @@ void CButton::SetupText()
assert(m_GeneratedTexts.size()>=1);
CStr font;
if (GUI<CStr>::GetSetting(this, "font", font) != PS_OK || font.Length()==0)
// Use the default if none is specified
font = "palatino12";
CGUIString caption;
GUI<CGUIString>::GetSetting(this, "caption", caption);
//*m_GeneratedTexts[0] = GetGUI()->GenerateText(caption, CStr("palatino12"), 0, 0);
*m_GeneratedTexts[0] = GetGUI()->GenerateText(caption, CStr("palatino12"), m_CachedActualSize.GetWidth(), 0);
*m_GeneratedTexts[0] = GetGUI()->GenerateText(caption, font, m_CachedActualSize.GetWidth(), 0);
// Set position of text
//m_TextPos = m_CachedActualSize.CenterPoint() - m_GeneratedTexts[0]->m_Size/2;

View File

@ -692,7 +692,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */
union_from = max(y, it->m_YFrom);
union_to = min(y+prelim_line_height, it->m_YTo);
// The union is not ø
// The union is not empty
if (union_to > union_from)
{
if (j == From)
@ -761,7 +761,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */
vector<SGUIText::STextCall>::iterator it;
for (it = Feedback2.m_TextCalls.begin(); it != Feedback2.m_TextCalls.end(); ++it)
{
it->m_Pos = CPos(x + x_pointer, y + line_height - it->m_Size.cy);
it->m_Pos = CPos(x + x_pointer, y);
x_pointer += it->m_Size.cx;