~ubuntu-branches/ubuntu/utopic/texlive-bin/utopic

« back to all changes in this revision

Viewing changes to texk/dvipdfmx/dvipdfmx-20110311/src/sfnt.h

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2012-05-07 10:47:49 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20120507104749-p00ot5sajjbkp1hp
Tags: 2011.20120507-1
* new upstream checkout: uptex 1.10
* drop patches for config file inclusion in (x)dvipdfmx, included upstream
* add man page for etex
* include pmpost patches and build it
* adapt/unfuzzify patches for current sources
* disable mtx building, we have prepmx package in Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Header: /home/cvsroot/dvipdfmx/src/sfnt.h,v 1.11 2011/03/06 03:14:15 chofchof Exp $
2
 
    
3
 
    This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
4
 
 
5
 
    Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
6
 
    the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
7
 
    
8
 
    This program is free software; you can redistribute it and/or modify
9
 
    it under the terms of the GNU General Public License as published by
10
 
    the Free Software Foundation; either version 2 of the License, or
11
 
    (at your option) any later version.
12
 
    
13
 
    This program is distributed in the hope that it will be useful,
14
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
    GNU General Public License for more details.
17
 
    
18
 
    You should have received a copy of the GNU General Public License
19
 
    along with this program; if not, write to the Free Software
20
 
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21
 
*/
22
 
 
23
 
#ifndef _SFNT_H_
24
 
#define _SFNT_H_
25
 
 
26
 
#include "mfileio.h"
27
 
#include "numbers.h"
28
 
#include "pdfobj.h"
29
 
 
30
 
/* Acoid conflict with CHAR from <winnt.h>.  */
31
 
#define CHAR SFNT_CHAR
32
 
 
33
 
/* Data Types as described in Apple's TTRefMan */
34
 
typedef unsigned char  BYTE;
35
 
typedef signed char    CHAR;
36
 
typedef unsigned short USHORT;
37
 
typedef signed short   SHORT;
38
 
typedef unsigned long  ULONG;
39
 
typedef signed long    LONG;
40
 
typedef unsigned long  Fixed;   /* 16.16-bit signed fixed-point number */
41
 
typedef short          FWord;
42
 
typedef unsigned short uFWord;
43
 
typedef short          F2Dot14; /* 16-bit signed fixed number with the low
44
 
                                   14 bits representing fraction. */
45
 
 
46
 
struct sfnt_table
47
 
{
48
 
  /* table header */
49
 
  char   tag[4];
50
 
  ULONG  check_sum;
51
 
  ULONG  offset;
52
 
  ULONG  length;
53
 
  char  *data;   /* table data */
54
 
};
55
 
 
56
 
#define SFNT_TABLE_REQUIRED (1 << 0)
57
 
 
58
 
struct sfnt_table_directory
59
 
{
60
 
  ULONG   version;         /* Fixed for Win */
61
 
  USHORT  num_tables;
62
 
  USHORT  search_range;
63
 
  USHORT  entry_selector;
64
 
  USHORT  range_shift;
65
 
  USHORT  num_kept_tables; /* number of kept tables */
66
 
  char   *flags;           /* keep or omit */
67
 
  struct  sfnt_table *tables;
68
 
};
69
 
 
70
 
/* sfnt resource */
71
 
#define SFNT_TYPE_TRUETYPE   (1 << 0)
72
 
#define SFNT_TYPE_OPENTYPE   (1 << 1)
73
 
#define SFNT_TYPE_POSTSCRIPT (1 << 2)
74
 
#define SFNT_TYPE_TTC        (1 << 4)
75
 
#define SFNT_TYPE_DFONT      (1 << 8)
76
 
 
77
 
typedef struct
78
 
{
79
 
  FILE  *stream;
80
 
  int    type;
81
 
  ULONG  offset;
82
 
  struct sfnt_table_directory *directory;
83
 
} sfnt;
84
 
 
85
 
/* Convert sfnt "fixed" type to double */
86
 
#define fixed(a) ((double)((a)%0x10000L)/(double)(0x10000L) + \
87
 
 (a)/0x10000L - (((a)/0x10000L > 0x7fffL) ? 0x10000L : 0))
88
 
 
89
 
/* get_***_*** from numbers.h */
90
 
#define sfnt_get_byte(s)   ((BYTE)   get_unsigned_byte((s)->stream))
91
 
#define sfnt_get_char(s)   ((CHAR)   get_signed_byte  ((s)->stream))
92
 
#define sfnt_get_ushort(s) ((USHORT) get_unsigned_pair((s)->stream))
93
 
#define sfnt_get_short(s)  ((SHORT)  get_signed_pair  ((s)->stream))
94
 
#define sfnt_get_ulong(s)  ((ULONG)  get_unsigned_quad((s)->stream))
95
 
#define sfnt_get_long(s)   ((LONG)   get_signed_quad  ((s)->stream))
96
 
 
97
 
#define sfnt_seek_set(s,o)   seek_absolute((s)->stream, (o))
98
 
#define sfnt_read(b,l,s)     fread((b), 1, (l), (s)->stream)
99
 
 
100
 
extern  int  put_big_endian (void *s, LONG q, int n);
101
 
 
102
 
#define sfnt_put_ushort(s,v) put_big_endian((s), v, 2);
103
 
#define sfnt_put_short(s,v)  put_big_endian((s), v, 2);
104
 
#define sfnt_put_ulong(s,v)  put_big_endian((s), v, 4);
105
 
#define sfnt_put_long(s,v)   put_big_endian((s), v, 4);
106
 
 
107
 
extern sfnt *sfnt_open  (FILE *fp);
108
 
extern void  sfnt_close (sfnt *sfont);
109
 
extern sfnt *dfont_open (FILE *fp, int index);
110
 
 
111
 
/* table directory */
112
 
extern int   sfnt_read_table_directory (sfnt *sfont, ULONG offset);
113
 
extern ULONG sfnt_find_table_len       (sfnt *sfont, const char *tag);
114
 
extern ULONG sfnt_find_table_pos       (sfnt *sfont, const char *tag);
115
 
extern ULONG sfnt_locate_table         (sfnt *sfont, const char *tag);
116
 
 
117
 
extern void  sfnt_set_table     (sfnt *sfont,
118
 
                                 const char *tag, void *data, ULONG length);
119
 
extern int   sfnt_require_table (sfnt *sfont, const char *tag, int must_exist);
120
 
 
121
 
extern pdf_obj *sfnt_create_FontFile_stream (sfnt *sfont);
122
 
 
123
 
#endif /* _SFNT_H_ */