Пример #1
0
pdc_bool
pdf_get_metrics_pfm(
    PDF *p,
    pdf_font *font,
    const char *fontname,
    pdc_encoding enc,
    const char *filename,
    pdc_bool requested)
{
    static const char fn[] = "pdf_get_metrics_pfm";
    char fullname[PDC_FILENAMELEN];
    pdc_file *pfmfile;

    (void) fontname;

    /* open PFM file */
    pfmfile = pdc_fsearch_fopen(p->pdc, filename, fullname, "PFM ",
                                PDC_FILE_BINARY);
    if (pfmfile == NULL)
        return pdc_check_fopen_errmsg(p->pdc, requested);

    pdc_logg_cond(p->pdc, 1, trc_font,
        "\tLoading PFM metric fontfile \"%s\":\n", fullname);

    /* Read PFM metrics */
    if (!pdf_parse_pfm(p, pfmfile, font))
    {
        pdc_set_errmsg(p->pdc, PDF_E_FONT_CORRUPT, "PFM", fullname, 0, 0);
        return pdc_false;
    }

    /* save full filename */
    font->metricfilename = pdc_strdup_ext(p->pdc, fullname, 0, fn);

    /* Check encoding */
    if (!pdf_check_pfm_encoding(p, font, enc))
        return pdc_false;

    if (!pdf_make_fontflag(p, font))
        return pdc_false;

    return pdc_true;
}
Пример #2
0
pdc_bool
pdf_get_metrics_pfm(
    PDF *p,
    pdc_font *font,
    const char *fontname,
    pdc_encoding enc,
    const char *filename)
{
    pdc_file *pfmfile;

    /* open PFM file */
    pfmfile = pdf_fopen(p, filename, "PFM ", PDC_FILE_BINARY);
    if (pfmfile == NULL)
    {
	if (font->verbose_open)
	    pdc_error(p->pdc, -1, 0, 0, 0, 0);

        return pdc_false;
    }

    /* Read PFM metrics */
    if (!pdf_parse_pfm(p, pfmfile, font))
    {
	pdc_set_errmsg(p->pdc, PDF_E_FONT_CORRUPT, "PFM", filename, 0, 0);

        if (font->verbose == pdc_true)
	    pdc_error(p->pdc, -1, 0, 0, 0, 0);

        return pdc_false;
    }

    /* Check encoding */
    if (!pdf_check_pfm_encoding(p, font, fontname, enc))
        return pdc_false;

    if (!pdf_make_fontflag(p, font))
        return pdc_false;

    return pdc_true;
}