From 83e80ccd68fde23677c74f5dd1e7707111ac41a9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 10 Dec 2013 10:42:55 +0100 Subject: [PATCH] CComponentsFrmClock: fix calculate minimal separator width It's nevertheless necessary to use more than one space char. Some "exotic" font types can make issues with its size handling. We use char size of some possible chars to get minimal separator size. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/467515fd70e02a520780b93e388adb1874f4cd56 Author: Thilo Graf Date: 2013-12-10 (Tue, 10 Dec 2013) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_clock.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 9b960aae7..af884de5d 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -152,9 +152,11 @@ void CComponentsFrmClock::initCCLockItems() } } - //calculate minimal separator width, we use a space char...should be enough + //calculate minimal separator width, we use char size of some possible chars int minSepWidth = 0; - minSepWidth = max((*getClockFont())->getRenderWidth("\x20", true), minSepWidth); + string sep[] ={" ", ".", ":"}; + for (size_t i = 0; i < sizeof(sep)/sizeof(sep[0]); i++) + minSepWidth = max((*getClockFont())->getRenderWidth(sep[i], true), minSepWidth); //modify available label items with current segment chars for (size_t i = 0; i < v_cc_items.size(); i++)