Ejemplo n.º 1
0
static void outpoly() {
	int i;
	int vab,vca;
#ifdef DBG
	printf("  outpoly, npoly = %d \n", npoly);
#endif
	/* check to make sure poly faces away from origin: if not, flip it */
	check_facing();	

	if (subdiv_sides) {
		DPoint midp;
		int nxti = 0;
		for (i=npoly-1; i>=0; i--) {
			pol[2*i] = pol[i];
			MidPoint(&midp,&verts[pol[i]],&verts[pol[nxti]]);
			pol[2*i+1] = reg_vert(&midp);
			nxti = 2*i;
			}
		npoly *= 2;
		}

	if (center_verts||star_axis[curax]||state.scale_axis[curax]!=1.0) {
		DPoint sum;
		int nc,nxt;
		sum.x = sum.y = sum.z = 0.0;
		for (i=0; i<npoly; i++) {
			sum.x += verts[pol[i]].x;
			sum.y += verts[pol[i]].y;
			sum.z += verts[pol[i]].z;
			}
		sum.x /= (float)npoly;
		sum.y /= (float)npoly;
		sum.z /= (float)npoly;

		if (state.scale_axis[curax]!=1.0) {
			ScaleVect(&sum,state.scale_axis[curax]);
			nc = reg_vert(&sum);
			for (i=0; i<npoly; i++) {
				nxt = (i==npoly-1)?0:i+1;
				outface(nc,pol[i],pol[nxt],1,1,1);
				}
			}
		else {
			nc = reg_vert(&sum);
			for (i=0; i<npoly; i++) {
				nxt = (i==npoly-1)?0:i+1;
				outface(nc,pol[i],pol[nxt],0,1,0);
				}
			}
		}
	else  {
		for (i=1; i<npoly-1; i++) {
			vab = vca = 0;
			if (i==1) vab = 1;
			if	(i==npoly-2) vca = 1;
#ifdef DBG2
			printf("         face (%d,%d,%d) vis = (%d %d %d) \n",
				pol[0],pol[i],pol[i+1],vab,1,vca);
#endif
			outface(pol[0],pol[i],pol[i+1],vab,1,vca);
#ifdef DBG2
			{
			double l = dist(pol[i],pol[i+1]);
			printf(" side length = %.6f \n",l);
			}
#endif

		
			}
		}
	}
Ejemplo n.º 2
0
void 
dosimplethings ( void ) 
{
  short i  ;
  {
    fonttype = 0 ;
    if ( lh >= 12 ) 
    {
      {
	checkBCPL ( 32 , 40 ) ;
	if ( ( tfm [32 ]>= 11 ) && ( tfm [33 ]== 84 ) && ( tfm [34 ]== 
	69 ) && ( tfm [35 ]== 88 ) && ( tfm [36 ]== 32 ) && ( tfm [37 ]
	== 77 ) && ( tfm [38 ]== 65 ) && ( tfm [39 ]== 84 ) && ( tfm [40 
	]== 72 ) && ( tfm [41 ]== 32 ) ) 
	{
	  if ( ( tfm [42 ]== 83 ) && ( tfm [43 ]== 89 ) ) 
	  fonttype = 1 ;
	  else if ( ( tfm [42 ]== 69 ) && ( tfm [43 ]== 88 ) ) 
	  fonttype = 2 ;
	} 
      } 
      if ( lh >= 17 ) 
      {
	left () ;
	Fputs ( plfile ,  "FAMILY" ) ;
	checkBCPL ( 72 , 20 ) ;
	outBCPL ( 72 ) ;
	right () ;
	if ( lh >= 18 ) 
	{
	  left () ;
	  Fputs ( plfile ,  "FACE" ) ;
	  outface ( 95 ) ;
	  right () ;
	  {register integer for_end; i = 18 ;for_end = lh - 1 ; if ( i <= 
	  for_end) do 
	    {
	      left () ;
	      fprintf ( plfile , "%s%ld",  "HEADER D " , (long)i ) ;
	      outoctal ( 24 + 4 * i , 4 ) ;
	      right () ;
	    } 
	  while ( i++ < for_end ) ;} 
	} 
      } 
      left () ;
      Fputs ( plfile ,  "CODINGSCHEME" ) ;
      outBCPL ( 32 ) ;
      right () ;
    } 
    left () ;
    Fputs ( plfile ,  "DESIGNSIZE" ) ;
    if ( tfm [28 ]> 127 ) 
    {
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%s%c\n",  "Bad TFM file: " , "Design size " , "negative" ,         '!' ) ;
      } 
      fprintf ( stderr , "%s\n",  "I've set it to 10 points." ) ;
      Fputs ( plfile ,  " D 10" ) ;
    } 
    else if ( ( tfm [28 ]== 0 ) && ( tfm [29 ]< 16 ) ) 
    {
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%s%c\n",  "Bad TFM file: " , "Design size " , "too small" ,         '!' ) ;
      } 
      fprintf ( stderr , "%s\n",  "I've set it to 10 points." ) ;
      Fputs ( plfile ,  " D 10" ) ;
    } 
    else outfix ( 28 ) ;
    right () ;
    Fputs ( plfile ,  "(COMMENT DESIGNSIZE IS IN POINTS)" ) ;
    outln () ;
    Fputs ( plfile ,  "(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)" ) ;
    outln () ;
    left () ;
    Fputs ( plfile ,  "CHECKSUM" ) ;
    outoctal ( 24 , 4 ) ;
    right () ;
    if ( ( lh > 17 ) && ( tfm [92 ]> 127 ) ) 
    {
      left () ;
      Fputs ( plfile ,  "SEVENBITSAFEFLAG TRUE" ) ;
      right () ;
    } 
  } 
  if ( np > 0 ) 
  {
    left () ;
    Fputs ( plfile ,  "FONTDIMEN" ) ;
    outln () ;
    {register integer for_end; i = 1 ;for_end = np ; if ( i <= for_end) do 
      {
	left () ;
	if ( i == 1 ) 
	Fputs ( plfile ,  "SLANT" ) ;
	else {
	    
	  if ( ( tfm [4 * ( parambase + i ) ]> 0 ) && ( tfm [4 * ( 
	  parambase + i ) ]< 255 ) ) 
	  {
	    tfm [4 * ( parambase + i ) ]= 0 ;
	    tfm [( 4 * ( parambase + i ) ) + 1 ]= 0 ;
	    tfm [( 4 * ( parambase + i ) ) + 2 ]= 0 ;
	    tfm [( 4 * ( parambase + i ) ) + 3 ]= 0 ;
	    {
	      perfect = false ;
	      if ( charsonline > 0 ) 
	      { putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	      charsonline = 0 ;
	      fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Parameter" , ' ' , (long)i ,               " is too big;" ) ;
	    } 
	    fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
	  } 
	  if ( i <= 7 ) 
	  switch ( i ) 
	  {case 2 : 
	    Fputs ( plfile ,  "SPACE" ) ;
	    break ;
	  case 3 : 
	    Fputs ( plfile ,  "STRETCH" ) ;
	    break ;
	  case 4 : 
	    Fputs ( plfile ,  "SHRINK" ) ;
	    break ;
	  case 5 : 
	    Fputs ( plfile ,  "XHEIGHT" ) ;
	    break ;
	  case 6 : 
	    Fputs ( plfile ,  "QUAD" ) ;
	    break ;
	  case 7 : 
	    Fputs ( plfile ,  "EXTRASPACE" ) ;
	    break ;
	  } 
	  else if ( ( i <= 22 ) && ( fonttype == 1 ) ) 
	  switch ( i ) 
	  {case 8 : 
	    Fputs ( plfile ,  "NUM1" ) ;
	    break ;
	  case 9 : 
	    Fputs ( plfile ,  "NUM2" ) ;
	    break ;
	  case 10 : 
	    Fputs ( plfile ,  "NUM3" ) ;
	    break ;
	  case 11 : 
	    Fputs ( plfile ,  "DENOM1" ) ;
	    break ;
	  case 12 : 
	    Fputs ( plfile ,  "DENOM2" ) ;
	    break ;
	  case 13 : 
	    Fputs ( plfile ,  "SUP1" ) ;
	    break ;
	  case 14 : 
	    Fputs ( plfile ,  "SUP2" ) ;
	    break ;
	  case 15 : 
	    Fputs ( plfile ,  "SUP3" ) ;
	    break ;
	  case 16 : 
	    Fputs ( plfile ,  "SUB1" ) ;
	    break ;
	  case 17 : 
	    Fputs ( plfile ,  "SUB2" ) ;
	    break ;
	  case 18 : 
	    Fputs ( plfile ,  "SUPDROP" ) ;
	    break ;
	  case 19 : 
	    Fputs ( plfile ,  "SUBDROP" ) ;
	    break ;
	  case 20 : 
	    Fputs ( plfile ,  "DELIM1" ) ;
	    break ;
	  case 21 : 
	    Fputs ( plfile ,  "DELIM2" ) ;
	    break ;
	  case 22 : 
	    Fputs ( plfile ,  "AXISHEIGHT" ) ;
	    break ;
	  } 
	  else if ( ( i <= 13 ) && ( fonttype == 2 ) ) {
	      
	    if ( i == 8 ) 
	    Fputs ( plfile ,  "DEFAULTRULETHICKNESS" ) ;
	    else
	    fprintf ( plfile , "%s%ld",  "BIGOPSPACING" , (long)i - 8 ) ;
	  } 
	  else
	  fprintf ( plfile , "%s%ld",  "PARAMETER D " , (long)i ) ;
	} 
	outfix ( 4 * ( parambase + i ) ) ;
	right () ;
      } 
    while ( i++ < for_end ) ;} 
    right () ;
  } 
  if ( ( fonttype == 1 ) && ( np != 22 ) ) 
  fprintf ( stderr , "%s%ld%s\n",    "Unusual number of fontdimen parameters for a math symbols font (" , (long)np ,   " not 22)." ) ;
  else if ( ( fonttype == 2 ) && ( np != 13 ) ) 
  fprintf ( stderr , "%s%ld%s\n",    "Unusual number of fontdimen parameters for an extension font (" , (long)np ,   " not 13)." ) ;
  if ( ( tfm [4 * widthbase ]> 0 ) || ( tfm [4 * widthbase + 1 ]> 0 ) || ( 
  tfm [4 * widthbase + 2 ]> 0 ) || ( tfm [4 * widthbase + 3 ]> 0 ) ) 
  {
    perfect = false ;
    if ( charsonline > 0 ) 
    { putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
    charsonline = 0 ;
    fprintf ( stderr , "%s%s\n",  "Bad TFM file: " , "width[0] should be zero." ) ;
  } 
  if ( ( tfm [4 * heightbase ]> 0 ) || ( tfm [4 * heightbase + 1 ]> 0 ) || 
  ( tfm [4 * heightbase + 2 ]> 0 ) || ( tfm [4 * heightbase + 3 ]> 0 ) ) 
  {
    perfect = false ;
    if ( charsonline > 0 ) 
    { putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
    charsonline = 0 ;
    fprintf ( stderr , "%s%s\n",  "Bad TFM file: " , "height[0] should be zero." ) ;
  } 
  if ( ( tfm [4 * depthbase ]> 0 ) || ( tfm [4 * depthbase + 1 ]> 0 ) || ( 
  tfm [4 * depthbase + 2 ]> 0 ) || ( tfm [4 * depthbase + 3 ]> 0 ) ) 
  {
    perfect = false ;
    if ( charsonline > 0 ) 
    { putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
    charsonline = 0 ;
    fprintf ( stderr , "%s%s\n",  "Bad TFM file: " , "depth[0] should be zero." ) ;
  } 
  if ( ( tfm [4 * italicbase ]> 0 ) || ( tfm [4 * italicbase + 1 ]> 0 ) || 
  ( tfm [4 * italicbase + 2 ]> 0 ) || ( tfm [4 * italicbase + 3 ]> 0 ) ) 
  {
    perfect = false ;
    if ( charsonline > 0 ) 
    { putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
    charsonline = 0 ;
    fprintf ( stderr , "%s%s\n",  "Bad TFM file: " , "italic[0] should be zero." ) ;
  } 
  {register integer for_end; i = 0 ;for_end = nw - 1 ; if ( i <= for_end) do 
    if ( ( tfm [4 * ( widthbase + i ) ]> 0 ) && ( tfm [4 * ( widthbase + i 
    ) ]< 255 ) ) 
    {
      tfm [4 * ( widthbase + i ) ]= 0 ;
      tfm [( 4 * ( widthbase + i ) ) + 1 ]= 0 ;
      tfm [( 4 * ( widthbase + i ) ) + 2 ]= 0 ;
      tfm [( 4 * ( widthbase + i ) ) + 3 ]= 0 ;
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Width" , ' ' , (long)i ,         " is too big;" ) ;
      } 
      fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
    } 
  while ( i++ < for_end ) ;} 
  {register integer for_end; i = 0 ;for_end = nh - 1 ; if ( i <= for_end) do 
    if ( ( tfm [4 * ( heightbase + i ) ]> 0 ) && ( tfm [4 * ( heightbase + 
    i ) ]< 255 ) ) 
    {
      tfm [4 * ( heightbase + i ) ]= 0 ;
      tfm [( 4 * ( heightbase + i ) ) + 1 ]= 0 ;
      tfm [( 4 * ( heightbase + i ) ) + 2 ]= 0 ;
      tfm [( 4 * ( heightbase + i ) ) + 3 ]= 0 ;
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Height" , ' ' , (long)i ,         " is too big;" ) ;
      } 
      fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
    } 
  while ( i++ < for_end ) ;} 
  {register integer for_end; i = 0 ;for_end = nd - 1 ; if ( i <= for_end) do 
    if ( ( tfm [4 * ( depthbase + i ) ]> 0 ) && ( tfm [4 * ( depthbase + i 
    ) ]< 255 ) ) 
    {
      tfm [4 * ( depthbase + i ) ]= 0 ;
      tfm [( 4 * ( depthbase + i ) ) + 1 ]= 0 ;
      tfm [( 4 * ( depthbase + i ) ) + 2 ]= 0 ;
      tfm [( 4 * ( depthbase + i ) ) + 3 ]= 0 ;
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Depth" , ' ' , (long)i ,         " is too big;" ) ;
      } 
      fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
    } 
  while ( i++ < for_end ) ;} 
  {register integer for_end; i = 0 ;for_end = ni - 1 ; if ( i <= for_end) do 
    if ( ( tfm [4 * ( italicbase + i ) ]> 0 ) && ( tfm [4 * ( italicbase + 
    i ) ]< 255 ) ) 
    {
      tfm [4 * ( italicbase + i ) ]= 0 ;
      tfm [( 4 * ( italicbase + i ) ) + 1 ]= 0 ;
      tfm [( 4 * ( italicbase + i ) ) + 2 ]= 0 ;
      tfm [( 4 * ( italicbase + i ) ) + 3 ]= 0 ;
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Italic correction" , ' ' , (long)i ,         " is too big;" ) ;
      } 
      fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
    } 
  while ( i++ < for_end ) ;} 
  if ( nk > 0 ) 
  {register integer for_end; i = 0 ;for_end = nk - 1 ; if ( i <= for_end) do 
    if ( ( tfm [4 * ( kernbase + i ) ]> 0 ) && ( tfm [4 * ( kernbase + i ) 
    ]< 255 ) ) 
    {
      tfm [4 * ( kernbase + i ) ]= 0 ;
      tfm [( 4 * ( kernbase + i ) ) + 1 ]= 0 ;
      tfm [( 4 * ( kernbase + i ) ) + 2 ]= 0 ;
      tfm [( 4 * ( kernbase + i ) ) + 3 ]= 0 ;
      {
	perfect = false ;
	if ( charsonline > 0 ) 
	{ putc ( ' ' ,  stderr );  putc ( '\n',  stderr ); }
	charsonline = 0 ;
	fprintf ( stderr , "%s%s%c%ld%s\n",  "Bad TFM file: " , "Kern" , ' ' , (long)i ,         " is too big;" ) ;
      } 
      fprintf ( stderr , "%s\n",  "I have set it to zero." ) ;
    } 
  while ( i++ < for_end ) ;} 
}