Exemple #1
0
/*
 * 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);
}
Exemple #2
0
/* a font may be scalable but we want to treat it a bitmap for the
   purpose of selection.  The internal lineprinter is the only example
   of this. */
static bool
font_is_scalable_selection_wise(const pl_font_t *fp)
{
    if (INTERNAL_LPFONT)
        return false;
    else
        return pl_font_is_scalable(fp);
}