Selaa lähdekoodia

Tweak to multi font size support.

sgrenier 12 vuotta sitten
vanhempi
sitoutus
1b56e8deea

+ 1 - 1
gameplay/src/Font.cpp

@@ -476,7 +476,7 @@ Font* Font::findClosestSize(int size)
     {
         Font* f = _sizes[i];
         int d = abs(size - (int)f->_size);
-        if (d < diff)
+        if (d < diff || (d == diff && f->_size > closest->_size)) // prefer scaling down instead of up
         {
             diff = d;
             closest = f;

BIN
samples/browser/res/common/arial.gpb


+ 1 - 1
samples/browser/src/TextSample.cpp

@@ -18,7 +18,7 @@ std::string _fontNames[] =
 };
 
 TextSample::TextSample()
-    : _form(NULL), _stateBlock(NULL), _size(16), _wrap(true), _ignoreClip(false), _useViewport(true), _rightToLeft(false), _simple(false), _alignment(Font::ALIGN_LEFT),
+    : _form(NULL), _stateBlock(NULL), _size(18), _wrap(true), _ignoreClip(false), _useViewport(true), _rightToLeft(false), _simple(false), _alignment(Font::ALIGN_LEFT),
       _fontsCount(FONT_COUNT), _fontIndex(0), _font(NULL), _viewport(250, 100, 512, 200)
 {
 }