Back to index

tetex-bin  3.0
Functions | Variables
papersiz.c File Reference
#include "dvipng.h"

Go to the source code of this file.

Functions

int32_t myatodim (char **p)
void handlepapersize (char *p, int32_t *x, int32_t *y)

Variables

const char * lengthnames []
const int32_t lengthsp []

Function Documentation

void handlepapersize ( char *  p,
int32_t x,
int32_t y 
)

Definition at line 64 of file papersiz.c.

{ 
   while (*p == ' ')
      p++ ;
   *x = myatodim(&p) ;
   while (*p == ' ' || *p == ',')
      p++ ;
   *y = myatodim(&p) ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t myatodim ( char **  p)

Definition at line 40 of file papersiz.c.

{ 
  double tmp; /* double accuracy is enough, I think */
  int i=0;

  tmp = strtod(*p,p);
  while (**p == ' ') 
    (*p)++;
  while (i<8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1]))
    i++; 
  if (i==8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1]))
    Warning("Unrecognized length unit \"%.2s\", assuming inches.",*p);
  while (**p != ',' && **p !='\0')
    (*p)++;
  tmp *= lengthsp[i]*dpi/4736286L; /* convert sp to pixels */
  return((int32_t) tmp);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* lengthnames[]
Initial value:
{ "sp", "pt", "bp", 
                         "dd", "mm", "pc", 
                         "cc", "cm", "in" }

Definition at line 28 of file papersiz.c.

Initial value:
{ 1L, 65536L, 65782L,
                        70124L, 186468L, 786432L, 
                        841489L, 1864680L, 4736286L }

Definition at line 31 of file papersiz.c.