/* * Update the HMI by recomputing it from the font. */ coord pcl_updated_hmi(pcl_state_t * pcs) { coord hmi; const pcl_font_selection_t *pfs = &(pcs->font_selection[pcs->font_selected]); int code = pcl_recompute_font(pcs, false); const pl_font_t *plfont = pcs->font; if (code < 0) return pcs->hmi_cp; /* bad news; don't mark the HMI as valid. */ /* we check for typeface == 0 here (lineprinter) because we frequently simulate lineprinter with a scalable truetype font */ if (pl_font_is_scalable(plfont) && plfont->params.typeface_family != 0) { if (plfont->params.proportional_spacing) /* Scale the font's pitch by the requested height. */ hmi = (coord) (pl_fp_pitch_cp(&plfont->params) / 10.0 * pfs->params.height_4ths / 4); else hmi = (coord) pl_fp_pitch_cp(&(pfs->params)); } else hmi = (coord) pl_fp_pitch_cp(&(plfont->params)); /* * Round to a multiple of the unit of measure (see the "PCL 5 Printer * LanguageTechnical Reference Manual", October 1992 ed., page 5-22. */ hmi = hmi + pcs->uom_cp / 2; return pcs->hmi_cp = hmi - (hmi % pcs->uom_cp); }
void dprint_font_params_t(const pl_font_params_t *pfp) { dprintf8("symset=%u %s pitch=%g ht=%u style=%u wt=%d face=%u:%u\n", pfp->symbol_set, (pfp->proportional_spacing ? "prop." : "fixed"), pl_fp_pitch_cp(pfp) / 100.0, pfp->height_4ths / 4, pfp->style, pfp->stroke_weight, pfp->typeface_family, (0x07FF &pfp->typeface_family) ); }