/* the character, as opposed to just computing the side bearing and width. */ void gs_type1_finish_init(gs_type1_state * pcis) { gs_imager_state *pis = pcis->pis; const int max_coeff_bits = 11; /* max coefficient in char space */ /* Set up the fixed version of the transformation. */ gx_matrix_to_fixed_coeff(&ctm_only(pis), &pcis->fc, max_coeff_bits); /* Set the current point of the path to the origin, */ pcis->origin.x = pcis->path->position.x; pcis->origin.y = pcis->path->position.y; /* Initialize hint-related scalars. */ pcis->asb_diff = pcis->adxy.x = pcis->adxy.y = 0; pcis->base_lsb = 0; pcis->flex_count = flex_max; /* not in Flex */ pcis->vs_offset.x = pcis->vs_offset.y = 0; /* Compute the flatness needed for accurate rendering. */ pcis->flatness = gs_char_flatness(pis, 0.001); pcis->init_done = 1; }
/* The caller must supply a string to the first call of gs_type1_interpret. */ int gs_type1_init(register gs_type1_state *pis, gs_show_enum *penum, int charpath_flag, int paint_type, gs_type1_data *pdata) { gs_state *pgs = penum->pgs; pis->penum = penum; pis->pgs = pgs; pis->pdata = pdata; pis->charpath_flag = charpath_flag; pis->paint_type = paint_type; pis->os_count = 0; pis->ips_count = 1; pis->seac_base = -1; pis->in_dotsection = 0; pis->vstem3_set = 0; pis->vs_offset.x = pis->vs_offset.y = 0; reset_stem_hints(pis); gx_matrix_to_fixed_coeff(&ctm_only(pgs), &pis->fc, max_coeff_bits); compute_font_hints(&pis->fh, &pgs->ctm, pdata); /* Set the current point of the path to the origin, */ /* in anticipation of the initial [h]sbw. */ { gx_path *ppath = pgs->path; ppath->position.x = pgs->ctm.tx_fixed; ppath->position.y = pgs->ctm.ty_fixed; } /* Set the flatness to a value that is likely to produce */ /* reasonably good-looking curves, regardless of its */ /* current value in the graphics state. */ { /* If the character is very small, set the flatness */ /* to zero, which will produce very accurate curves. */ float cxx = pgs->ctm.xx, cyy = pgs->ctm.yy; if ( cxx < 0 ) cxx = -cxx; if ( cyy < 0 ) cyy = -cyy; if ( cyy > cxx ) cxx = cyy; if ( is_skewed(&pgs->ctm) ) { float cxy = pgs->ctm.xy, cyx = pgs->ctm.yx; if ( cxy < 0 ) cxy = -cxy; if ( cyx < 0 ) cyx = -cyx; if ( cxy > cxx ) cxx = cxy; if ( cyx > cxx ) cxx = cyx; } /* Now cxx is approximately one character space unit */ /* in device pixels. */ pis->flatness = (cxx >= 0.2 ? cxx : 0.0); } return 0; }