diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2015-02-05 21:24:45 +0100 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2015-02-05 21:24:45 +0100 |
| commit | 57958b2ae5bebdba8648f6b63a69b4a961cdd274 (patch) | |
| tree | de0e5e386bf79a0d33948ea0d69d84d0f17f4f1b | |
| parent | 32485597b7f84dddad7c1ea5537d14fc715d9bc9 (diff) | |
| download | vdr-plugin-rpihddevice-57958b2ae5bebdba8648f6b63a69b4a961cdd274.tar.gz vdr-plugin-rpihddevice-57958b2ae5bebdba8648f6b63a69b4a961cdd274.tar.bz2 | |
fixed calculation of string height (reported by Klaus Schmidinger)
| -rw-r--r-- | HISTORY | 1 | ||||
| -rw-r--r-- | ovgosd.c | 17 |
2 files changed, 15 insertions, 3 deletions
@@ -2,6 +2,7 @@ VDR Plugin 'rpihddevice' Revision History ----------------------------------------- - fixed: + - fixed calculation of string height (reported by Klaus Schmidinger) - additionally set number of in/out channels when setting up audio resampler - don't clear audio PTS when parser shrinks the packet buffer @@ -81,6 +81,11 @@ public: return index < m_escapements.size() ? m_escapements[index] : 0; } + VGfloat Height(void) + { + return m_height; + } + VGFont Font(void) { return m_font; @@ -97,7 +102,8 @@ private: cOvgFont(void) : m_font(VG_INVALID_HANDLE), - m_name("") + m_name(""), + m_height(0) { } cOvgFont(FT_Library lib, const char *name) : @@ -118,6 +124,8 @@ private: } FT_Set_Char_Size(face, 0, CHAR_HEIGHT, 0, 0); + m_height = (VGfloat)(face->size->metrics.ascender - + face->size->metrics.descender + 63) / (VGfloat)CHAR_HEIGHT; int glyphId = 0; FT_UInt glyphIndex; @@ -246,6 +254,7 @@ private: VGFont m_font; cString m_name; + VGfloat m_height; std::vector<FT_ULong> m_characters; std::vector<VGfloat> m_escapements; @@ -264,7 +273,7 @@ class cOvgString public: cOvgString(const unsigned int *symbols, cOvgFont *font) : - m_width(0.0f), m_font(font) + m_width(0.0f), m_height(font->Height()), m_font(font) { for (int i = 0; symbols[i]; i++) { @@ -279,12 +288,14 @@ public: VGFont Font(void) { return m_font->Font(); } VGint Length(void) { return m_glyphIds.size(); } VGfloat Width(void) { return m_width; } + VGfloat Height(void) { return m_height; } const VGuint *GlyphIds(void) { return &m_glyphIds[0]; } private: std::vector<VGuint> m_glyphIds; VGfloat m_width; + VGfloat m_height; cOvgFont *m_font; }; @@ -739,7 +750,7 @@ public: cOvgString *string = new cOvgString(m_symbols, font); VGfloat strWidth = string->Width() * (VGfloat)m_fontSize; - VGfloat strHeight = (VGfloat)m_fontSize; + VGfloat strHeight = string->Height() * (VGfloat)m_fontSize; VGfloat offsetX = 0; VGfloat offsetY = 0; |
