Project "Tuxbox-GIT: apps": The branch, master has been updated via 9f02607d0beb28e38ab4609f7bdfadad70eeb016 (commit) from ac59ccffb18ee5065dc215d32042ce5f8da7cb46 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9f02607d0beb28e38ab4609f7bdfadad70eeb016 Author: martii <m4r...@gmx.de> Date: Wed May 27 19:22:36 2015 +0200 remove widest_number definition and usage, add Font::getMaxDigitWidth() method instead Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/src/driver/fontrenderer.cpp b/tuxbox/neutrino/src/driver/fontrenderer.cpp index 459f1c1..2ff0468 100644 --- a/tuxbox/neutrino/src/driver/fontrenderer.cpp +++ b/tuxbox/neutrino/src/driver/fontrenderer.cpp @@ -221,6 +221,8 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const font.height = isize; font.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; + maxdigitwidth = 0; + scaler.face_id = font.face_id; scaler.width = isize * 64; scaler.height = isize * 64; @@ -283,6 +285,21 @@ int Font::getHeight(void) return height; } +int Font::getMaxDigitWidth(void) +{ + if (maxdigitwidth < 1) { + char b[2]; + b[1] = 0; + for (char c = '0'; c <= '9'; c++) { + *b = c; + int w = getRenderWidth(b); + if (w > maxdigitwidth) + maxdigitwidth = w; + } + } + return maxdigitwidth; +} + int UTF8ToUnicode(const char * &text, const bool utf8_encoded) // returns -1 on error { int unicode_value; diff --git a/tuxbox/neutrino/src/driver/fontrenderer.h b/tuxbox/neutrino/src/driver/fontrenderer.h index 5239a50..3a0a013 100644 --- a/tuxbox/neutrino/src/driver/fontrenderer.h +++ b/tuxbox/neutrino/src/driver/fontrenderer.h @@ -52,6 +52,7 @@ class Font // these are HACKED values, because the font metrics were unusable. int height,ascender,descender,upper,lower; int fontwidth; + int maxdigitwidth; public: enum fontmodifier @@ -67,6 +68,7 @@ class Font int getRenderWidth(const char * text, const bool utf8_encoded = false); int getRenderWidth(const std::string & text, const bool utf8_encoded = false); int getHeight(void); + int getMaxDigitWidth(void); int getSize(){return font.width;} int setSize(int isize); diff --git a/tuxbox/neutrino/src/gui/channellist.cpp b/tuxbox/neutrino/src/gui/channellist.cpp index b0b03fe..411c38e 100644 --- a/tuxbox/neutrino/src/gui/channellist.cpp +++ b/tuxbox/neutrino/src/gui/channellist.cpp @@ -785,7 +785,7 @@ int CChannelList::numericZap(neutrino_msg_t key) int ox=300; int oy=200; - int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number) + 14; + int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getMaxDigitWidth() + 14; int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6; char valstr[10]; int chn = CRCInput::getNumericValue(key); diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp index 5227eef..31e43c1 100644 --- a/tuxbox/neutrino/src/gui/infoviewer.cpp +++ b/tuxbox/neutrino/src/gui/infoviewer.cpp @@ -126,7 +126,7 @@ void CInfoViewer::start() 2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 25; - ChanWidth = 4* g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(widest_number) + 10; + ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getMaxDigitWidth() + 10; ChanHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getHeight()*9/8; ProgressBarHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() - 4; @@ -134,7 +134,7 @@ void CInfoViewer::start() aspectRatio = g_Controld->getAspectRatio(); time_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight()+5; - time_left_width = 2* g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number); + time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getMaxDigitWidth(); time_dot_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":"); time_width = time_left_width* 2+ time_dot_width; diff --git a/tuxbox/neutrino/src/neutrino.h b/tuxbox/neutrino/src/neutrino.h index fba89c7..2ad7a1d 100644 --- a/tuxbox/neutrino/src/neutrino.h +++ b/tuxbox/neutrino/src/neutrino.h @@ -50,7 +50,6 @@ #include <string> -#define widest_number "2" #define ANNOUNCETIME (1 * 60) #define PLUGINDIR_VAR "/var/tuxbox/plugins" ----------------------------------------------------------------------- Summary of changes: tuxbox/neutrino/src/driver/fontrenderer.cpp | 17 +++++++++++++++++ tuxbox/neutrino/src/driver/fontrenderer.h | 2 ++ tuxbox/neutrino/src/gui/channellist.cpp | 2 +- tuxbox/neutrino/src/gui/infoviewer.cpp | 4 ++-- tuxbox/neutrino/src/neutrino.h | 1 - 5 files changed, 22 insertions(+), 4 deletions(-) -- Tuxbox-GIT: apps ------------------------------------------------------------------------------ _______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits