home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / FTREE0.3.LHA / ftree / src / RCS / test_afm.c,v < prev   
Encoding:
Text File  |  1994-04-27  |  2.2 KB  |  134 lines

  1. head    1.2;
  2. access;
  3. symbols;
  4. locks; strict;
  5. comment    @ * @;
  6.  
  7.  
  8. 1.2
  9. date    94.04.27.11.37.54;    author peteric;    state Exp;
  10. branches;
  11. next    1.1;
  12.  
  13. 1.1
  14. date    94.03.26.11.34.52;    author peteric;    state Exp;
  15. branches;
  16. next    ;
  17.  
  18.  
  19. desc
  20. @test program for AFM.c
  21. @
  22.  
  23.  
  24. 1.2
  25. log
  26. @minor changes to font handling to match afm.c.
  27. @
  28. text
  29. @/* test routine for afm code */
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include "ftree.h"
  34.  
  35. char *psfontpath;
  36. int main(int argc, char *argv[])
  37. {
  38.     int i;
  39.     char *font = NULL;
  40.     char *s1, *s2, *s3, *s4, *s5, *s6;
  41.     fontinfo_t fi;
  42.  
  43.     psfontpath = "";
  44.     
  45.     s1 = "abcdefghijklmnopqrstuvwxyz";
  46.     s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  47.     s3 = "VAflffij";
  48.     s4 = "1234567890 !@@#$%^&*()_+-=";
  49.     s5 = "The Rain in Spain falls Mainly on the Plain";
  50.     s6 = "The Quick Brown Fox Jumped over the Lazy Dog";
  51.  
  52.     for(i = 1; i < argc; i++)
  53.     {
  54.         font = argv[i];
  55.         fi.font = font;
  56.         fi.size = 16;
  57.         fi.linespc = 17;
  58.         
  59.         printf("loading %s...\n", fi.font);
  60.         if (loadfont(&fi))
  61.         {
  62.             printf("%s:\n", font);
  63.             printf("%s width %f\n", s1, stringwidth(&fi, 0.0, s1));
  64.             printf("%s width %f\n", s2, stringwidth(&fi, 0.0, s2));
  65.             printf("%s width %f\n", s3, stringwidth(&fi, 0.0, s3));
  66.             printf("%s width %f\n", s4, stringwidth(&fi, 0.0, s4));
  67.             printf("%s width %f\n", s5, stringwidth(&fi, 0.0, s5));
  68.             printf("%s width %f\n", s6, stringwidth(&fi, 0.0, s6));
  69.         }
  70.     }
  71. }
  72.  
  73. /*(
  74.  ************************************************************* 
  75.  *
  76.  *    Function:    _dprintf
  77.  *
  78.  *
  79.  *    Inputs:
  80.  *        str - printf() style format string
  81.  *        ... - args as required by str
  82.  *
  83.  *    Outputs:
  84.  *        none.
  85.  *
  86.  *    Error Handling:
  87.  *        none.
  88.  *
  89.  *    Description:
  90.  *        
  91.  *        if debug mode is active, prints out the
  92.  * string as fprintf(stderr, str) would. If not active,
  93.  * does nothing.
  94.  *
  95.  ************************************************************* 
  96. )*/
  97. #include <stdarg.h>
  98. #ifdef amiga
  99. #define DEBUGFILE "ram:debug.afmtst"
  100. #else
  101. #define DEBUGFILE "debug.afmtst"
  102. #endif
  103.  
  104. static FILE *debugfile = 0;
  105.  
  106. void _dprintf(char *str, ...)
  107. {
  108.     va_list ap;
  109.  
  110.     va_start(ap, str);
  111.     if (debugfile == 0)
  112.         debugfile = fopen(DEBUGFILE, "w");
  113.     
  114.     vfprintf(debugfile, str, ap);
  115.     fflush(debugfile);
  116.     va_end(ap);
  117. }
  118.  
  119. @
  120.  
  121.  
  122. 1.1
  123. log
  124. @Initial revision
  125. @
  126. text
  127. @d7 1
  128. d14 2
  129. d32 1
  130. a32 1
  131.         if (loadfont(font))
  132. d43 46
  133. @
  134.