⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cacfff.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 4 页
字号:
  return (TRUE);  }if (org_flags & LARGE_VALUE_FLAG)  {#ifdef WITHOUTPUT  fprintf(fptr,"32-bit arithmetic flag is set\n");#endif  WARNING_MACRO (52);	/* Large value flag detected */  }/* Check for other than 16 parameters per character definition. * (Save number of parameter bytes for later use.) */if (  (size_of_char_params= GET_LONG(bufptr+OFFSET_SIZE_OF_CHAR_PARAMETERS) != 16 )      &&      (size_of_char_params != 8)   )  {  ABORT_MACRO(53);	/* SIZE_OF_CHAR_PARAMETERS is invalid */  return (TRUE);   }/* The 28th byte of the font ID contains resolution data; an 'F'  * indicates 300 dpi.  Otherwise, return error. */if (dll_font.new_font_file_id [27] != 'F')  {  ABORT_MACRO(54);	/* Byte 28 of font ID is not 'F' */  return (TRUE);  }/* The 22nd-25th bytes of the font ID contain character set data;  * all four of these bytes must contain 'Z'.  Otherwise,  * return error. */for (i=21; i <= 24; i++)  if (dll_font.new_font_file_id [i] != 'Z')    {#ifdef WITHOUTPUT    fprintf (fptr,"ID of font file is: %s\n", dll_font.new_font_file_id );#endif    WARNING_MACRO (56);	/* Bytes 22-25 of font ID not all 'Z' */    }/* The 26th-27th bytes of the font ID contain encoding data; a '02'  * in this two-byte field indicates binary encoding.  Otherwise,  * return error. */if ( ( (BYTE)(dll_font.new_font_file_id [25]) != '0' )     ||     ( (BYTE)(dll_font.new_font_file_id [26]) != '2' )   )  {  ABORT_MACRO(57); /* Bytes 26-27 aren't '02'; not binary encoding */  return (TRUE);  }temp_spacing = dll_font.new_font_file_id [7];if ( (temp_spacing >= 'A') && (temp_spacing <= 'Z') )   {   temp_spacing_fraction = dll_font.new_font_file_id [28];   /* Get byte 29 */   if ( (temp_spacing_fraction >= 'A') && (temp_spacing_fraction <= 'J') )      {      temp_spacing_fraction = temp_spacing_fraction - 'A' + 10;      }   else if ( (temp_spacing_fraction >= '0') && (temp_spacing_fraction <= '9') )      {      temp_spacing_fraction = temp_spacing_fraction - '0';      }   else      {      ABORT_MACRO(58);	/* Spacing not defined */      return (TRUE);	  }/* note: the following statement was originally : * * dll_spacing = 7200/(temp_spacing - 'A' + 1 + temp_spacing_fraction * .05); *  * For lattice compiles we can not have the real constant (0.05), or would * have calls to it CXxxx routines, and to keep * the precision we can not convert this to a divide by 20.  So instead * 720000L was used and a multiple by 5. */   dll_font.dll_spacing = 720000L/(temp_spacing - 'A' + 1 + (temp_spacing_fraction * 5));   }else if ( (temp_spacing >= '0') && (temp_spacing <= '9') )  switch (temp_spacing)    {    case '0':   dll_font.dll_spacing = PROPORTIONAL_PITCH;		break;    case '1': 	dll_font.dll_spacing = CPI_13_6;		break;    case '2': 	dll_font.dll_spacing = CPI_10_3;    		break;    case '3': 	dll_font.dll_spacing = CPI_6_8;    		break;    case '4': 	dll_font.dll_spacing = CPI_9_34;    		break;    case '5': 	dll_font.dll_spacing = CPI_7_5;    		break;    case '6': 	dll_font.dll_spacing = CPI_18_75;    		break;    case '7': 	dll_font.dll_spacing = CPI_13_3;    		break;    case '8': 	dll_font.dll_spacing = CPI_5_7;    		break;    case '9': 	dll_font.dll_spacing = CPI_5_4;    		break;    }/* Check for pixel aspect ratio other than 1:1.  A value other than 1 * in either of the words at PIXEL_ASPECT_RATIO will cause the file * to be rejected.  (Note that even though the * CFFF manual states that one of the fields the LN03 should  * ignore is the Pixel Aspect Ratio, it is still necessary  * for the translator to CHECK this region to ensure that the * the incoming font does not have an unsupported aspect ratio.) */if ( ( *((WORD *)(bufptr + OFFSET_PIXEL_ASPECT_RATIO)) != 1 )     ||     ( *((WORD *)(bufptr + (OFFSET_PIXEL_ASPECT_RATIO+2))) != 1 )   )  {  ABORT_MACRO(55);	/* Pixel aspect ratio not 1:1 */  return (TRUE);  }/* Done with basic error checking and retrieval of font-specific * data; now start reading character-specific data from the rest * of the font file. *//* Get "first char" and "last char" from font file */if ( (dll_font.dll_first_char = GET_LONG(bufptr + OFFSET_FIRST_CHAR)) < 32  )  {  ABORT_MACRO(59);	/* Invalid FIRST_CHARACTER in font file */  return (TRUE);  }#ifdef WITHOUTPUT  fprintf (fptr, "\nfirst char: %xH\n", dll_font.dll_first_char);#endif    if ( (dll_font.dll_last_char = GET_LONG(bufptr + OFFSET_LAST_CHAR)) > 127 )  {  ABORT_MACRO(60);	/* Invalid LAST_CHARACTER in font file */  return (TRUE);  }if ( dll_font.dll_last_char < dll_font.dll_first_char )  {  ABORT_MACRO(69);  /* LAST_CHARACTER less than FIRST_CHARACTER in font file.*/  return (TRUE);  }#ifdef WITHOUTPUT    fprintf (fptr, "\nlast char: %xH\n", dll_font.dll_last_char);#endif/* Pick up the error character (i.e., "blob")'s locator */dll_font.blob_locator = GET_LONG(bufptr + OFFSET_ERROR_CHAR_LOCATOR);#ifdef WITHOUTPUT  fprintf (fptr, "\nACTUAL Error char locator picked up = %xH", dll_font.blob_locator);#endif/*printf ("blob_locator =%ld =%xH; bufptr =%ld buflen=%ld\n",		dll_font.blob_locator, dll_font.blob_locator, bufptr, buflen);*//* If the locator is 0, set the "no error char defined" flag * then put the "default blob"'s data into the blob. */if (dll_font.blob_locator == 0)  {  no_dll_error_char_defined = TRUE;  blob.baseline = default_blob.baseline;  blob.no_underlining = default_blob.no_underlining;  blob.numrows = default_blob.numrows;  blob.numcols = default_blob.numcols;  blob.bitmap_ptr = default_blob.bitmap_ptr;  blob_bitmap_size = BLOB_BITMAP_SIZE;  dll_even_blob_bitmap_size =dll_odd_blob_bitmap_size = 0;  dll_even_blob_bitmap_size_land = dll_odd_blob_bitmap_size_land = 0;  dll_even_blob_bitmap_size_mixed = dll_odd_blob_bitmap_size_mixed  = 0;  dll_font.blob_l_bearing = default_blob_l_bearing;  dll_font.blob_r_bearing = default_blob_r_bearing;  dll_font.blob_width = default_blob_width;	  }else  {	/* error char locator was present */  /* If high bit of locator is on, file is invalid,   * because that indicates multiple font segments.   */  if (dll_font.blob_locator & BIT31_MASK)    {    ABORT_MACRO(63);	/* Bit 31 of error char locator was set */    return (TRUE);    } 	  /* If Bit 31 is 0, mask out unused bits 24-30 of the locator.   */  dll_font.blob_locator &= LOCATOR_MASK;#ifdef WITHOUTPUT    	fprintf (fptr, "\nBlob_locator after masking = %xH\n", dll_font.blob_locator);#endif  no_dll_error_char_defined = FALSE;  /* Pick up the flags bytes from the blob char parameters   */  temp = GET_LONG(bufptr + dll_font.blob_locator);#ifdef WITHOUTPUT    	fprintf (fptr, "\nFlags for downloaded blob are: %xH", temp);#endif  /* If the blob's flag bit is not set, file is invalid.   */  if ( (temp &  FLAG_FLAG) == 0 )    {    ABORT_MACRO(61);	/* Error character's flag flag not set */    return (TRUE);    }  /* If blob has a raster ...   */  if ( (temp &  NO_RASTER_FLAG) == 0 )    {    /* ... make sure it's a Type 81 (extended) raster ...     */    if ( *((UBYTE *)(bufptr + dll_font.blob_locator + OFFSET_TYPE1)) != 0x81 )      {      ABORT_MACRO(62);	/* Error char's raster not Type 81 */      return (TRUE);      }    }  /* Get the blob's width ...   */  dll_font.blob_width = GET_LONG(bufptr + dll_font.blob_locator + OFFSET_TYPE_FIELD_NOMINAL_WIDTH);	  /* ... and number of columns in blob definition ...   */  blob.numcols = *((WORD *)(bufptr + dll_font.blob_locator + OFFSET_COLUMNS));#ifdef WITHOUTPUT 	fprintf (fptr, "\nBlob numcols:  %xH", blob.numcols);#endif	  /* ... get its left bearing ...   */  dll_font.blob_l_bearing = GET_LONG(bufptr + dll_font.blob_locator + OFFSET_LEFT_BEARING);  /* ... create its right bearing ...   */  dll_font.blob_r_bearing = dll_font.blob_width - dll_font.blob_l_bearing - (blob.numcols * 24);  /* ... get its baseline (centipts) ...   */  blob.baseline = GET_LONG(bufptr + dll_font.blob_locator + OFFSET_RASTER_BASELINE);#ifdef WITHOUTPUT	fprintf (fptr, "\nBaseline: %xH", blob.baseline);#endif  /* ... get its no_underlining flag ...   */  blob.no_underlining = GET_LONG(bufptr + dll_font.blob_locator) & 							NO_UNDERLINING_FLAG;#ifdef WITHOUTPUT	fprintf (fptr,"\nBlob's no_underlining flag: %xH", blob.no_underlining);#endif  /* ... get number of rows in blob definition ...   */  blob.numrows = *((WORD *)((bufptr + dll_font.blob_locator) + OFFSET_ROWS));#ifdef WITHOUTPUT	fprintf (fptr, "\nBlob numrows:  %xH", blob.numrows);#endif  /* ... calculate number of words in blob's bit map ...   */  number_of_bytes_in_bitmap_port =  (((blob.numcols + 7) / 8 ) * blob.numrows);  number_of_bytes_in_bitmap_land =  (((blob.numrows + 7) / 8 ) * blob.numcols);  dll_font.number_of_odd_words_in_bitmaps += number_of_bytes_in_bitmap_port % 2;  dll_font.number_of_odd_words_in_bm_land += number_of_bytes_in_bitmap_land % 2;  /* Add total number of words in downloaded blob's bitmap to    * total calculated portrait bytes for checking at end.     */  /* Note for mixed case mixed even = MAX (P_even, L_even) is the same as   * mixed even = mixed odd rounded because MAX(ROUND0 = ROUND(MAX).   */  blob_bitmap_size = dll_even_blob_bitmap_size = ((number_of_bytes_in_bitmap_port + 1 ) / 2) * 2;  dll_even_blob_bitmap_size_land  = ((number_of_bytes_in_bitmap_land + 1 ) / 2) * 2;  dll_even_blob_bitmap_size_mixed = MAX (dll_even_blob_bitmap_size, dll_even_blob_bitmap_size_land);  dll_odd_blob_bitmap_size = number_of_bytes_in_bitmap_port;  dll_odd_blob_bitmap_size_land = number_of_bytes_in_bitmap_land;  dll_odd_blob_bitmap_size_mixed  = MAX (dll_odd_blob_bitmap_size, dll_odd_blob_bitmap_size_land);  dll_font.total_portrait_bytes  += dll_even_blob_bitmap_size;  dll_font.total_landscape_bytes += dll_even_blob_bitmap_size_land;  dll_font.total_mixed_bytes     += MAX(dll_even_blob_bitmap_size,                                dll_even_blob_bitmap_size_land);  if (dll_even_blob_bitmap_size_mixed    != dll_odd_blob_bitmap_size_mixed)     dll_font.number_of_odd_words_in_bm_mixed += 1;#ifdef WITHOUTPUT  fprintf (fptr, "\nADDING #1.1 num portrait words in blob's bitmap: %dd, running total.",  			    			    	dll_font.total_portrait_bytes);  fprintf (fptr, "\nADDING #1.2 num landscape words in blob's bitmap: %dd, running total.",  			    			    	dll_font.total_landscape_bytes);  fprintf (fptr, "\nADDING #1.3 num mixed words in blob's bitmap: %dd, running total.",  			    			    	dll_font.total_mixed_bytes);#endif  /* ... and save the ptr to the blob's bitmap.   */  blob.bitmap_ptr = bufptr + dll_font.blob_locator + OFFSET_CHARACTER_RASTER;#ifdef WITHOUTPUT	fprintf (fptr, "\nBlob's bitmap OFFSET IN DCS BUFFER: %xH.",     			dll_font.blob_locator + OFFSET_CHARACTER_RASTER);	fprintf (fptr, "\nActual PTR stored in blob.bitmap_ptr: %xH.",     			blob.bitmap_ptr);#endif  }/* Pick up the "font attributes flags". */font_attr_flags = GET_LONG(bufptr + OFFSET_FONT_ATTRIBUTE_FLAGS);/* * Read "underlined_font_flag" from font_attr_flags.  If this is * NOT an underlined font, then get the underline offset and thickness * from the font parameters in case underlining is requested (in * which case algorithmic underlining will have to be performed). * * NOTE:  If the "underlined_font_flag" is clear and underlining is *	      requested, the NO_UNDERLINING_FLAG for each individual *	      character must be checked; if THAT flag is set, it *	      indicates that the character is NOT INTENDED to be *        algorithmically underlined.  (There is a field in each *	      character, ".no_underlining".) */dll_font.dll_ul_font_flag = font_attr_flags & UNDERLINED_FONT_FLAG;#ifdef WITHOUTPUT	fprintf (fptr, "\nul_font_flag= %xH", 	dll_font.dll_ul_font_flag);#endifif (dll_font.dll_ul_font_flag == 0)  {  dll_font.dll_ul_offset = GET_LONG(bufptr + OFFSET_UNDERLINE_OFFSET);  dll_font.dll_ul_thickness = GET_LONG(bufptr + OFFSET_UNDERLINE_THICKNESS);  }#ifdef WITHOUTPUT  	fprintf (fptr, "\nul_offset= %xH", dll_font.dll_ul_offset);	fprintf (fptr, "\nul_thickness= %xH", dll_font.dll_ul_thickness);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -