w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

type1.c File Reference
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <ctype.h>
#include "system.h"
#include "mem.h"
#include "error.h"
#include "mfileio.h"
#include "pdfobj.h"
#include "numbers.h"
#include "type1.h"
#include "tfm.h"
#include "pdfparse.h"
#include "pdflimits.h"
#include "t1crypt.h"
#include "twiddle.h"
#include "encodings.h"
#include "standardenc.h"
Include dependency graph for type1.c:

Go to the source code of this file.

Classes

struct  a_pfb
 
struct  a_type1_font
 

Macros

#define FIXED_WIDTH   1
 
#define SERIF   2
 
#define STANDARD   32
 
#define ITALIC   64
 
#define SYMBOLIC
 
#define STEMV   80
 
#define ASCII   1
 
#define BINARY   2
 

Functions

void type1_set_verbose (void)
 
static unsigned long get_low_endian_quad (FILE *file)
 
void type1_disable_partial (void)
 
static void init_a_pfb (struct a_pfb *pfb)
 
static void do_a_standard_enc (char **glyphs, char **encoding)
 
int glyph_cmp (const void *v1, const void *v2)
 
int glyph_match (const void *key, const void *v)
 
static unsigned long parse_header (unsigned char *filtered, unsigned char *buffer, unsigned long length, int pfb_id)
 
static void dump_glyphs (char **glyphs, int n, int show_index)
 
static void dump_used (char *used_chars)
 
static int is_a_pfb (FILE *file)
 
static unsigned char * get_pfb_segment (unsigned long *length, FILE *file, int expected_type)
 
static unsigned int glyph_length (char **glyphs)
 
static char * pfb_find_name (FILE *pfb_file)
 
static void pfb_add_to_used_glyphs (int pfb_id, char *glyph)
 
static char * new_used_chars (void)
 
static void pfb_add_to_used_chars (int pfb_id, unsigned code)
 
static unsigned long do_pfb_header (FILE *file, int pfb_id)
 
static unsigned long parse_body (unsigned char *filtered, unsigned char *unfiltered, unsigned long length, char **used_glyphs, unsigned *n_used, pdf_obj *descriptor)
 
static unsigned long do_pfb_body (FILE *file, int pfb_id)
 
static unsigned long do_pfb_trailer (FILE *file, pdf_obj *stream)
 
static pdf_objtype1_fontfile (int pfb_id)
 
static char * type1_fontname (int pfb_id)
 
static void mangle_fontname (char *fontname)
 
static void type1_start_font_descriptor (int pfb_id)
 
static int pfb_get_id (const char *pfb_name)
 
static void pfb_release (int id)
 
static void release_glyphs (char **glyphs)
 
static void do_pfb (int pfb_id)
 
void pfb_flush_all (void)
 
static void init_a_type1_font (struct a_type1_font *this_type1_font)
 
pdf_objtype1_font_resource (int type1_id)
 
char * type1_font_used (int type1_id)
 
static int is_a_base_font (const char *name)
 
int type1_font (const char *map_name, int tfm_font_id, char *resource_name, int encoding_id, int remap)
 
void type1_close_all (void)
 

Variables

static unsigned char verbose = 0
 
static char partial_enabled = 1
 
static unsigned num_pfbs = 0
 
static unsigned max_pfbs = 0
 
struct a_pfbpfbs = NULL
 
struct a_type1_fonttype1_fonts = NULL
 
int num_type1_fonts = 0
 
int max_type1_fonts = 0
 

Macro Definition Documentation

◆ ASCII

#define ASCII   1

Definition at line 463 of file type1.c.

◆ BINARY

#define BINARY   2

Definition at line 464 of file type1.c.

◆ FIXED_WIDTH

#define FIXED_WIDTH   1

Definition at line 137 of file type1.c.

◆ ITALIC

#define ITALIC   64

Definition at line 140 of file type1.c.

◆ SERIF

#define SERIF   2

Definition at line 138 of file type1.c.

◆ STANDARD

#define STANDARD   32

Definition at line 139 of file type1.c.

◆ STEMV

#define STEMV   80

Definition at line 143 of file type1.c.

◆ SYMBOLIC

#define SYMBOLIC
Value:
4 /* Fonts that don't have Adobe encodings (e.g.,
cmr, should be set to be symbolic */

Definition at line 141 of file type1.c.

Function Documentation

◆ do_a_standard_enc()

static void do_a_standard_enc ( char **  glyphs,
char **  encoding 
)
static

Definition at line 128 of file type1.c.

References glyphs(), i, NEW, RELEASE, strcpy(), and strlen().

Referenced by parse_header().

◆ do_pfb()

◆ do_pfb_body()

static unsigned long do_pfb_body ( FILE file,
int  pfb_id 
)
static

◆ do_pfb_header()

static unsigned long do_pfb_header ( FILE file,
int  pfb_id 
)
static

◆ do_pfb_trailer()

static unsigned long do_pfb_trailer ( FILE file,
pdf_obj stream 
)
static

Definition at line 892 of file type1.c.

References ASCII, buffer, get_pfb_segment(), length, pdf_add_stream(), and RELEASE.

Referenced by do_pfb().

◆ dump_glyphs()

static void dump_glyphs ( char **  glyphs,
int  n,
int  show_index 
)
static

Definition at line 439 of file type1.c.

References fprintf, glyphs(), i, and n.

Referenced by do_pfb(), and parse_body().

◆ dump_used()

static void dump_used ( char *  used_chars)
static

Definition at line 454 of file type1.c.

References fprintf, and i.

◆ get_low_endian_quad()

static unsigned long get_low_endian_quad ( FILE file)
static

Definition at line 57 of file type1.c.

References bytes, ch, ERROR, fgetc, i, and check-static-inits::result.

Referenced by get_pfb_segment().

◆ get_pfb_segment()

static unsigned char* get_pfb_segment ( unsigned long *  length,
FILE file,
int  expected_type 
)
static

◆ glyph_cmp()

int glyph_cmp ( const void v1,
const void v2 
)

Definition at line 146 of file type1.c.

References s1, s2, strcmp(), v1, and v2.

Referenced by parse_body(), pfb_add_to_used_glyphs(), and ttf_add_to_used_glyphs().

◆ glyph_length()

static unsigned int glyph_length ( char **  glyphs)
static

Definition at line 529 of file type1.c.

References glyphs(), i, check-static-inits::result, and strlen().

◆ glyph_match()

int glyph_match ( const void key,
const void v 
)

Definition at line 154 of file type1.c.

References key, s, strcmp(), and v.

Referenced by parse_body(), pfb_add_to_used_glyphs(), and ttf_add_to_used_glyphs().

◆ init_a_pfb()

static void init_a_pfb ( struct a_pfb pfb)
static

Definition at line 104 of file type1.c.

References i, NEW, NULL, partial_enabled, and pfb.

Referenced by pfb_get_id().

◆ init_a_type1_font()

static void init_a_type1_font ( struct a_type1_font this_type1_font)
static

Definition at line 1175 of file type1.c.

References new_used_chars(), NULL, and partial_enabled.

Referenced by type1_font().

◆ is_a_base_font()

static int is_a_base_font ( const char *  name)
static

Definition at line 1207 of file type1.c.

References i, name, and strcmp().

Referenced by type1_font().

◆ is_a_pfb()

static int is_a_pfb ( FILE file)
static

Definition at line 466 of file type1.c.

References ASCII, BINARY, ch, fgetc, and check-static-inits::result.

Referenced by pfb_get_id().

◆ mangle_fontname()

static void mangle_fontname ( char *  fontname)
static

Definition at line 922 of file type1.c.

References ch, first, fontname, i, memmove, NULL, rand, srand, strlen(), and time().

Referenced by pfb_get_id().

◆ new_used_chars()

static char* new_used_chars ( void  )
static

Definition at line 633 of file type1.c.

References i, NEW, and check-static-inits::result.

Referenced by init_a_type1_font(), and pfb_add_to_used_chars().

◆ parse_body()

static unsigned long parse_body ( unsigned char *  filtered,
unsigned char *  unfiltered,
unsigned long  length,
char **  used_glyphs,
unsigned *  n_used,
pdf_obj descriptor 
)
static

◆ parse_header()

◆ pfb_add_to_used_chars()

static void pfb_add_to_used_chars ( int  pfb_id,
unsigned  code 
)
static

Definition at line 646 of file type1.c.

References ERROR, new_used_chars(), num_pfbs, pfbs, and a_pfb::used_def_enc_chars.

Referenced by type1_close_all().

◆ pfb_add_to_used_glyphs()

static void pfb_add_to_used_glyphs ( int  pfb_id,
char *  glyph 
)
static

◆ pfb_find_name()

static char* pfb_find_name ( FILE pfb_file)
static

◆ pfb_flush_all()

void pfb_flush_all ( void  )

Definition at line 1154 of file type1.c.

References do_pfb(), i, num_pfbs, pfb_release(), pfbs, and RELEASE.

Referenced by type1_close_all().

◆ pfb_get_id()

◆ pfb_release()

static void pfb_release ( int  id)
static

Definition at line 1046 of file type1.c.

References fontname, i, id, a_pfb::n_used_glyphs, num_pfbs, pdf_release_obj(), pfbs, and RELEASE.

Referenced by pfb_flush_all().

◆ release_glyphs()

static void release_glyphs ( char **  glyphs)
static

Definition at line 1073 of file type1.c.

References glyphs(), i, and RELEASE.

◆ type1_close_all()

◆ type1_disable_partial()

void type1_disable_partial ( void  )

Definition at line 79 of file type1.c.

References partial_enabled.

Referenced by do_args().

◆ type1_font()

◆ type1_font_resource()

pdf_obj* type1_font_resource ( int  type1_id)

Definition at line 1184 of file type1.c.

References ERROR, max_type1_fonts, NULL, pdf_link_obj(), and type1_fonts.

Referenced by dev_locate_font().

◆ type1_font_used()

char* type1_font_used ( int  type1_id)

◆ type1_fontfile()

static pdf_obj* type1_fontfile ( int  pfb_id)
static

Definition at line 903 of file type1.c.

References NULL, num_pfbs, pdf_link_obj(), and pfbs.

Referenced by type1_start_font_descriptor().

◆ type1_fontname()

static char* type1_fontname ( int  pfb_id)
static

Definition at line 911 of file type1.c.

References a_pfb::fontname, NULL, num_pfbs, and pfbs.

Referenced by type1_font(), and type1_start_font_descriptor().

◆ type1_set_verbose()

void type1_set_verbose ( void  )

Definition at line 49 of file type1.c.

References verbose.

Referenced by do_args().

◆ type1_start_font_descriptor()

static void type1_start_font_descriptor ( int  pfb_id)
static

Variable Documentation

◆ max_pfbs

unsigned max_pfbs = 0
static

Definition at line 85 of file type1.c.

Referenced by pfb_get_id().

◆ max_type1_fonts

int max_type1_fonts = 0

Definition at line 1172 of file type1.c.

Referenced by type1_font(), type1_font_resource(), and type1_font_used().

◆ num_pfbs

unsigned num_pfbs = 0
static

◆ num_type1_fonts

int num_type1_fonts = 0

Definition at line 1172 of file type1.c.

Referenced by type1_close_all(), and type1_font().

◆ partial_enabled

char partial_enabled = 1
static

◆ pfbs

◆ type1_fonts

◆ verbose

unsigned char verbose = 0
static

Definition at line 47 of file type1.c.

Referenced by do_pfb(), get_pfb_segment(), parse_body(), and type1_set_verbose().