Back to index

tetex-bin  3.0
Classes | Defines | Typedefs | Functions | Variables
ptexlib.h File Reference
#include "pdftexd.h"
#include "ptexmac.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  key_entry
struct  enc_entry
struct  fm_entry
struct  ff_entry
struct  chardesc

Defines

#define EXTERN   extern

Typedefs

typedef short shalfword

Functions

integer get_fontfile_num (int)
integer get_fontname_num (int)
void epdf_free (void)
char * mk_basename (char *)
char * mk_exname (char *, int)
fm_entrylookup_fontmap (char *)
boolean hasfmentry (internalfontnumber)
internalfontnumber tfmoffm (fmentryptr)
void checkextfm (strnumber, integer)
void fm_free (void)
void fm_read_info (void)
ff_entrycheck_ff_exist (fm_entry *)
void pdfmapfile (integer)
void pdfmapline (integer)
integer myatodim (char **)
integer myatol (char **)
int readchar (boolean, chardesc *)
boolean str_eq_cstr (strnumber, char *)
char * makecstring (integer)
int xfflush (FILE *)
int xgetc (FILE *)
int xputc (int, FILE *)
scaled extxnoverd (scaled, scaled, scaled)
size_t xfwrite (void *, size_t size, size_t nmemb, FILE *)
strnumber getresnameprefix (void)
strnumber maketexstring (const char *)
integer fb_offset (void)
void fb_flush (void)
void fb_putchar (eightbits b)
void fb_seek (integer)
void libpdffinish (void)
void make_subset_tag (fm_entry *, char **)
void pdf_printf (const char *,...)
void pdf_puts (const char *)
void pdftex_fail (const char *,...)
void pdftex_warn (const char *,...)
void setjobid (int, int, int, int, int, int)
void tex_printf (const char *,...)
void writestreamlength (integer, integer)
char * convertStringToPDFString (char *in)
void printID (strnumber)
eightbits packetbyte (void)
integer newvfpacket (internalfontnumber)
void poppacketstate (void)
void pushpacketstate (void)
void startpacket (internalfontnumber, integer)
void storepacket (integer, integer, integer)
void vf_free (void)
boolean get_enc (fm_entry *)
boolean indexed_enc (fm_entry *)
enc_entryadd_enc (char *)
void enc_free (void)
void read_enc (enc_entry *)
void setcharmap (internalfontnumber)
void write_enc (char **, enc_entry *, integer)
void dopdffont (integer, internalfontnumber)
void update_enc (internalfontnumber, char **)
boolean checkimageb (integer)
boolean checkimagec (integer)
boolean checkimagei (integer)
boolean ispdfimage (integer)
integer epdforigx (integer)
integer epdforigy (integer)
integer imageheight (integer)
integer imagepages (integer)
integer imagewidth (integer)
integer imagexres (integer)
integer imageyres (integer)
integer readimage (strnumber, integer, strnumber, integer, integer, integer, integer)
void deleteimage (integer)
void img_free (void)
void updateimageprocset (integer)
void writeimage (integer)
boolean t1_read_enc (fm_entry *)
boolean t1_subset (char *, char *, unsigned char *)
void load_enc (char *, char **)
void writet1 (void)
void t1_free (void)
void writet3 (int, internalfontnumber)
scaled getpkcharwidth (internalfontnumber, scaled)
void writettf (void)
void writeotf (void)
void writezip (boolean)
void avlputobj (integer, integer)
integer avlfindobj (integer, integer, integer)

Variables

boolean fontfile_found
boolean is_otf_font
boolean true_dimen
boolean write_ttf_glyph_names
char ** t1_glyph_names
char * t1_builtin_glyph_names []
char * cur_file_name
const char notdef []
fm_entryfm_cur
integer t1_length1
integer t1_length2
integer t1_length3
integer ttf_length
internalfontnumber tex_font
key_entry font_keys []
strnumber last_tex_string
size_t last_ptr_index
char fontname_buf []

Class Documentation

struct key_entry

Definition at line 39 of file ptexlib.h.

Class Members
const char * pdfname
const char * t1name
boolean valid
float value
struct enc_entry

Definition at line 46 of file ptexlib.h.

Class Members
internalfontnumber firstfont
char ** glyph_names
boolean loaded
char * name
integer objnum
boolean updated
struct fm_entry

Definition at line 57 of file ptexlib.h.

Collaboration diagram for fm_entry:
Class Members
boolean all_glyphs
char * charset
enc_entry * encoding
short extend
integer fd_objnum
char * ff_name
integer ff_objnum
integer flags
integer fn_objnum
unsigned short links
char * ps_name
short slant
char * subset_tag
short tfm_avail
char * tfm_name
internalfontnumber tfm_num
unsigned short type
struct ff_entry

Definition at line 77 of file ptexlib.h.

Class Members
char * ff_name
char * ff_path
struct chardesc

Definition at line 54 of file pkin.h.

Class Members
integer charcode
integer cheight
integer cwidth
halfword * raster
integer rastersize
integer xescape
integer xoff
integer yoff

Define Documentation

#define EXTERN   extern

Definition at line 31 of file ptexlib.h.


Typedef Documentation

typedef short shalfword

Definition at line 82 of file ptexlib.h.


Function Documentation

enc_entry* add_enc ( char *  )

Definition at line 104 of file writeenc.c.

{                           /* built-in encodings have s == NULL */
    int i;
    enc_entry *enc_ptr, etmp;
    static encstruct *ep;   /* pointer into linked list of encodings */
    void **aa;

    if (enc_tree == NULL) {
       enc_tree = avl_create(comp_enc_entry, NULL, &avl_xallocator);
       assert(enc_tree != NULL);
    }
    if (s != NULL) {
       etmp.name = s;
       enc_ptr = (enc_entry *) avl_find(enc_tree, &etmp);
       if (enc_ptr != NULL) /* encoding already registered */
           return enc_ptr;
    }
    if (epstart == NULL) {
       epstart = xtalloc(1, encstruct);
       ep = epstart;
    } else {
       ep->next = xtalloc(1, encstruct);
       ep = ep->next;
    }
    ep->next = NULL;
    enc_ptr = &(ep->entry);
    if (s != NULL) {
       enc_ptr->name = xstrdup(s);
       aa = avl_probe(enc_tree, enc_ptr);
       assert(aa != NULL);
    } else
       enc_ptr->name = NULL;
    enc_ptr->loaded = false;
    enc_ptr->updated = false;
    enc_ptr->firstfont = getnullfont();
    enc_ptr->objnum = 0;
    enc_ptr->glyph_names = xtalloc(MAX_CHAR_CODE + 1, char *);
    for (i = 0; i <= MAX_CHAR_CODE; i++)
       enc_ptr->glyph_names[i] = (char *) notdef;

    return enc_ptr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 113 of file avlstuff.c.

{
    static objentry *p;
    static objentry tmp;

    if (byname > 0)
        tmp.int0 = -i;
    else
        tmp.int0 = i;
    if (PdfObjTree[t] == NULL)
        return 0;
    p = (objentry *) avl_find(PdfObjTree[t], &tmp);
    if (p == NULL)
        return 0;
    else
        return (int) (p - (objentry *) objtab);
}

Here is the call graph for this function:

void avlputobj ( integer  ,
integer   
)

Definition at line 96 of file avlstuff.c.

{
    static void **pp;

    if (PdfObjTree[t] == NULL) {
        PdfObjTree[t] = avl_create(compare_info, NULL, &avl_xallocator);
        if (PdfObjTree[t] == NULL)
            pdftex_fail("avlstuff.c: avl_create() PdfObjTree failed");
    }
    pp = avl_probe(PdfObjTree[t], &(objtab[objptr]));
    if (pp == NULL)
        pdftex_fail("avlstuff.c: avl_probe() out of memory in insertion");
}

Here is the call graph for this function:

Definition at line 654 of file mapfile.c.

{
    ff_entry *ff;
    ff_entry tmp;
    char *ex_ffname;
    void **aa;

    assert(fm->ff_name != NULL);
    tmp.ff_name = fm->ff_name;
    ff = (ff_entry *) avl_find(ff_tree, &tmp);
    if (ff == NULL) {                /* not yet in database */
        ff = new_ff_entry();
        ff->ff_name = xstrdup(fm->ff_name);
        if (is_truetype(fm))
            ff->ff_path =
                kpse_find_file(fm->ff_name, kpse_truetype_format, 0);
        else
            ff->ff_path =
                kpse_find_file(fm->ff_name, kpse_type1_format, 0);
        aa = avl_probe(ff_tree, ff);
        assert(aa != NULL);
    }
    return ff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void checkextfm ( strnumber  ,
integer   
)

Definition at line 90 of file writeimg.c.

{
    return procset & IMAGE_COLOR_B;
}

Definition at line 95 of file writeimg.c.

{
    return procset & IMAGE_COLOR_C;
}

Definition at line 100 of file writeimg.c.

{
    return procset & IMAGE_COLOR_I;
}
char* convertStringToPDFString ( char *  in)

Definition at line 393 of file utils.c.

{
    static char pstrbuf[MAX_PSTRING_LEN];
    char *out = pstrbuf;
    int lin = strlen (in);
    int i, j;
    char buf[4];
    j = 0;
    for (i = 0; i < lin; i++) {
        check_buf(j + sizeof(buf), MAX_PSTRING_LEN);
        if ((unsigned char)in[i] < ' ') {
            /* convert control characters into hex */
            sprintf (buf, "#%02x", (unsigned int)(unsigned char)in[i]);
            out[j++] = buf[0];
            out[j++] = buf[1];
            out[j++] = buf[2];
            }
        else if ((in[i] == '(') || (in[i] == ')')) {
            /* escape paranthesis */
            out[j++] = '\\';
            out[j++] = in[i];
            }
        else if (in[i] == '\\') {
            /* escape backslash */
            out[j++] = '\\';
            out[j++] = '\\';
            }
        else {
            /* copy char :-) */
            out[j++] = in[i];
            }
        }
    out[j] = '\0';
    return pstrbuf;
}

Here is the call graph for this function:

Definition at line 341 of file writeimg.c.

{
    switch (img_type(img)) {
    case IMAGE_TYPE_PDF:
        epdf_doc = pdf_ptr(img)->doc;
        epdf_delete();
        break;
    case IMAGE_TYPE_PNG:
        xfclose(png_ptr(img)->io_ptr, cur_file_name);
        png_destroy_read_struct(&(png_ptr(img)), &(png_info(img)), NULL);
        break;
    case IMAGE_TYPE_JPG:
        xfclose(jpg_ptr(img)->file, cur_file_name);
        break;
    default:
        pdftex_fail("unknown type of image");
    }
    xfree(img_name(img));
    return;
}

Here is the call graph for this function:

void dopdffont ( integer  ,
internalfontnumber   
)

Definition at line 280 of file writefont.c.

{
    int i;
    tex_font = f;
    cur_glyph_names = NULL;
    encoding_objnum = 0;
    write_ttf_glyph_names = false;
    write_fontfile_only = false;
    if (pdffontmap[tex_font] == NULL)
        pdftex_fail("pdffontmap not initialized for font %s", 
                    makecstring(fontname[tex_font]));
    if (hasfmentry(tex_font))
        fm_cur = (fm_entry *) pdffontmap[tex_font];
    else
        fm_cur = NULL;
    if (fm_cur == NULL || (fm_cur->ps_name == NULL && fm_cur->ff_name == NULL)) {
        writet3(font_objnum, tex_font);
        return;
    }

    get_char_widths(); /* update char widths; also check whether this font is
                          used in embedded PDF only; if so then set
                          write_fontfile_only to true */

    if (!write_fontfile_only) { /* encoding vector needed */
        if ((is_reencoded(fm_cur))) {
            read_enc(fm_cur->encoding);
            if (!is_truetype(fm_cur)) {
                write_enc(NULL, fm_cur->encoding, 0);
                encoding_objnum = (fm_cur->encoding)->objnum;
            }
            else
                write_ttf_glyph_names = true;
        }
        else if (is_fontfile(fm_cur) && !is_truetype(fm_cur)) {
            encoding_objnum = pdfnewobjnum();
        }
    }
    if (is_included(fm_cur))
        write_fontfile();
    if (fm_cur->fn_objnum != 0) {
        pdfbeginobj(fm_cur->fn_objnum);
        write_fontname(false);
        pdfendobj();
    }
    if (!write_fontfile_only)
        write_fontobj(font_objnum);
    if (is_basefont(fm_cur) && !is_included(fm_cur))
        return;
    if (!write_fontfile_only) {
        write_fontdescriptor();
        write_char_widths();
    }
    if (cur_glyph_names == t1_builtin_glyph_names) {
        if (!write_fontfile_only) {
            for (i = 0; i <= MAX_CHAR_CODE; i++)
                if (!pdfcharmarked(tex_font, i) && cur_glyph_names[i] != notdef) {
                    xfree(cur_glyph_names[i]);
                    cur_glyph_names[i] = (char*) notdef;
                }
            write_enc(cur_glyph_names, NULL, encoding_objnum);
        }
        for (i = 0; i <= MAX_CHAR_CODE; i++)
            if (cur_glyph_names[i] != notdef)
                xfree(cur_glyph_names[i]);
    }
}

Here is the call graph for this function:

Definition at line 227 of file writeenc.c.

{
    int k;
    encstruct *p, *pn;
    enc_entry *e;

    for (p = epstart; p != NULL; p = pn) {
       e = &(p->entry);
       pn = p->next;
       xfree(e->name);
       if (e->loaded)              /* encoding has been loaded */
           for (k = 0; k <= MAX_CHAR_CODE; k++)
              if (e->glyph_names[k] != notdef)
                  xfree(e->glyph_names[k]);
       xfree(e->glyph_names);
       xfree(p);
    }
    if (enc_tree != NULL)
       avl_destroy(enc_tree, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 74 of file epdf.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 110 of file writeimg.c.

{
    return pdf_ptr(img)->orig_x;
}

Definition at line 115 of file writeimg.c.

{
    return pdf_ptr(img)->orig_y;
}
scaled extxnoverd ( scaled  ,
scaled  ,
scaled   
)

Definition at line 364 of file utils.c.

{
    double r = (((double)x)*((double)n))/((double)d);
    if (r > 0)
        r += 0.5;
    else
        r -= 0.5;
    if (r >= (double)maxinteger || r <= -(double)maxinteger)
        pdftex_warn("arithmetic: number too big");
    return r;
}

Here is the call graph for this function:

Definition at line 69 of file utils.c.

{
    fb_entry *p;
    integer n;
    for (p = fb_array; p < fb_ptr;) {
        n = pdfbufsize - pdfptr;
        if (fb_ptr - p < n)
            n = fb_ptr - p;
        memcpy(pdfbuf + pdfptr, p, (unsigned)n);
        pdfptr += n;
        if (pdfptr == pdfbufsize)
            pdfflush();
        p += n;
    }
    fb_ptr = fb_array;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 53 of file utils.c.

{
    return fb_ptr - fb_array;
}

Here is the caller graph for this function:

Definition at line 63 of file utils.c.

{
    alloc_array(fb, 1, SMALL_ARRAY_SIZE);
    *fb_ptr++ = b;
}

Definition at line 58 of file utils.c.

{
     fb_ptr = fb_array + offset;
}
void fm_free ( void  )

Definition at line 984 of file mapfile.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 503 of file mapfile.c.

{
    mapitem *tmp;
    create_avl_trees();
    while (mapitems != NULL) {
        assert(mapitems->line != NULL);
        switch (mapitems->type) {
        case MAPFILE:
            set_cur_file_name(mapitems->line);
            if (!fm_open()) {
                pdftex_warn("cannot open font map file");
            } else {
                cur_file_name = (char *) nameoffile + 1;
                tex_printf("{%s", cur_file_name);
                while (!fm_eof())
                    fm_scan_line(mapitems);
                fm_close();
                tex_printf("}");
                fm_file = NULL;
            }
            break;
        case MAPLINE:
            cur_file_name = NULL;        /* makes pdftex_warn() shorter */
            fm_scan_line(mapitems);
            break;
        default:
            assert(0);
        }
        tmp = mapitems;
        mapitems = mapitems->next;
        xfree(tmp->line);
        xfree(tmp);
    }
    cur_file_name = NULL;
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 154 of file writeenc.c.

{
    int i;
    char **glyph_names;
    if (is_reencoded(fm)) { /* external encoding vector available */
        read_enc(fm->encoding);
        return true;
    }
    if (!is_t1fontfile(fm)) /* get built-in encoding for T1 fonts only */
        return false;
    if (t1_read_enc(fm)) { /* encoding read into t1_builtin_glyph_names */
        fm->encoding = add_enc(NULL);
        glyph_names = (fm->encoding)->glyph_names;
        for (i = 0; i <= MAX_CHAR_CODE; i++)
            glyph_names[i] = t1_builtin_glyph_names[i];
        (fm->encoding)->loaded = true;
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

scaled getpkcharwidth ( internalfontnumber  ,
scaled   
)

Definition at line 174 of file writet3.c.

{
    return (get_pk_font_scale(f)/100000.0)*
           (pk_char_width(f, w)/100.0)*
           pdffontsize[f];
}

Here is the call graph for this function:

strnumber getresnameprefix ( void  )

Definition at line 303 of file utils.c.

{
/*     static char name_str[] = */
/* "!\"$&'*+,-.0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\" */
/* "^_`abcdefghijklmnopqrstuvwxyz|~"; */
    static char name_str[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    char prefix[7]; /* make a tag of 6 chars long */
    unsigned long crc;
    int i, base = strlen(name_str);
    crc = crc32(0L, Z_NULL, 0);
    crc = crc32(crc, (Bytef*)job_id_string, strlen(job_id_string));
    for (i = 0; i < 6; i++) {
        prefix[i] = name_str[crc % base];
        crc /= base;
    }
    prefix[6] = 0;
    return maketexstring(prefix);
}

Here is the call graph for this function:

boolean hasfmentry ( internalfontnumber  )

Definition at line 165 of file mapfile.c.

{
    if (pdffontmap[f] == NULL)
        pdffontmap[f] = fmlookup(f);
    assert(pdffontmap[f] != NULL);
    return pdffontmap[f] != (fmentryptr) dummy_fm_entry();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 70 of file writeimg.c.

{
    return img_height(img);
}

Definition at line 120 of file writeimg.c.

{
    return img_pages(img);
}

Definition at line 65 of file writeimg.c.

{
    return img_width(img);
}

Definition at line 75 of file writeimg.c.

{
    return img_xres(img);
}

Definition at line 80 of file writeimg.c.

{
    return img_yres(img);
}

Definition at line 362 of file writeimg.c.

{
    xfree(image_array);
}

Here is the caller graph for this function:

Definition at line 85 of file writeimg.c.

{
    return img_type(img) == IMAGE_TYPE_PDF;
}

Definition at line 376 of file utils.c.

{
    xfree(fb_array);
    xfree(char_array);
    xfree(job_id_string);
    fm_free();
    t1_free();
    enc_free();
    img_free();
    vf_free();
    epdf_free();
}

Here is the call graph for this function:

void load_enc ( char *  ,
char **   
)

Definition at line 351 of file writet1.c.

{
    char buf[ENC_BUF_SIZE], *p, *r;
    int names_count;
    set_cur_file_name(enc_name);
    if (!enc_open()) {
        pdftex_warn("cannot open encoding file for reading");
        cur_file_name = NULL;
        return;
    }
    t1_log("{");
    t1_log(cur_file_name = full_file_name());
    enc_getline();
    if (*enc_line != '/' || (r = strchr(enc_line, '[')) == NULL) {
        remove_eol(r, enc_line);
        pdftex_fail("invalid encoding vector (a name or `[' missing): `%s'", enc_line);
    }
    names_count = 0;
    r++; /* skip '[' */
    skip(r, ' ');
    for (;;) {
        while (*r == '/') {
            for (p = buf, r++; *r != ' ' && *r != 10 && *r != ']' && *r != '/'; *p++ = *r++);
            *p = 0;
            skip(r, ' ');
            if (names_count > MAX_CHAR_CODE)
                pdftex_fail("encoding vector contains more than %i names",
                            (int)(MAX_CHAR_CODE + 1));
            if (strcmp(buf, notdef) != 0)
                glyph_names[names_count] = xstrdup(buf);
            names_count++;
        }
        if (*r != 10 && *r != '%') {
            if (strncmp(r, "] def", strlen("] def")) == 0) 
                goto done;
            else {
                remove_eol(r, enc_line);
                pdftex_fail("invalid encoding vector: a name or `] def' expected: `%s'", enc_line);
            }
        }
        enc_getline();
        r = enc_line;
    }
done:
    enc_close();
    t1_log("}");
    cur_file_name = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

fm_entry* lookup_fontmap ( char *  ) [read]

Definition at line 824 of file mapfile.c.

{
    fm_entry *fm, *fmx;
    fm_entry tmp, tmpx;
    ff_entry *ff;
    char buf[SMALL_BUF_SIZE];
    char *a, *b, *c, *d, *e, *s;
    strnumber str;
    int i, sl, ex, ai;
    if (tfm_tree == NULL || mapitems != NULL)
        fm_read_info();
    if (bname == NULL)
        return dummy_fm_entry();
    if (strlen(bname) >= SMALL_BUF_SIZE)
        pdftex_fail("Font name too long: `%s'", bname);
    strcpy(buf, bname);         /* keep bname untouched for later */
    s = buf; 
    if (strlen(buf) > 7) {        /* check for subsetted name tag */
        for (i = 0; i < 6; i++, s++)
            if (*s < 'A' || *s > 'Z')
                break;
        if (i == 6 && *s == '+')
            s++;                /* if name tag found, skip behind it */
        else
            s = buf;
    }

    /*
       Scan -Slant_<slant> and -Extend_<extend> font name extensions;
       three valid formats:
       <fontname>-Slant_<slant>
       <fontname>-Slant_<slant>-Extend_<extend>
       <fontname>-Extend_<extend>
       Slant entry must come _before_ Extend entry
     */

    tmp.slant = 0;
    tmp.extend = 0;
    if ((a = strstr(s, "-Slant_")) != NULL) {
        b = a + strlen("-Slant_");
        sl = (int) strtol(b, &e, 10);
        if ((e != b) && (e == strend(b))) {
            tmp.slant = sl;
            *a = 0;                /* bname string ends before "-Slant_" */
        } else {
            if (e != b) {        /* only if <slant> is valid number */
                if ((c = strstr(e, "-Extend_")) != NULL) {
                    d = c + strlen("-Extend_");
                    ex = (int) strtol(d, &e, 10);
                    if ((e != d) && (e == strend(d))) {
                        tmp.slant = sl;
                        tmp.extend = ex;
                        *a = 0;        /* bname string ends before "-Slant_" */
                    }
                }
            }
        }
    } else {
        if ((a = strstr(s, "-Extend_")) != NULL) {
            b = a + strlen("-Extend_");
            ex = (int) strtol(b, &e, 10);
            if ((e != b) && (e == strend(b))) {
                tmp.extend = ex;
                *a = 0;                /* bname string ends before "-Extend_" */
            }
        }
    }
    tmp.ps_name = s;
    tmp.tfm_name = NULL;
    fm = lookup_ps_name(&tmp);
    if (fm != NULL) {
        i = fm->tfm_num;
        assert(i != getnullfont());
        if (pdffontmap[i] == NULL)
            pdffontmap[i] = (fmentryptr) fm;
        if (fm->ff_objnum == 0 && is_included(fm))
            fm->ff_objnum = pdfnewobjnum();
        if (!fontused[i])
            pdfinitfont(i);
        return fm;
    }
/*
   The following code snipplet handles fonts with "Slant" and "Extend"
   name extensions in embedded PDF files, which don't yet have an
   fm_entry. If such a font is found (e. g. CMR10-Extend_1020), and no
   fm_entry for this is found in the ps_tree (e. g. ps_name = "CMR10",
   extend = 1020), and if an unextended base font (e. g. CMR10) is found,
   a new <nontfm> fm_entry is created and put into the ps_tree. Then
   the lookup_fontmap() function is (recursively) called again, which
   then should find the new fm_entry. The same can be done manually by
   a map entry e. g.:

   \pdfmapline{+<nontfm> CMR10 "1.02 ExtendFont" <cmr10.pfb}

   This would also match the embedded font CMR10-Extend_1020, and replace
   it by an extended copy of cmr10.pfb. -- But not by an expanded version;
   no MM files (e.g. cmr10+20.pfb) would be used.
*/

    tmpx.ps_name = s;
    tmpx.tfm_name = NULL;
    tmpx.slant = 0;
    tmpx.extend = 0;
/*     fm = (fm_entry *) avl_find(ps_tree, &tmpx); */
    fm = lookup_ps_name(&tmpx);
    if (fm != NULL) {
        if (is_truetype(fm) || !is_included(fm))
            return dummy_fm_entry();
        ff = check_ff_exist(fm);
        if (ff->ff_path == NULL)
            return dummy_fm_entry();
        fmx = new_fm_entry();
        fmx->flags = fm->flags;
        fmx->encoding = fm->encoding;
        fmx->type = fm->type;
        fmx->slant = tmp.slant;
        fmx->extend = tmp.extend;
        fmx->tfm_name = xstrdup(nontfm);
        fmx->ps_name = xstrdup(s);
        fmx->ff_name = xstrdup(fm->ff_name);
        ai = avl_do_entry(fmx, FM_DUPIGNORE);
        assert(ai == 0);
        fm = lookup_fontmap(bname);        /* new try */
        assert(fm != NULL);
        return fm;
    }
    return dummy_fm_entry();
}

Here is the call graph for this function:

void make_subset_tag ( fm_entry ,
char **   
)

Definition at line 94 of file utils.c.

{
    char tag[7];
    unsigned long crc;
    int i, l = strlen(job_id_string) + 1;
    alloc_array(char, l, SMALL_ARRAY_SIZE);
    strcpy(char_array, job_id_string);
    char_ptr = strend(char_array);
    if (fm_cur->tfm_name != NULL) {
        fnstr_append(" TFM name: ");
        fnstr_append(fm_cur->tfm_name);
    }
    fnstr_append(" PS name: ");
    if (font_keys[FONTNAME_CODE].valid)
        fnstr_append(fontname_buf);
    else if (fm_cur->ps_name != NULL)
        fnstr_append(fm_cur->ps_name);
    fnstr_append(" Encoding: ");
    if (fm_cur->encoding != NULL && (fm_cur->encoding)->name != NULL)
        fnstr_append((fm_cur->encoding)->name);
    else
        fnstr_append("built-in");
    fnstr_append(" CharSet: ");
    assert(glyph_names != NULL);
    for (i = 0; i <= MAX_CHAR_CODE; i++)
        if (pdfcharmarked(tex_font, i) && glyph_names[i] != notdef) {
            fnstr_append(" /");
            fnstr_append(glyph_names[i]);
        }
    if (fm_cur->charset != NULL) {
        fnstr_append(" Extra CharSet: ");
        fnstr_append(fm_cur->charset);
    }
    crc = crc32(0L, Z_NULL, 0);
    crc = crc32(crc, (Bytef*)char_array, strlen(char_array));
    /* we need to fit a 32-bit number into a string of 6 uppercase chars long;
     * there are 26 uppercase chars ==> each char represents a number in range
     * 0..25. The maximal number that can be represented by the tag is
     * 26^6 - 1, which is a number between 2^28 and 2^29. Thus the bits 29..31
     * of the CRC must be dropped out.
     */
    for (i = 0; i < 6; i++) {
        tag[i] = 'A' + crc % 26;
        crc /= 26;
    }
    tag[6] = 0;
    fm_cur->subset_tag = xstrdup(tag);
}

Here is the call graph for this function:

char* makecstring ( integer  )

Definition at line 233 of file utils.c.

{
    static char cstrbuf[MAX_CSTRING_LEN];
    char *p = cstrbuf;
    int i, l = strstart[s + 1] - strstart[s];
    check_buf(l + 1, MAX_CSTRING_LEN);
    for (i = 0; i < l; i++)
        *p++ = strpool[i + strstart[s]];
    *p = 0;
    return cstrbuf;
}

Here is the caller graph for this function:

strnumber maketexstring ( const char *  )

Definition at line 159 of file utils.c.

{
    int l;
    if (s == NULL || *s == 0)
        return getnullstr();
    l = strlen(s);
    check_buf(poolptr + l, poolsize);
    while (l-- > 0)
        strpool[poolptr++] = *s++;
    last_tex_string = makestring();
    return last_tex_string;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* mk_basename ( char *  )
char* mk_exname ( char *  ,
int   
)
integer myatodim ( char **  )

Definition at line 40 of file papersiz.c.

{ 
  double tmp; /* double accuracy is enough, I think */
  int i=0;

  tmp = strtod(*p,p);
  while (**p == ' ') 
    (*p)++;
  while (i<8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1]))
    i++; 
  if (i==8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1]))
    Warning("Unrecognized length unit \"%.2s\", assuming inches.",*p);
  while (**p != ',' && **p !='\0')
    (*p)++;
  tmp *= lengthsp[i]*dpi/4736286L; /* convert sp to pixels */
  return((int32_t) tmp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

integer myatol ( char **  )
integer newvfpacket ( internalfontnumber  )

Definition at line 45 of file vfpacket.c.

{
    int i,
        n = fontec[f] - fontbc[f] + 1;
    alloc_array(vf, 1, SMALL_ARRAY_SIZE);
    vf_ptr->len = xtalloc(n, int);
    vf_ptr->data = xtalloc(n, char *);
    for (i = 0; i < n; i++) {
        vf_ptr->data[i] = NULL;
        vf_ptr->len[i] = 0;
    }
    vf_ptr->font = f;
    return vf_ptr++ - vf_array;
}

Definition at line 94 of file vfpacket.c.

{
    vfpacketlength--;
    return *packet_data_ptr++;
}
void pdf_printf ( const char *  ,
  ... 
)

Definition at line 150 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    vsprintf(print_buf, fmt, args);
    pdf_puts(print_buf);                                    
    va_end(args);
}

Here is the call graph for this function:

void pdf_puts ( const char *  )

Definition at line 143 of file utils.c.

{
    pdfroom(strlen(s) + 1);
    while (*s)
        pdfbuf[pdfptr++] = *s++;
}

Here is the call graph for this function:

Definition at line 1061 of file mapfile.c.

{
    add_map_item(makecstring(tokenstostring(t)), MAPFILE);
    flushstr(lasttokensstring);
}

Here is the call graph for this function:

Definition at line 1067 of file mapfile.c.

{
    add_map_item(makecstring(tokenstostring(t)), MAPLINE);
    flushstr(lasttokensstring);
}

Here is the call graph for this function:

void pdftex_fail ( const char *  ,
  ... 
)

Definition at line 195 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    println();
    safe_print("Error: ");
    safe_print(program_invocation_name);
    if (cur_file_name) {
        safe_print(" (file ");
        safe_print(cur_file_name);
        safe_print(")");
    }
    safe_print(": ");
    vsprintf(print_buf, fmt, args);
    safe_print(print_buf);
    va_end(args);
    println();
    safe_print(" ==> Fatal error occurred, the output PDF file is not finished!");
    println();
    exit(-1);
}

Here is the call graph for this function:

void pdftex_warn ( const char *  ,
  ... 
)

Definition at line 217 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    println();
    tex_printf("Warning: %s", program_invocation_name);
    if (cur_file_name)
        tex_printf(" (file %s)", cur_file_name);
    tex_printf(": ");
    vsprintf(print_buf, fmt, args);
    print(maketexstring(print_buf));
    flushstr(last_tex_string);
    va_end(args);
    println();
}

Here is the call graph for this function:

Definition at line 78 of file vfpacket.c.

{
    if (packet_ptr == packet_array)
        pdftex_fail("packet stack empty, impossible to pop");
    packet_ptr--;
    f = packet_ptr->font;
    packet_data_ptr = packet_ptr->dataptr;
    vfpacketlength = packet_ptr->len;
}
void printID ( strnumber  )

Definition at line 479 of file utils.c.

{
    time_t t;
    size_t size;
    char time_str[32];
    md5_state_t state;
    md5_byte_t digest[16];
    char id[64];
    char *file_name;
    char pwd[4096];
    /* start md5 */
    md5_init(&state);
    /* get the time */
    t = time(NULL);
    size = strftime (time_str, sizeof(time_str), "%Y%m%dT%H%M%SZ", gmtime(&t));
    md5_append(&state, (const md5_byte_t *)time_str, size);
    /* get the file name */
    if (getcwd(pwd, sizeof(pwd)) == NULL)
        pdftex_fail("getcwd() failed (path too long?)");
    file_name = makecstring(filename);
    md5_append(&state, (const md5_byte_t *)pwd, strlen(pwd));
    md5_append(&state, (const md5_byte_t *)"/", 1);
    md5_append(&state, (const md5_byte_t *)file_name, strlen(file_name));
    /* finish md5 */
    md5_finish(&state, digest);
    /* write the IDs */
    convertStringToHexString ((char*)digest, id, 16);
    pdf_printf("/ID [%s %s]\n", id, id);
}

Here is the call graph for this function:

Definition at line 69 of file vfpacket.c.

{
    alloc_array(packet, 1, SMALL_ARRAY_SIZE);
    packet_ptr->font = f;
    packet_ptr->dataptr = packet_data_ptr;
    packet_ptr->len = vfpacketlength;
    packet_ptr++;
}

Definition at line 29 of file writeenc.c.

{
    assert(e != NULL);
    if (e->loaded)
        return;
    load_enc(e->name, e->glyph_names);
    e->loaded = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int readchar ( boolean  ,
chardesc  
)

Definition at line 333 of file pkin.c.

{
   register shalfword i ;
   register integer k ;
   register integer length=0 ;

/*
 *   Check the preamble of the pkfile
 */
   if (check_preamble) {
       if (pkbyte()!=247)
          pdftex_fail("bad pk file, expected pre") ;
       if (pkbyte()!=89)
          pdftex_fail("bad version of pk file") ;
       for(i=pkbyte(); i>0; i--) /* creator of pkfile */
          (void)pkbyte() ;   
       (void)pkquad(); /* design size */
       k = pkquad() ;  /* checksum    */
       k = pkquad() ;  /* hppp        */
       k = pkquad() ;  /* vppp   */
   }
/*
 *   Now we skip to the desired character definition
 */
   while ((flagbyte=pkbyte())!=245) {
      if (flagbyte < 240) {
         switch (flagbyte & 7) {
case 0: case 1: case 2: case 3:
            length = (flagbyte & 7) * 256 + pkbyte() - 3;
            cd->charcode = pkbyte() ;
            (void) pktrio() ;  /* TFMwidth */
            cd->xescape = pkbyte() ;      /* pixel width */
            cd->cwidth = pkbyte() ;
            cd->cheight = pkbyte() ;
            cd->xoff = pkbyte() ;
            cd->yoff = pkbyte() ;
            if (cd->xoff > 127)
               cd->xoff -= 256 ;
            if (cd->yoff > 127)
               cd->yoff -= 256 ;
            break ;
case 4: case 5: case 6:
            length = (flagbyte & 3) * 65536L + pkbyte() * 256L ;
            length = length + pkbyte() - 4L ;
            cd->charcode = pkbyte() ;
            (void) pktrio() ;           /* TFMwidth */
            cd->xescape  = pkduo() ;      /* pixelwidth */
            cd->cwidth = pkduo() ;
            cd->cheight = pkduo() ;
            cd->xoff = pkduo() ;
            cd->yoff = pkduo() ;
            break ;
case 7:
            length = pkquad() - 9L;
            cd->charcode = pkquad();
            (void) pkquad() ;  /* TFMwidth */
            cd->xescape =  pkquad();      /* pixelwidth */
            k = pkquad() ;
            cd->cwidth = pkquad();
            cd->cheight = pkquad();
            cd->xoff = pkquad();
            cd->yoff = pkquad();
         }
         if (length <= 0)
            pdftex_fail("packet length (%i) too small", (int)length) ;
         unpack(cd);
         return 1;
      } else {
         k = 0 ;
         switch (flagbyte) {
case 243:
            k = pkbyte() ;
            if (k > 127)
               k -= 256 ;
case 242:
            k = k * 256 + pkbyte() ;
case 241:
            k = k * 256 + pkbyte() ;
case 240:
            k = k * 256 + pkbyte() ;
            while (k-- > 0)
               i = pkbyte() ;
            break ;
case 244:
            k = pkquad() ;
            break ;
case 246:
            break ;
default:
            pdftex_fail("unexpected command (%i)", (int)flagbyte) ;
         }
      }
   }
   return 0; /* character not found */
}

Here is the call graph for this function:

integer readimage ( strnumber  ,
integer  ,
strnumber  ,
integer  ,
integer  ,
integer  ,
integer   
)

Definition at line 250 of file writeimg.c.

{
    char *dest = NULL;
    integer img = new_image_entry();
    img_colorspace_ref(img) = colorspace;

    /* need to allocate new string as makecstring's buffer is 
       already used by cur_file_name */
    if (page_name != 0)
      dest = xstrdup(makecstring(page_name));
    cur_file_name = makecstring(s);
#ifdef WIN32
    /* unquote file name */
    if (*cur_file_name == '"') {
      char *p = cur_file_name;
      char *q = cur_file_name;
      while (p && *p) {
    *q = (*p == '"' ? *(++p) : *p);
    p++, q++;
      }
      *q = '\0';
    }
    fprintf(stderr, " %s\n", cur_file_name);
#endif
    img_name(img) = kpse_find_file(cur_file_name, kpse_tex_format, true);
    if (img_name(img) == NULL)
        pdftex_fail("cannot find image file");
    /* type checks */
    checktypebyheader(img);
    checktypebyextension(img);
    /* read image */
    switch (img_type(img)) {
    case IMAGE_TYPE_PDF:
        pdf_ptr(img) = xtalloc(1, pdf_image_struct);
        pdf_ptr(img)->page_box = pdflastpdfboxspec;
        pdf_ptr(img)->always_use_pdfpagebox = pdfoptionalwaysusepdfpagebox;
        page_num = read_pdf_info(img_name(img), dest, page_num, 
                                     pdfversion, pdfoptionalwaysusepdfpagebox,
                                     pdf_option_pdf_inclusion_errorlevel);
        img_width(img) = bp2int(epdf_width);
        img_height(img) = bp2int(epdf_height);
        img_pages(img) = epdf_num_pages;
        pdf_ptr(img)->orig_x = bp2int(epdf_orig_x);
        pdf_ptr(img)->orig_y = bp2int(epdf_orig_y);
        pdf_ptr(img)->selected_page = page_num;
        pdf_ptr(img)->doc = epdf_doc;
        break;
    case IMAGE_TYPE_PNG:
        img_pages(img) = 1;
        read_png_info(img);
        break;
    case IMAGE_TYPE_JPG:
        jpg_ptr(img) = xtalloc(1, JPG_IMAGE_INFO);
        img_pages(img) = 1;
        read_jpg_info(img);
        break;
    default:
        pdftex_fail("unknown type of image");
    }
    xfree(dest);
    cur_file_name = NULL;
    return img;
}

Here is the call graph for this function:

void setcharmap ( internalfontnumber  )

Definition at line 187 of file writeenc.c.

{
    fm_entry *fm;
    enc_entry *e;
    char **glyph_names;
    int i, k;
    if (pdfmovechars == 0 || fontbc[f] > 32 || !hasfmentry(f))
        return;
    if (fontec[f] < 128) {
        for (i = fontbc[f]; i <= 32; i++)
            pdfcharmap[f][i] = i + MOVE_CHARS_OFFSET;
        return;
    }
    fm = (fm_entry *) pdffontmap[f];
    if (pdfmovechars == 1 || !get_enc(fm))
        return;
    e = fm->encoding;
    if (e->firstfont != getnullfont()) {
        for (i = fontbc[f]; i <= 32; i++)
            pdfcharmap[f][i] = pdfcharmap[e->firstfont][i];
        return;
    }
    e->firstfont = f;
    glyph_names = e->glyph_names;
    for (i = 32, k = MAX_CHAR_CODE; i >= fontbc[f] && k > 127; i--) {
        if (glyph_names[i] == notdef)
            continue;
        while (glyph_names[k] != notdef && k > 127)
            k--;
        if (k < 128)
            return;
        glyph_names[k] = glyph_names[i];
        glyph_names[i] = (char*) notdef;
        pdfcharmap[f][i] = k;
    }
}

Here is the call graph for this function:

void setjobid ( int  ,
int  ,
int  ,
int  ,
int  ,
int   
)

Definition at line 258 of file utils.c.

{
    char *name_string, *format_string, *s;

    if (job_id_string != NULL)
        return;

    name_string = xstrdup(makecstring(jobname));
    format_string = xstrdup(makecstring(formatident));
    s = xtalloc(SMALL_BUF_SIZE + 
                strlen(name_string) + 
                strlen(format_string) + 
                strlen(ptexbanner) + 
                strlen(versionstring) + 
                strlen(kpathsea_version_string), char);
    /* The Web2c version string starts with a space.  */
    sprintf(s, "%.4d/%.2d/%.2d %.2d:%.2d %s %s %s%s %s",
            year, month, day, time/60, time%60, 
            name_string, format_string, ptexbanner, 
            versionstring, kpathsea_version_string);
    job_id_string = xstrdup(s);
    xfree(s);
    xfree(name_string);
    xfree(format_string);
}

Here is the call graph for this function:

void startpacket ( internalfontnumber  ,
integer   
)

Definition at line 88 of file vfpacket.c.

{
    packet_data_ptr = vf_array[vfpacketbase[f]].data[c - fontbc[f]];
    vfpacketlength = vf_array[vfpacketbase[f]].len[c - fontbc[f]];
}

Definition at line 60 of file vfpacket.c.

{
    int l = strstart[s + 1] - strstart[s];
    vf_array[vfpacketbase[f]].len[c - fontbc[f]] = l;
    vf_array[vfpacketbase[f]].data[c - fontbc[f]] = xtalloc(l, char);
    memcpy((void *)vf_array[vfpacketbase[f]].data[c - fontbc[f]], 
           (void *)(strpool + strstart[s]), (unsigned)l);
}

Here is the call graph for this function:

boolean str_eq_cstr ( strnumber  ,
char *   
)
void t1_free ( void  )

Definition at line 1755 of file writet1.c.

{
    xfree(t1_line_array);
    xfree(t1_buf_array);
}

Here is the caller graph for this function:

Here is the caller graph for this function:

boolean t1_subset ( char *  ,
char *  ,
unsigned char *   
)

Definition at line 1762 of file writet1.c.

{
    int i;
    cur_enc_name = encfile;
    for (i = 0; i <= MAX_CHAR_CODE; i++)
        ext_glyph_names[i] = (char*) notdef;
    if (cur_enc_name != NULL)
        load_enc(cur_enc_name, ext_glyph_names);
    grid = g;
    cur_file_name = fontfile;
    hexline_length = 0;
    writet1();
    for (i = 0; i <= MAX_CHAR_CODE; i++)
        if (ext_glyph_names[i] != notdef)
            free(ext_glyph_names[i]);
    return 1 ; /* note:  there *is* no unsuccessful return */
}

Here is the call graph for this function:

void tex_printf ( const char *  ,
  ... 
)

Definition at line 172 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    vsprintf(print_buf, fmt, args);
    print(maketexstring(print_buf));
    flushstr(last_tex_string);
    xfflush(stdout);
    va_end(args);
}

Here is the call graph for this function:

internalfontnumber tfmoffm ( fmentryptr  )

Definition at line 557 of file mapfile.c.

{
    return ((fm_entry *) fm_pt)->tfm_num;
}
void update_enc ( internalfontnumber  ,
char **   
)

Definition at line 95 of file writefont.c.

{
    int i;
    fm_entry *fm = (fm_entry *) pdffontmap[f];
    if (fontec[f] > 127 || (hasfmentry(f) &&
         (is_reencoded(fm) && (fm->encoding)->updated)))
        return;
    for (i = fontbc[f]; i <= 32; i++)
        if (pdfcharmap[f][i] != i) {
            if (glyph_names[i + MOVE_CHARS_OFFSET] != notdef)
                xfree(glyph_names[i + MOVE_CHARS_OFFSET]);
            if (glyph_names[i] != notdef)
                glyph_names[i + MOVE_CHARS_OFFSET] = xstrdup(glyph_names[i]);
            else
                glyph_names[i + MOVE_CHARS_OFFSET] = (char*) notdef;
        }
    if (is_reencoded(fm))
        (fm->encoding)->updated = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file writeimg.c.

{
    pdfimageprocset |= img_color(img);
}
void vf_free ( void  )

Definition at line 100 of file vfpacket.c.

{
    vf_entry *v;
    int n;
    char **p;
    if (vf_array != NULL) {
        for (v = vf_array; v < vf_ptr; v++) {
            xfree(v->len);
            n = fontec[v->font] - fontec[v->font] + 1;
            for (p = v->data; p - v->data < n ; p++)
                xfree(*p);
            xfree(v->data);
        }
        xfree(vf_array);
    }
    xfree(packet_array);
}

Here is the caller graph for this function:

void write_enc ( char **  ,
enc_entry ,
integer   
)

Definition at line 43 of file writeenc.c.

{
    boolean is_notdef;
    int i;
    char **g;
    if (glyph_names == NULL) {
        assert(e != NULL);
        if (e->objnum != 0) /* the encoding has been written already */
            return;
        pdfnewdict(0, 0);
        e->objnum = objptr;
        g = e->glyph_names;
    }
    else {
        pdfbegindict(eobjnum);
        g = glyph_names;
    }
    pdf_printf("/Type /Encoding\n/Differences [ 0 /%s", g[0]);
    is_notdef = (g[0] == notdef);
    for (i = 1; i <= MAX_CHAR_CODE; i++) {
        if (g[i] == notdef) {
            if (!is_notdef) {
                pdf_printf(" %i/%s", i, notdef);
                is_notdef = true;
            }
        }
        else {
            if (is_notdef) {
                pdf_printf(" %i", i);
                is_notdef = false;
            }
            pdf_printf("/%s", g[i]);
        }
    }
    pdf_puts("]\n");
    pdfenddict();
}

Here is the call graph for this function:

Definition at line 316 of file writeimg.c.

{
    cur_file_name = img_name(img);
    tex_printf(" <%s", img_name(img));
    switch (img_type(img)) {
    case IMAGE_TYPE_PNG:
        write_png(img);
        break;
    case IMAGE_TYPE_JPG:
        write_jpg(img);
        break;
    case IMAGE_TYPE_PDF:
        epdf_doc = pdf_ptr(img)->doc;
        epdf_selected_page = pdf_ptr(img)->selected_page;
        epdf_page_box = pdf_ptr(img)->page_box;
        epdf_always_use_pdf_pagebox = pdf_ptr(img)->always_use_pdfpagebox;
        write_epdf();
        break;
    default:
        pdftex_fail("unknown type of image");
    }
    tex_printf(">");
    cur_file_name = NULL;
}

Here is the call graph for this function:

Definition at line 1198 of file writettf.c.

{
    dirtab_entry *tab;
    long i;
    set_cur_file_name(fm_cur->ff_name);
    if (!open_input(&ttf_file, kpse_type1_format, FOPEN_RBIN_MODE)) {
        pdftex_fail("cannot open OpenType font file for reading");
    }
    cur_file_name = (char*)nameoffile + 1;
    tex_printf("<<%s", cur_file_name);
    fontfile_found = true;
    dir_tab = NULL;
    glyph_tab = NULL;
    ttf_read_tabdir();
    /* read font parameters */
    if (ttf_name_lookup("head", false) != NULL)
        ttf_read_head();
    if (ttf_name_lookup("hhea", false) != NULL)
        ttf_read_hhea();
    if (ttf_name_lookup("PCLT", false) != NULL)
        ttf_read_pclt();
    if (ttf_name_lookup("post", false) != NULL)
        ttf_read_post();
    /* copy font file */
    tab = ttf_seek_tab("CFF ", 0);
    for (i = tab->length; i > 0; i--)
        copy_char();
    xfree(dir_tab);
    ttf_close();
    tex_printf(">>");
    cur_file_name = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 353 of file utils.c.

{
    integer save_offset;
    if (jobname_cstr == NULL)
        jobname_cstr = xstrdup(makecstring(jobname));
    save_offset = xftell(pdffile, jobname_cstr);
    xfseek(pdffile, offset, SEEK_SET, jobname_cstr);
    fprintf(pdffile, "%li", (long int)length);
    xfseek(pdffile, pdfoffset(), SEEK_SET, jobname_cstr);
}

Here is the call graph for this function:

void writet1 ( void  )

Definition at line 1716 of file writet1.c.

{
    read_encoding_only = false;
#ifdef pdfTeX
    if (strcasecmp(strend(fm_fontfile(fm_cur)) - 4, ".otf") == 0) {
        if (!is_included(fm_cur) || is_subsetted(fm_cur))
            pdftex_fail("OTF fonts must be included entirely");
        writeotf();
        is_otf_font = true;
        return;
    }
#endif
    if (!is_included(fm_cur)) { /* scan parameters from font file */
        if (!t1_open_fontfile("{"))
            return;
        t1_scan_only();
        t1_close_font_file("}");
        return;
    }
    if (!is_subsetted(fm_cur)) { /* include entire font */
        if (!t1_open_fontfile("<<"))
            return;
        t1_include();
        t1_close_font_file(">>");
        return;
    } 
    /* partial downloading */
    if (!t1_open_fontfile("<"))
        return;
    t1_subset_ascii_part();
    t1_start_eexec();
    cc_init();
    cs_init();
    t1_read_subrs();
    t1_subset_charstrings();
    t1_subset_end();
    t1_close_font_file(">");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void writet3 ( int  ,
internalfontnumber   
)

Definition at line 268 of file writet3.c.

{
    static char t3_font_scale_str[] = "\\pdffontscale";
    int i, e;
    int first_char, last_char;
    integer pk_font_scale;
    boolean is_notdef;
    t3_glyph_num = 0;
    t3_image_used = false;
    for (i = 0; i <= MAX_CHAR_CODE; i++) {
        t3_char_procs[i] = 0;
        t3_char_widths[i] = 0;
    }
    packfilename(fontname[f], getnullstr(), maketexstring(".pgc"));
    cur_file_name = makecstring(makenamestring());
    is_pk_font = false;
    if (!t3_open()) {
        if (writepk(f))
            goto write_font_dict;
        else {
            cur_file_name = NULL;
            return;
        }
    }
    tex_printf("<%s", nameoffile + 1);
    t3_getline();
    if (!t3_prefix(t3_font_scale_str) ||
        sscanf(t3_line_array + strlen(t3_font_scale_str) + 1, "%g", &t3_font_scale) < 1 ||
        t3_font_scale <= 0 || t3_font_scale > 1000 ) {
        pdftex_warn("missing or invalid font scale");
        t3_close();
        cur_file_name = NULL;
        return;
    }
    while (!t3_eof())
        t3_write_glyph(f);
write_font_dict:
    for (i = fontbc[f]; i <= fontec[f]; i++)
        if (pdfcharmarked(f, i))
            break;
    first_char = i;
    for (i = fontec[f]; i > first_char; i--)
        if (pdfcharmarked(f, i))
            break;
    last_char = i;
    pdfbegindict(objnum); /* Type 3 font dictionary */
    pdf_puts("/Type /Font\n/Subtype /Type3\n");
    pdf_printf("/Name /F%i\n", (int)f);
    if (pdffontattr[f] != getnullstr()) {
        pdfprint(pdffontattr[f]);
        pdf_puts("\n");
    }
    if (is_pk_font) {
        pk_font_scale = get_pk_font_scale(f);
        pdf_puts("/FontMatrix [");
        pdfprintreal(pk_font_scale, 5);
        pdf_puts(" 0 0 ");
        pdfprintreal(pk_font_scale, 5);
        pdf_puts(" 0 0]\n") ;
    }
    else
        pdf_printf("/FontMatrix [%g 0 0 %g 0 0]\n", 
                   (double)t3_font_scale, (double)t3_font_scale);
    pdf_printf("/%s [ %i %i %i %i ]\n", 
               font_keys[FONTBBOX1_CODE].pdfname, 
               (int)t3_b0, (int)t3_b1, 
               (int)t3_b2, (int)t3_b3);
    pdf_printf("/Resources << /ProcSet [ /PDF %s] >>\n", 
               t3_image_used ? "/ImageB " : "");
    pdf_printf("/FirstChar %i\n/LastChar %i\n", first_char, last_char);
    pdf_printf("/Widths %i 0 R\n/Encoding %i 0 R\n/CharProcs %i 0 R\n", 
               (int)(objptr + 1), (int)(objptr + 2),
               (int)(objptr + 3));
    pdfenddict();
    pdfnewobj(0, 0); /* chars width array */
    pdf_puts("[");
    if (is_pk_font)
        for (i = first_char; i <= last_char; i++) {
            pdfprintreal(t3_char_widths[i], 2);
            pdf_puts(" ");
        }
    else
        for (i = first_char; i <= last_char; i++)
            pdf_printf("%i ", (int)t3_char_widths[i]);
    pdf_puts("]\n");
    pdfendobj();
    pdfnewdict(0, 0); /* encoding dictionary */
    pdf_printf("/Type /Encoding\n/Differences [%i", first_char);
    if (t3_char_procs[first_char] == 0) {
        pdf_printf("/%s", notdef);
        is_notdef = true;
    }
    else {
        pdf_printf("/a%i", first_char);
        is_notdef = false;
    }
    for (i = first_char + 1; i <= last_char; i++) {
        if (t3_char_procs[i] == 0) {
            if (!is_notdef) {
                pdf_printf(" %i/%s", i, notdef);
                is_notdef = true;
            }
        }
        else {
            if (is_notdef) {
                pdf_printf(" %i", i);
                is_notdef = false;
            }
            pdf_printf("/a%i", i);
        }
    }
    pdf_puts("]\n");
    pdfenddict();
    pdfnewdict(0, 0); /* CharProcs dictionary */
    for (i = first_char; i <= last_char; i++)
        if (t3_char_procs[i] != 0)
            pdf_printf("/a%i %i 0 R\n", (int)i, (int)t3_char_procs[i]);
    pdfenddict();
    t3_close();
    tex_printf(">");
    cur_file_name = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1142 of file writettf.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 40 of file writezip.c.

{
    int err;

    if (!fixedcompresslevel) {
        if (pdfptr) {
            pdfgone += xfwrite(pdfbuf, 1, pdfptr, pdffile);
            pdfstreamlength += pdfptr;
            }
        return;
    }

    cur_file_name = NULL;
    if (pdfstreamlength == 0) {
        c_stream.zalloc = (alloc_func)0;
        c_stream.zfree = (free_func)0;
        c_stream.opaque = (voidpf)0;
        check_err(deflateInit(&c_stream, fixedcompresslevel), "deflateInit");
        c_stream.next_out = (Bytef*)zipbuf;
        c_stream.avail_out = ZIP_BUF_SIZE;
    }
    c_stream.next_in = pdfbuf;
    c_stream.avail_in = pdfptr;
    for(;;) {
        if (c_stream.avail_out == 0) {
            pdfgone += xfwrite(zipbuf, 1, ZIP_BUF_SIZE, pdffile);
            c_stream.next_out = (Bytef*)zipbuf;
            c_stream.avail_out = ZIP_BUF_SIZE;
        }
        err = deflate(&c_stream, finish ? Z_FINISH : Z_NO_FLUSH);
        if (finish && err == Z_STREAM_END)
            break;
        check_err(err, "deflate");
        if (!finish && c_stream.avail_in == 0)
            break;
    }
    if (finish) {
        if (c_stream.avail_out < ZIP_BUF_SIZE) /* at least one byte has been output */
            pdfgone += xfwrite(zipbuf, 1, ZIP_BUF_SIZE - c_stream.avail_out, pdffile);
        check_err(deflateEnd(&c_stream), "deflateEnd");
        xfflush(pdffile);
    }
    pdfstreamlength = c_stream.total_out;
}

Here is the call graph for this function:

int xfflush ( FILE )

Definition at line 330 of file utils.c.

{
    if (fflush(stream) != 0)
        pdftex_fail("fflush() failed");
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

size_t xfwrite ( void ,
size_t  size,
size_t  nmemb,
FILE  
)

Definition at line 323 of file utils.c.

{
    if (fwrite(ptr, size, nmemb, stream) != nmemb)
        pdftex_fail("fwrite() failed");
    return nmemb;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int xgetc ( FILE )

Definition at line 161 of file ttf2afm.c.

{
    int c = getc(stream);
    if (c < 0 && c != EOF)
        ttf_fail("getc() failed");
    return c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int xputc ( int  ,
FILE  
)

Definition at line 345 of file utils.c.

{
    int i = putc(c, stream);
    if (i < 0)
        pdftex_fail("putc() failed");
    return i;
}

Variable Documentation

Definition at line 101 of file ttf2afm.c.

Definition at line 54 of file mapfile.c.

Definition at line 28 of file writefont.c.

Definition at line 43 of file writefont.c.

char fontname_buf[]

Definition at line 46 of file writefont.c.

Definition at line 44 of file writefont.c.

Definition at line 43 of file utils.c.

strnumber last_tex_string

Definition at line 34 of file utils.c.

const char notdef[]

Definition at line 179 of file t1part.c.

Definition at line 172 of file writet1.c.

Definition at line 171 of file writet1.c.

internalfontnumber tex_font

Definition at line 42 of file writefont.c.

Definition at line 99 of file writettf.c.

Definition at line 45 of file writefont.c.