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

📄 do_char.c

📁 unix vnc 协议源码. VNC是一款远程控制工具软件.
💻 C
📖 第 1 页 / 共 3 页
字号:
pointer = sp_get_char_org(char_index, TRUE); /* Point to start of character data */if (pointer == NULL)             /* Character data not available? */    {    report_error(12);            /* Report character data not avail */    return FALSE;                /* Error return */    }pointer += 2;                    /* Skip over character id */tmp = NEXT_WORD(pointer); /* Read set width */               tmp = NEXT_BYTE(pointer);if (tmp & BIT1)               /* Optional data in header? */    {    tmp = (ufix8)NEXT_BYTE(pointer); /* Read size of optional data */    pointer += tmp;         /* Skip optional data */    }pointer = plaid_tcb(pointer, tmp);              /* Process plaid data */pointer = read_bbox(pointer, &Pmin, &Pmax,(boolean)FALSE);        /* Read bounding box */bbox->xmin  = (fix31)Pmin.x << sp_globals.poshift;bbox->xmax  = (fix31)Pmax.x << sp_globals.poshift;bbox->ymin  = (fix31)Pmin.y << sp_globals.poshift;bbox->ymax  = (fix31)Pmax.y << sp_globals.poshift;return TRUE;}#else /* new code, 4/25/91 */FUNCTION boolean get_char_bbox(char_index, bbox)GDECLufix16 char_index;bbox_t *bbox;{/* *	returns true if character exists, false if it doesn't *	provides transformed character bounding box in 1/65536 pixels *	in the provided bbox_t structure.  Bounding box may be *	conservative in the event that the transformation is not *	normal or the character is compound. */ufix8 FONTFAR *pointer;fix15 tmp;fix15 format;ufix16 pix_adj;point_t Pmin, Pmax;#if REENTRANT_ALLOCplaid_t plaid;sp_globals.plaid = &plaid;#endifif (!sp_globals.specs_valid)                /* Font specs not defined? */    {    report_error(10);            /* Report font not specified */    return FALSE;                /* Error return */    }init_tcb();                      /* Initialize transformation control block */pointer = sp_get_char_org(char_index, TRUE); /* Point to start of character data */if (pointer == NULL)             /* Character data not available? */    {    report_error(12);            /* Report character data not avail */    return FALSE;                /* Error return */    }pointer += 2;                    /* Skip over character id */tmp = NEXT_WORD(pointer); /* Read set width */               format = NEXT_BYTE(pointer);if (format & BIT1)               /* Optional data in header? */    {    tmp = (ufix8)NEXT_BYTE(pointer); /* Read size of optional data */    pointer += tmp;         /* Skip optional data */    }if (format & BIT0)    {    pix_adj = sp_globals.onepix << 1;          /* Allow 2 pixel expansion ... */    }else    {    pix_adj = 0;    }pointer = plaid_tcb(pointer, format);              /* Process plaid data */pointer = read_bbox(pointer, &Pmin, &Pmax,(boolean)FALSE);        /* Read bounding box */Pmin.x -= pix_adj;                         /* ... of components of ... */Pmin.y -= pix_adj;                         /* ... compound ... */Pmax.x += pix_adj;                         /* ... character ... */Pmax.y += pix_adj;                         /* ... bounding box. */bbox->xmin  = (fix31)Pmin.x << sp_globals.poshift;bbox->xmax  = (fix31)Pmax.x << sp_globals.poshift;bbox->ymin  = (fix31)Pmin.y << sp_globals.poshift;bbox->ymax  = (fix31)Pmax.y << sp_globals.poshift;return TRUE;}#endif	/* new code */#endif#if INCL_ISWFUNCTION boolean make_char_isw(char_index,imported_setwidth)GDECLufix16 char_index;ufix32 imported_setwidth;{fix15   xmin;          /* Minimum X ORU value in font */fix15   xmax;          /* Maximum X ORU value in font */fix15   ymin;          /* Minimum Y ORU value in font */fix15   ymax;          /* Maximum Y ORU value in font */ufix16  return_value;sp_globals.import_setwidth_act = TRUE;/* convert imported width to orus */sp_globals.imported_width = (sp_globals.metric_resolution * 			    imported_setwidth) >> 16;return_value = do_make_char(char_index);if (sp_globals.isw_modified_constants)    {    /* reset fixed point constants */    xmin = read_word_u(sp_globals.font_org + FH_FXMIN);    ymin = read_word_u(sp_globals.font_org + FH_FYMIN);    ymax = read_word_u(sp_globals.font_org + FH_FYMAX);    sp_globals.constr.data_valid = FALSE;    xmax = read_word_u(sp_globals.font_org + FH_FXMAX);    if (!setup_consts(xmin,xmax,ymin,ymax))        {        report_error(3);           /* Requested specs out of range */        return FALSE;        }    }    return (return_value);}FUNCTION boolean make_char(char_index)GDECLufix16 char_index;     /* Index to character in char directory */{sp_globals.import_setwidth_act = FALSE;return (do_make_char(char_index));}FUNCTION static boolean do_make_char(char_index)#elseFUNCTION boolean make_char(char_index)#endif/* * Outputs specified character using the currently selected font and * scaling and output specifications. * Reports Error 10 and returns FALSE if no font specifications  * previously set. * Reports Error 12 and returns FALSE if character data not available. */GDECLufix16 char_index;{ufix8 FONTFAR  *pointer;      /* Pointer to character data */fix15    x_orus;fix15    tmpfix15;ufix8    format;#if INCL_ISWsp_globals.isw_modified_constants = FALSE;#endif#if REENTRANT_ALLOCplaid_t plaid;#if INCL_BLACK || INCL_SCREEN || INCL_2Dintercepts_t intercepts;sp_globals.intercepts = &intercepts;#endifsp_globals.plaid = &plaid;#endifif (!sp_globals.specs_valid)                /* Font specs not defined? */    {    report_error(10);            /* Report font not specified */    return FALSE;                /* Error return */    }#if INCL_MULTIDEV#if INCL_OUTLINEif (sp_globals.output_mode == MODE_OUTLINE && !sp_globals.outline_device_set)	{	report_error(2);	return FALSE;	}else#endif	if (!sp_globals.bitmap_device_set)		{		report_error(2);		return FALSE;		}#endifinit_tcb();                      /* Initialize transformation control block */pointer = sp_get_char_org(char_index, TRUE); /* Point to start of character data */SHOW(pointer);if (pointer == NULL)             /* Character data not available? */    {    report_error(12);            /* Report character data not avail */    return FALSE;                /* Error return */    }pointer += 2;                    /* Skip over character id */x_orus = NEXT_WORD(pointer); /* Read set width */#if INCL_SQUEEZING || INCL_ISWsp_globals.setwidth_orus = x_orus;#endif#if INCL_ISWif (sp_globals.import_setwidth_act)    x_orus = sp_globals.imported_width;#endifsp_globals.Psw.x = (fix15)((fix31)                   (((fix31)x_orus * (sp_globals.specs.xxmult>>16) +                   ( ((fix31)x_orus * (sp_globals.specs.xxmult&0xffffL) )>>16)                   ) << sp_globals.pixshift) / sp_globals.metric_resolution);sp_globals.Psw.y = (fix15)(   		  (fix31)(                  ((fix31)x_orus * (sp_globals.specs.yxmult>>16) +                 ( ((fix31)x_orus * (sp_globals.specs.yxmult&0xffffL) )>>16)                   ) << sp_globals.pixshift) / sp_globals.metric_resolution);               format = NEXT_BYTE(pointer);if (format & BIT1)               /* Optional data in header? */    {    tmpfix15 = (ufix8)NEXT_BYTE(pointer); /* Read size of optional data */    pointer += tmpfix15;         /* Skip optional data */    }if (format & BIT0)    {    return sp_make_comp_char(pointer); /* Output compound character */    }else    {    return sp_make_simp_char(pointer, format); /* Output simple character */    }}FUNCTION static boolean sp_make_simp_char(pointer, format)GDECLufix8 FONTFAR  *pointer;      /* Pointer to first byte of position argument */ufix8    format;       /* Character format byte *//* * Called by sp_make_char() to output a simple (non-compound) character. * Returns TRUE on completion. */{point_t Pmin, Pmax;    /* Transformed corners of bounding box */#if INCL_SQUEEZING || INCL_ISWufix8 FONTFAR *save_pointer;#endif#if INCL_ISWfix31   char_width;fix31   isw_scale;#endif#if INCL_SQUEEZINGsp_globals.squeezing_compound = FALSE;if ((sp_globals.pspecs->flags & SQUEEZE_LEFT) ||    (sp_globals.pspecs->flags & SQUEEZE_RIGHT) ||    (sp_globals.pspecs->flags & SQUEEZE_TOP) ||    (sp_globals.pspecs->flags & SQUEEZE_BOTTOM) )    {	/* get the bounding box data before processing the character */    save_pointer = pointer;    preview_bounding_box (pointer, format);    pointer = save_pointer;    }#endif#if (INCL_ISW)if (sp_globals.import_setwidth_act)    {    save_pointer = pointer;    preview_bounding_box (pointer, format);    pointer = save_pointer;        /* make sure I'm not going to get fixed point overflow */    isw_scale = compute_isw_scale();    if (sp_globals.bbox_xmin_orus < 0)        char_width = SQUEEZE_MULT((sp_globals.bbox_xmax_orus - sp_globals.bbox_xmin_orus), isw_scale);    else	char_width = SQUEEZE_MULT(sp_globals.bbox_xmax_orus, isw_scale);    if (char_width >= sp_globals.isw_xmax)        if (!reset_xmax(char_width))              return FALSE;    }#endifpointer = plaid_tcb(pointer, format);              /* Process plaid data */pointer = read_bbox(pointer, &Pmin, &Pmax, FALSE);      /* Read bounding box */if (fn_begin_char(sp_globals.Psw, Pmin, Pmax))     /* Signal start of character output */	{	do    	{	    proc_outl_data(pointer);              /* Process outline data */    	}	while (!fn_end_char());                      /* Repeat if not done */	}return TRUE;}FUNCTION static boolean sp_make_comp_char(pointer)GDECLufix8 FONTFAR  *pointer;      /* Pointer to first byte of position argument *//* * Called by sp_make_char() to output a compound character. * Returns FALSE if data for any sub-character is not available. * Returns TRUE if output completed with no error. */{point_t  Pmin, Pmax;   /* Transformed corners of bounding box */point_t  Pssw;         /* Transformed escapement vector */ufix8 FONTFAR  *pointer_sav;  /* Saved pointer to compound character data */ufix8 FONTFAR  *sub_pointer;  /* Pointer to sub-character data */ufix8    format;       /* Format of DOCH instruction */ufix16   sub_char_index; /* Index to sub-character in character directory */fix15    x_posn;       /* X position of sub-character (outline res units) */fix15    y_posn;       /* Y position of sub-character (outline res units) */fix15    x_scale;      /* X scale factor of sub-character (scale units) */fix15    y_scale;      /* Y scale factor of sub-character (scale units) */fix15    tmpfix15;     /* Temporary workspace */fix15    x_orus;       /* Set width in outline resolution units */fix15    pix_adj;      /* Pixel adjustment to compound char bounding box */#if INCL_SQUEEZINGfix31    x_factor, x_offset, top_scale, bottom_scale;boolean  squeezed_x, squeezed_y;

⌨️ 快捷键说明

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