comparison GUIFont.cpp @ 1166:11cda4934da3

font cleaning
author Gloval
date Tue, 04 Jun 2013 08:28:20 +0400
parents 29a8defbad9e
children 8b3e7d5ba069
comparison
equal deleted inserted replaced
1165:29a8defbad9e 1166:11cda4934da3
485 485
486 if ( !pInString ) 486 if ( !pInString )
487 return 0; 487 return 0;
488 text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0); 488 text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0);
489 text_length = strlen(text_str); 489 text_length = strlen(text_str);
490 //uX_pos=uX_buff_pos;
491 for (i=0; i<text_length; ++i ) 490 for (i=0; i<text_length; ++i )
492 { 491 {
493 c = text_str[i]; 492 c = text_str[i];
494 if ( IsCharValid(c) ) 493 if ( IsCharValid(c) )
495 { 494 {
507 case '\r': //Carriage Return 0D 13 506 case '\r': //Carriage Return 0D 13
508 i += 3; 507 i += 3;
509 break; 508 break;
510 } 509 }
511 if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) 510 if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) )
512 return &text_str[i]; 511 break;
513 } 512 }
514 } 513 }
515 return &text_str[i]; 514 return &text_str[i];
516 } 515 }
517 516
518 517
519 518
520 //----- (0044C62E) -------------------------------------------------------- 519 //----- (0044C62E) --------------------------------------------------------
521 int GUIFont::GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6) 520 int GUIFont::GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6)
522 { 521 {
523 GUIFont *v6; // edi@1 522
524 int v8; // esi@3 523 int uAllHeght;
525 unsigned __int8 *v9; // ebx@3 524 int uStringLen;
526 size_t v10; // eax@3 525 unsigned char c;
527 unsigned __int8 v11; // cl@4 526 char *test_string;
528 signed int Stra; // [sp+Ch] [bp+8h]@3 527
529 size_t v13; // [sp+14h] [bp+10h]@3
530
531 auto a1 = this;
532 v6 = a1;
533 if ( !Str ) 528 if ( !Str )
534 return 0; 529 return 0;
535 v8 = LOBYTE(a1->uFontHeight) - 3; 530 uAllHeght = this->uFontHeight - 3;
536 v9 = (unsigned __int8 *)GUIFont::_44C933(Str, a1, a2, a4, a5, 0); 531 test_string = GUIFont::_44C933(Str, this, a2, a4, a5, 0);
537 v10 = strlen(Str); 532 uStringLen = strlen(test_string);
538 Stra = 0; 533 for (int i = 0; i < uStringLen; ++i)
539 v13 = v10;
540 while ( Stra < (signed int)v13 )
541 {
542 if ( GUIFont::IsCharValid(v11 = *v9) )
543 {
544 if ( v11 == 9 )
545 goto LABEL_9;
546 switch ( v11 )
547 { 534 {
548 case 0xAu: 535 c = test_string[i];
549 v8 = v8 + LOBYTE(v6->uFontHeight) - 3; 536 if (IsCharValid(c))
550 break;
551 case 0xCu:
552 v9 += 5;
553 Stra += 5;
554 break;
555 case 0xDu:
556 LABEL_9:
557 if ( a6 != 1 )
558 { 537 {
559 v9 += 3; 538 switch (c)
560 Stra += 3; 539 {
540 case '\n': //Line Feed 0A 10:
541 uAllHeght+= this->uFontHeight - 3;
542 break;
543 case '\f': //Form Feed, page eject 0C 12
544 i += 5;
545 break;
546 case '\t': // Horizontal tab 09
547 case '\r': //Carriage Return 0D 13
548 if (a6 != 1)
549 i += 3;
550 break;
551 }
561 } 552 }
562 break;
563 } 553 }
564 } 554
565 ++Stra; 555 return uAllHeght;
566 ++v9;
567 }
568 return v8;
569 } 556 }
570 557
571 //----- (0044C59D) -------------------------------------------------------- 558 //----- (0044C59D) --------------------------------------------------------
572 int GUIFont::CalcTextHeight( const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5 ) 559 int GUIFont::CalcTextHeight( const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5 )
573 { 560 {