📄 iface.c
字号:
if (pspecs->clip.right) /* Clip right requested? */ { mode |= BIT9; /* Set clip right flag */ }if (pspecs->clip.top) /* Clip top requested? */ { mode |= BIT10; /* Set clip top flag */ }if (pspecs->clip.bottom) /* Clip bottom requested? */ { mode |= BIT11; /* Set clip bottom flag */ }if (pspecs->squeeze.left) /* Squeeze left requested? */ { mode |= BIT12; /* Set squeeze left flag */ }if (pspecs->squeeze.right) /* Squeeze right requested? */ { mode |= BIT13; /* Set squeeze right flag */ }if (pspecs->squeeze.top) /* Squeeze top requested? */ { mode |= BIT14; /* Set squeeze top flag */ }if (pspecs->squeeze.bottom) /* Squeeze bottom requested? */ { mode |= BIT15; /* Set squeeze bottom flag */ }specsarg.flags = mode;sp_set_specs(&specsarg);}FUNCTION static fix31 make_mult(point_size, resolution)real point_size;real resolution;{real ms_factor;return (fix31)floor((point_size * resolution * 65536.0) / (real)PTPERINCH + 0.5);}FUNCTION bool fw_make_char(char_index)ufix16 char_index;{return sp_make_char(char_index);}FUNCTION buff_t *sp_load_char_data(file_offset, no_bytes, cb_offset)fix31 file_offset;fix15 no_bytes;fix15 cb_offset;/* * Called by Speedo character generator to request that character * data be loaded from the font file. * This is a dummy function that assumes that the entire font has * been loaded. */{#if DEBUGprintf("load_char_data(%d, %d, %d)\n", file_offset, no_bytes, char_offset);#endifchar_data.org = pfont->org + file_offset;char_data.no_bytes = no_bytes;return &char_data;}FUNCTION void sp_report_error(n)fix15 n; /* Error identification number *//* * Called by Speedo character generator to report an error. */{switch(n) {case 1: printf("Insufficient font data loaded\n"); break;case 3: printf("Transformation matrix out of range\n"); break;case 4: printf("Font format error\n"); break; case 5: printf("Requested specs not compatible with output module\n"); break;case 7: printf("Intelligent transformation requested but not supported\n"); break;case 8: printf("Unsupported output mode requested\n"); break;case 9: printf("Extended font loaded but only compact fonts supported\n"); break;case 10: printf("Font specs not set prior to use of font\n"); break;case 12: printf("Character data not available()\n"); break;case 13: printf("Track kerning data not available()\n"); break;case 14: printf("Pair kerning data not available()\n"); break;default: printf("report_error(%d)\n", n); break; }}FUNCTION void sp_open_bitmap(sw_x, sw_y, xorg, yorg, xsize, ysize)fix31 sw_x; /* X component of escapement vector */fix31 sw_y; /* Y component of escapement vector */fix31 xorg; /* X origin */fix31 yorg; /* Y origin */fix15 xsize; /* width of bitmap */fix15 ysize; /* height of bitmap *//* * Called by Speedo character generator to initialize a buffer prior * to receiving bitmap data. */{fix15 xmin,xmax,ymin,ymax;#if DEBUGprintf("sp_open_bitmap:\n");printf(" X component of set width vector = %3.1f\n", (real)sw_x / 65536.0);printf(" Y component of set width vector = %3.1f\n", (real)sw_y / 65536.0);printf(" Bounding box is (%d, %d, %d, %d)\n", xmin, ymin, xmax, ymax);#endifxmin = xorg >> 16;ymin = yorg >> 16;xmax = xmin + xsize;ymax = ymin + ysize;set_width_x = ((sw_x >> 15) + 1) >> 1;open_bitmap(set_width_x, xmin, xmax, ymin, ymax);}FUNCTION void sp_set_bitmap_bits(y, x1, x2)fix15 y, x1, x2;/* * Called by Speedo character generator to write one row of pixels * into the generated bitmap character. */{#if DEBUGprintf("set_bitmap_bits(%d, %d, %d)\n", y, x1, x2);#endifset_bitmap_bits(y, x1, x2);}FUNCTION void sp_close_bitmap()/* * Called by Speedo character generator to indicate all bitmap data * has been generated. */{#if DEBUGprintf("close_bitmap()\n");#endifclose_bitmap();}FUNCTION void sp_open_outline(sw_x, sw_y, xmin, xmax, ymin, ymax)fix31 sw_x; /* X component of escapement vector */fix31 sw_y; /* Y component of escapement vector */fix31 xmin; /* Minimum X value in outline */fix31 xmax; /* Maximum X value in outline */fix31 ymin; /* Minimum Y value in outline */fix31 ymax; /* Maximum Y value in outline *//* * Called by Speedo character generator to initialize prior to * outputting scaled outline data. */{#if DEBUGprintf("open_outline(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f)\n", (real)sw_x / 65536.0, (real)sw_y / 65536.0, (real)xmin / 65536.0, (real)xmax / 65536.0, (real)ymin / 65536.0, (real)ymax / 65536.0);#endifset_width_x = ((sw_x >> 15) + 1) >> 1;open_outline(set_width_x);}FUNCTION void sp_start_new_char()/* * Called by Speedo character generator to initialize prior to * outputting scaled outline data for a sub-character in a compound * character. */{#if DEBUGprintf("start_new_char()\n");#endifstart_new_char();}FUNCTION void sp_start_contour(x, y, outside)fix31 x; /* X coordinate of start point in 1/65536 pixels */fix31 y; /* Y coordinate of start point in 1/65536 pixels */boolean outside; /* TRUE if curve encloses ink (Counter-clockwise) *//* * Called by Speedo character generator at the start of each contour * in the outline data of the character. */{real realx, realy;realx = (real)x / 65536.0;realy = (real)y / 65536.0;#if DEBUGprintf("start_curve(%3.1f, %3.1f, %s)\n", realx, realy, outside? "outside": "inside");#endifstart_curve(realx, realy, outside);}FUNCTION void sp_curve_to(x1, y1, x2, y2, x3, y3)fix31 x1; /* X coordinate of first control point in 1/65536 pixels */fix31 y1; /* Y coordinate of first control point in 1/65536 pixels */fix31 x2; /* X coordinate of second control point in 1/65536 pixels */fix31 y2; /* Y coordinate of second control point in 1/65536 pixels */fix31 x3; /* X coordinate of curve end point in 1/65536 pixels */fix31 y3; /* Y coordinate of curve end point in 1/65536 pixels *//* * Called by Speedo character generator once for each curve in the * scaled outline data of the character. This function is only called if curve * output is enabled in the set_specs() call. */{#if DEBUGprintf("curve_to(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f)\n", (real)x1 / 65536.0, (real)y1 / 65536.0, (real)x2 / 65536.0, (real)y2 / 65536.0, (real)x3 / 65536.0, (real)y3 / 65536.0);#endif}FUNCTION void sp_line_to(x, y)fix31 x; /* X coordinate of vector end point in 1/65536 pixels */fix31 y; /* Y coordinate of vector end point in 1/65536 pixels *//* * Called by Speedo character generator onece for each vector in the * scaled outline data for the character. This include curve data that has * been sub-divided into vectors if curve output has not been enabled * in the set_specs() call. */{real realx, realy;realx = (real)x / 65536.0;realy = (real)y / 65536.0;#if DEBUGprintf("line_to(%3.1f, %3.1f)\n", realx, realy); #endif line_to(realx, realy);}FUNCTION void sp_close_contour()/* * Called by Speedo character generator at the end of each contour * in the outline data of the character. */{#if DEBUGprintf("close_curve()\n");#endifclose_curve();}FUNCTION void sp_close_outline()/* * Called by Speedo character generator at the end of output of the * scaled outline of the character. */{#if DEBUGprintf("close_outline()\n");#endifclose_outline(set_width_x);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -