Back to index

tetex-bin  3.0
Defines | Typedefs | Functions | Variables
t1test.c File Reference
#include <stdlib.h>
#include "ffilest.h"

Go to the source code of this file.

Defines

#define DECIPOINTSPERINCH   722.7
#define DEFAULTRES   75
#define DEFAULTPOINTSIZE   120

Typedefs

typedef char * encoding [256]

Functions

void Display ()
int main (int argc, argv)
void Display (CharInfoRec *glyph)
 T1FillVals (FontScalablePtr vals)
int CheckFSFormat (int format, int fmask, int *bit, int *byte, int *scan, int *glyph, int *image)
char * MakeAtom (char *p)
 GetClientResolutions (int *resP)
char * Xalloc (int size)
void Xfree ()
 FontDefaultFormat ()
 FontFileRegisterRenderer ()
 GenericGetBitmaps ()
 GenericGetExtents ()
 FontParseXLFDName ()
 FontComputeInfoAccelerators ()

Variables

FontScalableRec vals
FontEntryRec entry
char * ISOLatin1 [256]

Define Documentation

#define DECIPOINTSPERINCH   722.7

Definition at line 39 of file t1test.c.

#define DEFAULTPOINTSIZE   120

Definition at line 41 of file t1test.c.

#define DEFAULTRES   75

Definition at line 40 of file t1test.c.


Typedef Documentation

typedef char* encoding[256]

Definition at line 46 of file t1test.c.


Function Documentation

int CheckFSFormat ( int  format,
int  fmask,
int bit,
int byte,
int scan,
int glyph,
int image 
)

Definition at line 489 of file t1test.c.

{
       *bit = *byte = 1;
       *glyph = *scan = *image = 1;
       return Successful;
 
}

Here is the caller graph for this function:

void Display ( CharInfoRec glyph)

Definition at line 419 of file t1test.c.

{
       int h,w;
       unsigned char *p;
       int data;
       int i;
 
       p = (unsigned char *) glyph->bits;
 
       printf("Metrics: left=%d, right=%d, w=%d, above=%d, below=%d\n",
               glyph->metrics.leftSideBearing,
               glyph->metrics.rightSideBearing,
               glyph->metrics.characterWidth,
               glyph->metrics.ascent,
               glyph->metrics.descent);
 
       for (h=glyph->metrics.ascent + glyph->metrics.descent; --h >= 0;) {
               w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing;
               while (w > 0) {
                       data = *p++;
                       for (i=0; i<8; i++) {
                               if (--w < 0)
                                       break;
                               if (data & 0x80)
                                       printf("X");
                               else
                                       printf(".");
                               data <<= 1;
                       }
               }
               printf("\n");
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 529 of file t1test.c.

{ ; }

Here is the caller graph for this function:

Definition at line 521 of file t1test.c.

{ ; }

Here is the caller graph for this function:

Definition at line 523 of file t1test.c.

{ ; }

Here is the caller graph for this function:

Definition at line 528 of file t1test.c.

{ ; }

Here is the caller graph for this function:

Definition at line 525 of file t1test.c.

{ ; }

Definition at line 526 of file t1test.c.

{ ; }

Definition at line 503 of file t1test.c.

{
       *resP = 0;
};

Here is the caller graph for this function:

int main ( int  argc,
argv   
)

Definition at line 308 of file t1test.c.

{
       int h;
       char temp[80];
       char file[80];
       char glyphcode[1];
       FontPtr fontptr;
       CharInfoRec *glyphs[1];
       int count;
       int code;
       int rc = -1;
       float efactor = 1.0, slant = 0.0;
       encoding *ev = &ISOLatin1;
 
       T1FillVals(&vals);
       Type1RegisterFontFileFunctions();
       entry.name.name = "-adobe-utopia-medium-r-normal--0-0-0-0-p-0-iso8859-1";
 
       for (;;) {
               printf("T1TEST: ");
               gets(temp);
               glyphcode[0] = '\0';
 
               switch(temp[0]) {
 
                   case 'E':
                       if (1 != sscanf(&temp[2], "%f", &efactor))
                               printf("expansion factor?\n");
                       break;
 
                   case 'S':
                       if (1 != sscanf(&temp[2], "%f", &slant))
                               printf("slant?\n");
                       break;
 
                   case 'c':
                       if (1 != sscanf(&temp[2], "%c", glyphcode))
                               printf("glyph code?\n");
                       break;
 
                   case 'x':
                       if (1 != sscanf(&temp[2], "%x", &code))
                               printf("glyph code?\n");
                       else
                               glyphcode[0] = code;
                       break;
 
                   case 'd':
                       if (1 != sscanf(&temp[2], "%d", &code))
                               printf("glyph code?\n");
                       else
                               glyphcode[0] = code;
                       break;
 
                   case 'h':
                       if (1 != sscanf(&temp[2], "%d", &h))
                               printf("height?\n");
                       vals.pixel = h;
                     vals.point = (vals.pixel * DECIPOINTSPERINCH) / vals.y;
                       rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
                            file, &vals, 0, 0, efactor, slant);
                       break;
 
                   case 'f':
                       if (1 != sscanf(&temp[2], "%s", file))
                               printf("file name?\n");
                       rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
                            file, &vals, 0, 0, efactor, slant);
                       break;
 
                   case 't':
                       if (1 != sscanf(&temp[2], "%s", file))
                               printf("file name?\n");
                       vals.pixel = 8;
                       rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
                            file, &vals, 0, 0, efactor, slant);
                       if (rc != Successful) break;
                       vals.pixel = 20;
                       rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
                            file, &vals, 0, 0, efactor, slant);
                       if (rc != Successful) break;
                       vals.pixel = 50;
                       rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
                            file, &vals, 0, 0, efactor, slant);
                       glyphcode[0] = 'A';
                       printf("From font '%s':\n", file);
                       break;
 
                   case 'q':
                       return 0;
 
                   default:
                       printf("unknown command '%c', must one of 'ESqfchdxt'\n", temp[0]);
 
               }
               if (rc == Successful) {
                      if (glyphcode[0] != '\0') {
                              (*fontptr->get_glyphs)(fontptr, 1, glyphcode, 0, &count, glyphs);
                              if (count > 0)
                                      Display(glyphs[0]);
                              else
                                      printf("Code %x not valid in this font\n", glyphcode[0]);
                      }
               }
               else
                      printf("Bad font (rc = %d, file='%s')\n", rc, file);
       }
}

Here is the call graph for this function:

char* MakeAtom ( char *  p)

Definition at line 498 of file t1test.c.

{
       return p;
}

Here is the caller graph for this function:

Definition at line 454 of file t1test.c.

{
    fsResolution *res;
    int         x_res = DEFAULTRES;
    int         y_res = DEFAULTRES;
    int         pointsize = DEFAULTPOINTSIZE;  /* decipoints */
    int         num_res;
 
    /* Must have x, y, and pixel */
    if (!vals->x || !vals->y || !vals->pixel) {
        res = (fsResolution *) GetClientResolutions(&num_res);
        if (num_res) {
            if (res->x_resolution)
                x_res = res->x_resolution;
            if (res->y_resolution)
                y_res = res->y_resolution;
            if (res->point_size)
                pointsize = res->point_size;
        }
        if (!vals->x)
            vals->x = x_res;
        if (!vals->y)
            vals->y = y_res;
        if (!vals->point) {
            if (!vals->pixel) vals->point = pointsize;
            else vals->point = (vals->pixel * DECIPOINTSPERINCH) / vals->y;
        }
        if (!vals->pixel)
            vals->pixel = (vals->point * vals->y) / DECIPOINTSPERINCH;
        /* Make sure above arithmetic is normally in range and will
           round properly. +++ */
    }
}

Here is the call graph for this function:

char* Xalloc ( int  size)

Definition at line 509 of file t1test.c.

{
       extern char *malloc();
       return(malloc(size));
}

Here is the caller graph for this function:

void Xfree ( void  )

Definition at line 516 of file t1test.c.

{
       free();
}

Here is the call graph for this function:


Variable Documentation

Definition at line 44 of file t1test.c.

char* ISOLatin1[256]

Definition at line 50 of file t1test.c.

Definition at line 43 of file t1test.c.