freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][master] [ftstring] Loop through a custom


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [ftstring] Loop through a custom string if present.
Date: Thu, 26 Aug 2021 21:09:02 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

1 changed file:

Changes:

  • src/ftstring.c
    ... ... @@ -30,6 +30,9 @@
    30 30
     
    
    31 31
       static const char*  Sample[] =
    
    32 32
       {
    
    33
    +    /* Custom string if any */
    
    34
    +    NULL,
    
    35
    +
    
    33 36
         "The quick brown fox jumps over the lazy dog",
    
    34 37
     
    
    35 38
         /* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */
    
    ... ... @@ -428,15 +431,14 @@
    428 431
       static void
    
    429 432
       event_text_change( void )
    
    430 433
       {
    
    431
    -    static int  i = 0;
    
    434
    +    static int  i = INT_MAX - 1;
    
    432 435
     
    
    433
    -    status.text = Sample[i];
    
    434 436
     
    
    435
    -    i++;
    
    436
    -    if ( i >= (int)( sizeof( Sample ) / sizeof( Sample[0] ) ) )
    
    437
    -      i = 0;
    
    438
    -  }
    
    437
    +    if ( ++i >= (int)( sizeof( Sample ) / sizeof( Sample[0] ) ) )
    
    438
    +      i = Sample[0] == NULL ? 1 : 0;
    
    439 439
     
    
    440
    +    status.text = Sample[i];
    
    441
    +  }
    
    440 442
     
    
    441 443
       static void
    
    442 444
       event_size_change( int  delta )
    
    ... ... @@ -732,7 +734,7 @@
    732 734
           case 'm':
    
    733 735
             if ( *argc < 3 )
    
    734 736
               usage( execname );
    
    735
    -        status.text = optarg;
    
    737
    +        Sample[0] = optarg;
    
    736 738
             break;
    
    737 739
     
    
    738 740
           case 'r':
    
    ... ... @@ -980,8 +982,7 @@
    980 982
     
    
    981 983
         status.header = NULL;
    
    982 984
     
    
    983
    -    if ( !status.text )
    
    984
    -      event_text_change();
    
    985
    +    event_text_change();
    
    985 986
     
    
    986 987
         event_color_change();
    
    987 988
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]