CTextBox: When using only digits to display:

- Use for calculating digit height
 font->getDigitHeight() / font->getDigitOffset()


Origin commit data
------------------
Commit: fccb07cfc9
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-04-24 (Wed, 24 Apr 2013)

Origin message was:
------------------
* CTextBox: When using only digits to display:

- Use for calculating digit height
 font->getDigitHeight() / font->getDigitOffset()
This commit is contained in:
Michael Liebmann
2013-04-24 18:26:44 +02:00
committed by Thilo Graf
parent 2025d92dbe
commit b8a04490f4
2 changed files with 24 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
//TRACE(" CTextBox::m_cText: %d, m_nMode %d\t\r\n",m_cText.size(),m_nMode);
m_textBackgroundColor = textBackgroundColor;
m_nFontTextHeight = m_pcFontText->getHeight();
m_nFontTextHeight = setFontTextHeight();
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
//TRACE(" CTextBox::m_nFontTextHeight: %d\t\r\n",m_nFontTextHeight);
@@ -150,8 +150,9 @@ void CTextBox::initVar(void)
m_cText = "";
m_nMode = SCROLL;
m_FontUseDigitHeight = false;
m_pcFontText = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1];
m_nFontTextHeight = m_pcFontText->getHeight();
m_nFontTextHeight = setFontTextHeight();
m_nMaxTextWidth = 0;
m_nNrOfPages = 1;
@@ -190,11 +191,28 @@ void CTextBox::initFramesAndTextArray()
refreshTextLineArray();
}
int CTextBox::setFontTextHeight()
{
if (m_FontUseDigitHeight)
return m_pcFontText->getDigitHeight() + (m_pcFontText->getDigitOffset() * 18) / 10;
else
return m_pcFontText->getHeight();
}
void CTextBox::setFontUseDigitHeight(bool set/*=true*/)
{
if (m_FontUseDigitHeight != set) {
m_FontUseDigitHeight = set;
m_nFontTextHeight = setFontTextHeight();
initFramesAndTextArray();
}
}
void CTextBox::setTextFont(Font* font_text)
{
if ((m_pcFontText != font_text) && (font_text != NULL)) {
m_pcFontText = font_text;
m_nFontTextHeight = m_pcFontText->getHeight();
m_nFontTextHeight = setFontTextHeight();
//Initialise the window frames first and than refresh text line array
initFramesAndTextArray();
}

View File

@@ -109,6 +109,7 @@ class CTextBox
void refreshText(void);
void reSizeMainFrameWidth(int maxTextWidth);
void reSizeMainFrameHeight(int maxTextHeight);
int setFontTextHeight();
/* Variables */
std::string m_cText;
@@ -150,6 +151,7 @@ class CTextBox
/* int max_width;*/
int text_border_width;
bool m_FontUseDigitHeight;
public:
/* Constructor */
@@ -178,6 +180,7 @@ class CTextBox
void setWindowPos(const CBox* position){m_cFrame = *position;};
void setWindowMaxDimensions(const int width, const int height);
void setWindowMinDimensions(const int width, const int height);
void setFontUseDigitHeight(bool set=true);
inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
inline CBox getWindowsPos(void) {return(m_cFrame);};