summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype/freetype-1.5/test/textdisp.c
blob: c6ac8df860f3d229728b339dfeebf22568aa6f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/****************************************************************************/
/*                                                                          */
/*  The FreeType project -- a free and portable quality TrueType renderer.  */
/*                                                                          */
/*  Copyright 1996-2001 by                                                  */
/*  D. Turner, R.Wilhelm, and W. Lemberg                                    */
/*                                                                          */
/*  textdisp.c: Text-mode display component used by some test programs.     */
/*                                                                          */
/*  This file is used to display glyphs using only text, with ' ' and '*'.  */
/*                                                                          */
/****************************************************************************/

#include <stdio.h>

#include "textdisp.h"

  void
  Show_Single_Glyph( const TT_Raster_Map*  map )
  {
    int             y;

    unsigned char*  line = map->bitmap;


    for ( y = 0; y < map->rows; y++, line += map->cols )
    {
      unsigned char*  ptr = line;
      int             x;
      unsigned char   mask = 0x80;


      for ( x = 0; x < map->width; x++ )
      {
        printf( "%c", (ptr[0] & mask) ? '*' : '.' );
        mask >>= 1;
        if ( mask == 0 )
        {
          mask = 0x80;
          ptr++;
        }
      }
      printf( "\n" );
    }
  }

/* End */