diff --git a/data/skin.xml b/data/skin.xml index 1592330..8531ca7 100755 --- a/data/skin.xml +++ b/data/skin.xml @@ -71,7 +71,7 @@ - + diff --git a/lib/dvb/teletext.cpp b/lib/dvb/teletext.cpp index 381d337..c681427 100644 --- a/lib/dvb/teletext.cpp +++ b/lib/dvb/teletext.cpp @@ -666,19 +666,26 @@ void eDVBTeletextParser::addSubtitleString(int color, std::string string) // eDebug("color %d, m_subtitle_color %d", color, m_subtitle_color); gRGB rgbcol((color & 1) ? 255 : 128, (color & 2) ? 255 : 128, (color & 4) ? 255 : 128); - if ((color != m_subtitle_color || force_cell) && !m_subtitle_text.empty() && ((color == -2) || !string.empty())) + if ((color != m_subtitle_color || force_cell) && (!m_subtitle_line1.empty() || !m_subtitle_line2.empty()) && (color == -2)) { // eDebug("add text |%s|: %d != %d || %d", m_subtitle_text.c_str(), color, m_subtitle_color, force_cell); - m_subtitle_page.m_elements.push_back(eDVBTeletextSubtitlePageElement(rgbcol, m_subtitle_text)); - m_subtitle_text = ""; - } else if (!m_subtitle_text.empty() && m_subtitle_text[m_subtitle_text.size()-1] != ' ') - m_subtitle_text += " "; + m_subtitle_page.m_elements.push_back(eDVBTeletextSubtitlePageElement(rgbcol, m_subtitle_line1, m_subtitle_line2)); + m_subtitle_line1 = ""; + m_subtitle_line2 = ""; + } if (!string.empty()) { // eDebug("set %d as new color", color); m_subtitle_color = color; - m_subtitle_text += string; + if (m_subtitle_line1.empty()) + { + m_subtitle_line1 = string; + } + else + { + m_subtitle_line2 = string; + } } } @@ -687,7 +694,7 @@ void eDVBTeletextParser::sendSubtitlePage() // eDebug("subtitle page:"); bool send=m_C & (1<<4); for (unsigned int i = 0; i < m_subtitle_page.m_elements.size(); ++i) - if (!m_subtitle_page.m_elements[i].m_text.empty()) + if (!m_subtitle_page.m_elements[i].m_line1.empty() || !m_subtitle_page.m_elements[i].m_line2.empty()) send=true; if (send) m_new_subtitle_page(m_subtitle_page); diff --git a/lib/dvb/teletext.h b/lib/dvb/teletext.h index 880fa56..e1a8ea8 100644 --- a/lib/dvb/teletext.h +++ b/lib/dvb/teletext.h @@ -11,10 +11,11 @@ struct eDVBTeletextSubtitlePageElement { gRGB m_color; - std::string m_text; + std::string m_line1; + std::string m_line2; eRect m_area; - eDVBTeletextSubtitlePageElement(const gRGB &color, const std::string &text) - : m_color(color), m_text(text) + eDVBTeletextSubtitlePageElement(const gRGB &color, const std::string &line1, const std::string &line2) + : m_color(color), m_line1(line1), m_line2(line2) { } }; @@ -57,7 +58,8 @@ private: void handleLine(unsigned char *line, int len); void handlePageEnd(int have_pts, const pts_t &pts); - std::string m_subtitle_text; + std::string m_subtitle_line1; + std::string m_subtitle_line2; int m_subtitle_color; void addSubtitleString(int color, std::string string); diff --git a/lib/gui/esubtitle.cpp b/lib/gui/esubtitle.cpp index f3d0e35..f89a9fd 100644 --- a/lib/gui/esubtitle.cpp +++ b/lib/gui/esubtitle.cpp @@ -142,6 +142,7 @@ int eSubtitleWidget::event(int event, void *data, void *data2) } else if (m_page_ok) { int elements = m_page.m_elements.size(); + bool didMove = false; painter.setFont(subtitleStyles[Subtitle_TTX].font); for (int i=0; i font; }; - static void setFontStyle(subfont_t face, gFont *font, int autoColor, const gRGB &col, const gRGB &shadowCol, const ePoint &shadowOffset); + static void setFontStyle(subfont_t face, gFont *font, int autoColor, const gRGB &col, const gRGB &shadowCol, const ePoint &shadowOffset, int lineHeight); protected: int event(int event, void *data=0, void *data2=0); diff --git a/skin.py b/skin.py index 5fcaa11..8973fe0 100644 --- a/skin.py +++ b/skin.py @@ -337,7 +337,12 @@ def loadSingleSkinData(desktop, skin, path_prefix): shadowColor = gRGB(0) shadowOffset = parsePosition(get_attr("shadowOffset"), scale) face = eSubtitleWidget.__dict__[get_attr("name")] - eSubtitleWidget.setFontStyle(face, font, haveColor, foregroundColor, shadowColor, shadowOffset) + lineHeight = get_attr("lineHeight") + if lineHeight: + lineHeight = int(lineHeight) + else: + lineHeight = 0 + eSubtitleWidget.setFontStyle(face, font, haveColor, foregroundColor, shadowColor, shadowOffset, lineHeight) for windowstyle in skin.findall("windowstyle"): style = eWindowStyleSkinned()