Mercurial > mm7
changeset 1166:11cda4934da3
font cleaning
author | Gloval |
---|---|
date | Tue, 04 Jun 2013 08:28:20 +0400 |
parents | 29a8defbad9e |
children | 15ad868d972f |
files | GUIFont.cpp |
diffstat | 1 files changed, 28 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIFont.cpp Tue Jun 04 03:21:21 2013 +0200 +++ b/GUIFont.cpp Tue Jun 04 08:28:20 2013 +0400 @@ -487,7 +487,6 @@ return 0; text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0); text_length = strlen(text_str); - //uX_pos=uX_buff_pos; for (i=0; i<text_length; ++i ) { c = text_str[i]; @@ -509,7 +508,7 @@ break; } if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) - return &text_str[i]; + break; } } return &text_str[i]; @@ -520,52 +519,40 @@ //----- (0044C62E) -------------------------------------------------------- int GUIFont::GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6) { - GUIFont *v6; // edi@1 - int v8; // esi@3 - unsigned __int8 *v9; // ebx@3 - size_t v10; // eax@3 - unsigned __int8 v11; // cl@4 - signed int Stra; // [sp+Ch] [bp+8h]@3 - size_t v13; // [sp+14h] [bp+10h]@3 + + int uAllHeght; + int uStringLen; + unsigned char c; + char *test_string; - auto a1 = this; - v6 = a1; if ( !Str ) return 0; - v8 = LOBYTE(a1->uFontHeight) - 3; - v9 = (unsigned __int8 *)GUIFont::_44C933(Str, a1, a2, a4, a5, 0); - v10 = strlen(Str); - Stra = 0; - v13 = v10; - while ( Stra < (signed int)v13 ) - { - if ( GUIFont::IsCharValid(v11 = *v9) ) - { - if ( v11 == 9 ) - goto LABEL_9; - switch ( v11 ) + uAllHeght = this->uFontHeight - 3; + test_string = GUIFont::_44C933(Str, this, a2, a4, a5, 0); + uStringLen = strlen(test_string); + for (int i = 0; i < uStringLen; ++i) { - case 0xAu: - v8 = v8 + LOBYTE(v6->uFontHeight) - 3; - break; - case 0xCu: - v9 += 5; - Stra += 5; - break; - case 0xDu: -LABEL_9: - if ( a6 != 1 ) + c = test_string[i]; + if (IsCharValid(c)) { - v9 += 3; - Stra += 3; + switch (c) + { + case '\n': //Line Feed 0A 10: + uAllHeght+= this->uFontHeight - 3; + break; + case '\f': //Form Feed, page eject 0C 12 + i += 5; + break; + case '\t': // Horizontal tab 09 + case '\r': //Carriage Return 0D 13 + if (a6 != 1) + i += 3; + break; + } } - break; } - } - ++Stra; - ++v9; - } - return v8; + + return uAllHeght; } //----- (0044C59D) --------------------------------------------------------