📄 do_trns.c
字号:
/* $XConsortium: do_trns.c,v 1.4 94/04/17 20:17:43 gildea Exp $ *//*Copyright 1989-1991, Bitstream Inc., Cambridge, MA.You are hereby granted permission under all Bitstream propriety rights touse, copy, modify, sublicense, sell, and redistribute the Bitstream Speedosoftware and the Bitstream Charter outline font for any purpose and withoutrestrictions; provided, that this notice is left intact on all copies of suchsoftware or font and that Bitstream's trademark is acknowledged as shown belowon all unmodified copies of such font.BITSTREAM CHARTER is a registered trademark of Bitstream Inc.BITSTREAM INC. DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDINGWITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE. BITSTREAM SHALL NOT BE LIABLE FOR ANY DIRECT OR INDIRECTDAMAGES, INCLUDING BUT NOT LIMITED TO LOST PROFITS, LOST DATA, OR ANY OTHERINCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTEDWITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT.*//**************************** D O _ T R N S . C ****************************** * * * This module is responsible for executing all intelligent transformation * * for bounding box and outline data * * * ****************************************************************************/#include "spdo_prv.h" /* General definitions for Speedo */#define DEBUG 0#if DEBUG#include <stdio.h>#define SHOW(X) printf("X = %d\n", X)#else#define SHOW(X)#endif/***** GLOBAL VARIABLES *****//***** GLOBAL FUNCTIONS *****//***** EXTERNAL VARIABLES *****//***** EXTERNAL FUNCTIONS *****//***** STATIC VARIABLES *****//***** STATIC FUNCTIONS *****/#if PROTOS_AVAILstatic void sp_split_curve(PROTO_DECL2 point_t P1,point_t P2,point_t P3,fix15 depth);static ufix8 FONTFAR *sp_get_args(PROTO_DECL2 ufix8 FONTFAR *pointer,ufix8 format,point_t STACKFAR *pP);#elsestatic void sp_split_curve(); /* Split Bezier curve into vectors */static ufix8 FONTFAR *sp_get_args(); /* Read X Y argument pair */#endifFUNCTION ufix8 FONTFAR *read_bbox(pointer, pPmin, pPmax, set_flag)GDECLufix8 FONTFAR *pointer; /* Pointer to next byte in char data */point_t STACKFAR *pPmin; /* Lower left corner of bounding box */point_t STACKFAR *pPmax; /* Upper right corner of bounding box */boolean set_flag; /* flag to indicate whether global oru bbox should be saved *//* * Called by make_simp_char() and make_comp_char() to read the * bounding box data from the font. * Sets Pmin and Pmax to the bottom left and top right corners * of the bounding box after transformation into device space. * The units of Pmin and Pmax are sub-pixels. * Updates *ppointer to point to the byte following the * bounding box data. */{ufix8 format1;ufix8 format;fix15 i;point_t P;sp_globals.x_int = 0;sp_globals.y_int = sp_globals.Y_int_org;sp_globals.x_orus = sp_globals.y_orus = 0;format1 = NEXT_BYTE(pointer);pointer = sp_get_args(pointer, format1, pPmin);#if INCL_SQUEEZING || INCL_ISWif (set_flag) { sp_globals.bbox_xmin_orus = sp_globals.x_orus; sp_globals.bbox_ymin_orus = sp_globals.y_orus; }#endif*pPmax = *pPmin;for (i = 1; i < 4; i++) { switch(i) { case 1: if (format1 & BIT6) /* Xmax requires X int zone 1? */ sp_globals.x_int++; format = (format1 >> 4) | 0x0c; break; case 2: if (format1 & BIT7) /* Ymax requires Y int zone 1? */ sp_globals.y_int++; format = NEXT_BYTE(pointer); break; case 3: sp_globals.x_int = 0; format >>= 4; break; default: break; } pointer = sp_get_args(pointer, format, &P);#if INCL_SQUEEZING || INCL_ISW if (set_flag && (i==2)) { sp_globals.bbox_xmax_orus = sp_globals.x_orus; sp_globals.bbox_ymax_orus = sp_globals.y_orus; }#endif if ((i == 2) || (!sp_globals.normal)) { if (P.x < pPmin->x) pPmin->x = P.x; if (P.y < pPmin->y) pPmin->y = P.y; if (P.x > pPmax->x) pPmax->x = P.x; if (P.y > pPmax->y) pPmax->y = P.y; } }#if DEBUGprintf("BBOX %6.1f(Xint 0), %6.1f(Yint 0), %6.1f(Xint %d), %6.1f(Yint %d)\n", (real)pPmin->x / (real)sp_globals.onepix, (real)pPmin->y / (real)sp_globals.onepix, (real)pPmax->x / (real)sp_globals.onepix, (format1 >> 6) & 0x01, (real)pPmax->y / (real)sp_globals.onepix, (format1 >> 7) & 0x01);#endifreturn pointer;}FUNCTION void proc_outl_data(pointer)GDECLufix8 FONTFAR *pointer; /* Pointer to next byte in char data *//* * Called by make_simp_char() and make_comp_char() to read the * outline data from the font. * The outline data is parsed, transformed into device coordinates * and passed to an output module for further processing. * Note that pointer is not updated to facilitate repeated * processing of the outline data when banding mode is in effect. */{ufix8 format1, format2;point_t P0, P1, P2, P3;fix15 depth;fix15 curve_count;sp_globals.x_int = 0;sp_globals.y_int = sp_globals.Y_int_org;#if INCL_PLAID_OUT /* Plaid data monitoring included? */record_xint((fix15)sp_globals.x_int); /* Record xint data */record_yint((fix15)(sp_globals.y_int - sp_globals.Y_int_org)); /* Record yint data */#endifsp_globals.x_orus = sp_globals.y_orus = 0;curve_count = 0;while(TRUE) { format1 = NEXT_BYTE(pointer); switch(format1 >> 4) { case 0: /* LINE */ pointer = sp_get_args(pointer, format1, &P1);#if DEBUG printf("LINE %6.1f, %6.1f\n", (real)P1.x / (real)sp_globals.onepix, (real)P1.y / (real)sp_globals.onepix);#endif fn_line(P1); sp_globals.P0 = P1; continue; case 1: /* Short XINT */ sp_globals.x_int = format1 & 0x0f;#if DEBUG printf("XINT %d\n", sp_globals.x_int);#endif#if INCL_PLAID_OUT /* Plaid data monitoring included? */record_xint((fix15)sp_globals.x_int); /* Record xint data */#endif continue; case 2: /* Short YINT */ sp_globals.y_int = sp_globals.Y_int_org + (format1 & 0x0f);#if DEBUG printf("YINT %d\n", sp_globals.y_int - sp_globals.Y_int_org);#endif#if INCL_PLAID_OUT /* Plaid data monitoring included? */record_yint((fix15)(sp_globals.y_int - sp_globals.Y_int_org)); /* Record yint data */#endif continue; case 3: /* Miscellaneous */ switch(format1 & 0x0f) { case 0: /* END */ if (curve_count) { fn_end_contour(); } return; case 1: /* Long XINT */ sp_globals.x_int = NEXT_BYTE(pointer);#if DEBUG printf("XINT %d\n", sp_globals.x_int);#endif#if INCL_PLAID_OUT /* Plaid data monitoring included? */record_xint((fix15)sp_globals.x_int); /* Record xint data */#endif continue; case 2: /* Long YINT */ sp_globals.y_int = sp_globals.Y_int_org + NEXT_BYTE(pointer);#if DEBUG printf("YINT %d\n", sp_globals.y_int - sp_globals.Y_int_org);#endif#if INCL_PLAID_OUT /* Plaid data monitoring included? */record_yint((fix15)(sp_globals.y_int - sp_globals.Y_int_org)); /* Record yint data */#endif continue; default: /* Not used */ continue; } case 4: /* MOVE Inside */ case 5: /* MOVE Outside */ if (curve_count++) { fn_end_contour();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -