IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:49:06 PM (11 years ago)
Author:
eugene
Message:

extensive work on relphot, relastro, uniphot, dvomerge aiming to the construction and calibration of PV3

Location:
trunk/Ohana
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libkapa/rotfont

    • Property svn:ignore
      •  

        old new  
        11fixfont
         2fontsize.ps
         3courier.12.psx
         4courier.14.psx
         5courier.18.psx
         6courier.24.psx
         7courier.8.psx
         8helvetica.12.psx
         9helvetica.14.psx
         10helvetica.18.psx
         11helvetica.24.psx
         12helvetica.8.psx
         13symbol.12.psx
         14symbol.14.psx
         15symbol.18.psx
         16symbol.24.psx
         17symbol.8.psx
         18times.12.psx
         19times.14.psx
         20times.18.psx
         21times.24.psx
         22times.8.psx
         23courier12.h
         24courier14.h
         25courier18.h
         26courier24.h
         27courier8.h
         28helvetica12.h
         29helvetica14.h
         30helvetica18.h
         31helvetica24.h
         32helvetica8.h
         33symbol12.h
         34symbol14.h
         35symbol18.h
         36symbol24.h
         37symbol8.h
         38times12.h
         39times14.h
         40times18.h
         41times24.h
         42times8.h
  • trunk/Ohana/src/libkapa/rotfont/fixfont.c

    r5854 r38986  
    11# include <stdio.h>
    22# include <math.h>
     3# include <stdlib.h>
     4# include <string.h>
    35# define TRUE 1
    46# define FALSE 0
     
    2426
    2527typedef struct {
    26   int dx, dy, ascent, Nb;
     28  int dx;
     29  int dy;
     30  float dXps;
     31  int ascent;
     32  int Nb;
    2733  unsigned char *bits;
    2834  char name[64];
     
    3238int scan_line (FILE *f, char *line);
    3339
    34 main (int argc, char **argv) {
     40int main (int argc, char **argv) {
    3541
    3642  int BitMap, Nvalue, code;
     
    4349  FILE *f;
    4450
    45   if (argc != 3) {
    46     fprintf (stderr, "USAGE: fixfont (file.bdf) (name)\n");
     51  if (argc != 4) {
     52    fprintf (stderr, "USAGE: fixfont (file.bdf) (file.psx) (name)\n");
    4753    exit (0);
    4854  }
    4955
    50   f = fopen (argv[1], "r");
     56  char *bdfname = argv[1];
     57  char *psxname = argv[2];
     58  char *fontname = argv[3];
     59
     60  // read in the PS sizes first
     61  f = fopen (psxname, "r");
    5162  if (f == (FILE *) NULL) {
    52     fprintf (stderr, "failed to open file %s\n", argv[1]);
     63    fprintf (stderr, "failed to open file %s\n", psxname);
     64    exit (0);
     65  }
     66
     67  while (scan_line (f, buffer) != EOF) {
     68    int N;
     69    float dXps;
     70    int Nread = sscanf (buffer, "%d %f", &N, &dXps);
     71    if (Nread != 2) continue;
     72    if (N < 1) continue;
     73    if (N > 255) continue;
     74    font[N].dXps = dXps;
     75  }
     76  fclose (f);
     77
     78  f = fopen (bdfname, "r");
     79  if (f == (FILE *) NULL) {
     80    fprintf (stderr, "failed to open file %s\n", bdfname);
    5381    exit (0);
    5482  }
     
    112140      strcpy (font[i].name, "blank");
    113141    }
    114     fprintf (stdout, "static unsigned char %s_%d_bits[] = {", argv[2], i);
     142    fprintf (stdout, "static unsigned char %s_%d_bits[] = {", fontname, i);
    115143    for (j = 0; j < font[i].Nb; j++) {
    116144      if (!(j % 12)) fprintf (stdout, "\n");
     
    121149  }
    122150 
    123   fprintf (stdout, "static RotFont %sfont[] = {\n", argv[2]);
     151  fprintf (stdout, "static RotFont %sfont[] = {\n", fontname);
    124152  for (i = 0; i < 255; i++) {
    125     fprintf (stdout, "{%d, %d, %d, %s_%d_bits},\n",
    126              font[i].dx, font[i].dy, font[i].ascent, argv[2], i);
    127   }
    128   fprintf (stdout, "{%d, %d, %d, %s_%d_bits}};\n",
    129            font[i].dx, font[i].dy, font[i].ascent, argv[2], i);
     153    fprintf (stdout, "{%3d, %3d, %5.2f, %3d, %s_%d_bits},\n",
     154             font[i].dx, font[i].dy, font[i].dXps, font[i].ascent, fontname, i);
     155  }
     156  fprintf (stdout, "{%3d, %3d, %5.2f, %3d, %s_%d_bits}};\n",
     157           font[i].dx, font[i].dy, font[i].dXps, font[i].ascent, fontname, i);
    130158
    131159     
     160  exit (0);
    132161}
    133162
     
    178207
    179208}
    180 
Note: See TracChangeset for help on using the changeset viewer.