1 //      Font demo.
2 //
3 
4 #include "plcdemos.h"
5 
6 //--------------------------------------------------------------------------
7 // main
8 //
9 // Displays the entire "plpoin" symbol (font) set.
10 //--------------------------------------------------------------------------
11 
12 int
main(int argc,char * argv[])13 main( int argc, char *argv[] )
14 {
15     char  text[10];
16     int   i, j, k, kind_font, font, maxfont;
17     PLFLT x, y;
18 
19 // Parse and process command line arguments
20 
21     (void) plparseopts( &argc, argv, PL_PARSE_FULL );
22 
23 // Initialize plplot
24 
25     plinit();
26 
27     for ( kind_font = 0; kind_font < 2; kind_font++ )
28     {
29         plfontld( kind_font );
30         if ( kind_font == 0 )
31             maxfont = 1;
32         else
33             maxfont = 4;
34 
35         for ( font = 0; font < maxfont; font++ )
36         {
37             plfont( font + 1 );
38 
39             pladv( 0 );
40 
41 // Set up viewport and window
42 
43             plcol0( 2 );
44             plvpor( 0.1, 1.0, 0.1, 0.9 );
45             plwind( 0.0, 1.0, 0.0, 1.3 );
46 
47 // Draw the grid using plbox
48 
49             plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 );
50 
51 // Write the digits below the frame
52 
53             plcol0( 15 );
54             for ( i = 0; i <= 9; i++ )
55             {
56                 sprintf( text, "%d", i );
57                 plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text );
58             }
59 
60             k = 0;
61             for ( i = 0; i <= 12; i++ )
62             {
63                 // Write the digits to the left of the frame
64 
65                 sprintf( text, "%d", 10 * i );
66                 plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text );
67                 for ( j = 0; j <= 9; j++ )
68                 {
69                     x = 0.1 * j + 0.05;
70                     y = 1.25 - 0.1 * i;
71 
72                     // Display the symbols (plpoin expects that x and y are arrays so
73                     // pass pointers)
74 
75                     if ( k < 128 )
76                         plpoin( 1, &x, &y, k );
77                     k = k + 1;
78                 }
79             }
80 
81             if ( kind_font == 0 )
82                 plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" );
83             else
84                 plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" );
85         }
86     }
87     plend();
88     exit( 0 );
89 }
90