99#include < algorithm>
1010#include < iostream>
1111#include < map>
12+ #include < numeric>
1213#include < sstream>
1314#include < string>
1415#include < utility>
@@ -178,7 +179,8 @@ namespace fcn
178179 std::ostringstream os;
179180 os << " Image " << mFilename << " is corrupt or uses wrong separator.\n "
180181 << " Expected: " << expected << " glyphs, Found: " << found.size () << " \n "
181- << " Detected separator: R:" << (int )sep.r << " G:" << (int )sep.g << " B:" << (int )sep.b << " \n "
182+ << " Detected separator: R:" << static_cast <int >(sep.r ) << " G:" << static_cast <int >(sep.g )
183+ << " B:" << static_cast <int >(sep.b ) << " \n "
182184 << " Suggestion: Use ExplicitColor strategy with magenta (255,0,255)" ;
183185 throwException (os.str ());
184186 }
@@ -189,19 +191,19 @@ namespace fcn
189191
190192 if (config.verbose ) {
191193 std::cerr << " [ImageFont] Loaded '" << mFilename << " ' ExpectedGlyphs=" << expected
192- << " Found=" << found.size () << " Separator=R:" << ( int ) sep.r << " G: " << ( int )sep. g
193- << " B :" << ( int ) sep.b << " \n " ;
194+ << " Found=" << found.size () << " Separator=R:" << static_cast < int >( sep.r )
195+ << " G :" << static_cast < int >(sep. g ) << " B: " << static_cast < int >( sep.b ) << " \n " ;
194196 for (size_t i = 0 ; i < glyphs.size (); ++i) {
195197 unsigned char const c = static_cast <unsigned char >(glyphs[i]);
196198 Rectangle const & r = mGlyph [c];
197- std::cerr << " glyph '" << glyphs[i] << " ' (" << ( int )c << " ) -> x=" << r.x << " y= " << r. y
198- << " w=" << r.width << " h=" << r.height << " \n " ;
199+ std::cerr << " glyph '" << glyphs[i] << " ' (" << static_cast < int >(c) << " ) -> x=" << r.x
200+ << " y= " << r. y << " w=" << r.width << " h=" << r.height << " \n " ;
199201 }
200202 }
201203
202- mHeight = 0 ;
203- for ( auto const & r : found)
204- mHeight = std::max ( mHeight , r. height );
204+ mHeight = std::accumulate (found. begin (), found. end (), 0 , []( int maxHeight, auto const & r) {
205+ return std::max (maxHeight, r. height );
206+ } );
205207
206208 mImage ->convertToDisplayFormat ();
207209 mRowSpacing = 0 ;
@@ -320,7 +322,8 @@ namespace fcn
320322 std::ostringstream os;
321323 os << " Image " << mFilename << " is corrupt or uses wrong separator.\n "
322324 << " Expected: " << expected << " glyphs, Found: " << found.size () << " \n "
323- << " Detected separator: R:" << (int )sep.r << " G:" << (int )sep.g << " B:" << (int )sep.b << " \n "
325+ << " Detected separator: R:" << static_cast <int >(sep.r ) << " G:" << static_cast <int >(sep.g )
326+ << " B:" << static_cast <int >(sep.b ) << " \n "
324327 << " Suggestion: Use ExplicitColor strategy with magenta (255,0,255)" ;
325328 throwException (os.str ());
326329 }
@@ -329,9 +332,9 @@ namespace fcn
329332 mGlyph [static_cast <unsigned char >(glyphs[i])] = found[i];
330333 }
331334
332- mHeight = 0 ;
333- for ( auto const & r : found)
334- mHeight = std::max ( mHeight , r. height );
335+ mHeight = std::accumulate (found. begin (), found. end (), 0 , []( int maxHeight, auto const & r) {
336+ return std::max (maxHeight, r. height );
337+ } );
335338
336339 mImage ->convertToDisplayFormat ();
337340 mRowSpacing = 0 ;
@@ -399,7 +402,8 @@ namespace fcn
399402 std::ostringstream os;
400403 os << " Image " << mFilename << " is corrupt or uses wrong separator.\n "
401404 << " Expected: " << expected << " glyphs, Found: " << found.size () << " \n "
402- << " Detected separator: R:" << (int )sep.r << " G:" << (int )sep.g << " B:" << (int )sep.b << " \n "
405+ << " Detected separator: R:" << static_cast <int >(sep.r ) << " G:" << static_cast <int >(sep.g )
406+ << " B:" << static_cast <int >(sep.b ) << " \n "
403407 << " Suggestion: Use ExplicitColor strategy with magenta (255,0,255)" ;
404408 throwException (os.str ());
405409 }
0 commit comments