hpdf 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History +57 -0
- data/License +25 -0
- data/README +165 -0
- data/examples/arc_demo.rb +82 -0
- data/examples/demo.rb +92 -0
- data/examples/encryption.rb +41 -0
- data/examples/ext_gstater_demo.rb +171 -0
- data/examples/font_demo.rb +67 -0
- data/examples/jpfont_demo.rb +122 -0
- data/examples/line_demo.rb +301 -0
- data/examples/slide_show_demo.rb +139 -0
- data/examples/text_demo2.rb +189 -0
- data/examples/ttfont_demo.rb +106 -0
- data/ext/extconf.rb +6 -0
- data/ext/hpdf.c +3779 -0
- data/ext/hpdf_annotation.c +415 -0
- data/ext/hpdf_array.c +344 -0
- data/ext/hpdf_binary.c +117 -0
- data/ext/hpdf_boolean.c +47 -0
- data/ext/hpdf_catalog.c +354 -0
- data/ext/hpdf_destination.c +339 -0
- data/ext/hpdf_dict.c +488 -0
- data/ext/hpdf_doc.c +2020 -0
- data/ext/hpdf_doc_png.c +137 -0
- data/ext/hpdf_encoder.c +2991 -0
- data/ext/hpdf_encoder_cns.c +36359 -0
- data/ext/hpdf_encoder_cnt.c +15307 -0
- data/ext/hpdf_encoder_jp.c +16125 -0
- data/ext/hpdf_encoder_kr.c +27978 -0
- data/ext/hpdf_encrypt.c +632 -0
- data/ext/hpdf_encryptdict.c +240 -0
- data/ext/hpdf_error.c +114 -0
- data/ext/hpdf_ext_gstate.c +150 -0
- data/ext/hpdf_font.c +229 -0
- data/ext/hpdf_font_cid.c +1030 -0
- data/ext/hpdf_font_tt.c +406 -0
- data/ext/hpdf_font_type1.c +391 -0
- data/ext/hpdf_fontdef.c +56 -0
- data/ext/hpdf_fontdef_base14.c +4506 -0
- data/ext/hpdf_fontdef_cid.c +194 -0
- data/ext/hpdf_fontdef_cns.c +471 -0
- data/ext/hpdf_fontdef_cnt.c +250 -0
- data/ext/hpdf_fontdef_jp.c +1904 -0
- data/ext/hpdf_fontdef_kr.c +1572 -0
- data/ext/hpdf_fontdef_tt.c +2230 -0
- data/ext/hpdf_fontdef_type1.c +524 -0
- data/ext/hpdf_gstate.c +119 -0
- data/ext/hpdf_image.c +568 -0
- data/ext/hpdf_image_png.c +424 -0
- data/ext/hpdf_info.c +164 -0
- data/ext/hpdf_list.c +333 -0
- data/ext/hpdf_mmgr.c +243 -0
- data/ext/hpdf_name.c +71 -0
- data/ext/hpdf_null.c +31 -0
- data/ext/hpdf_number.c +49 -0
- data/ext/hpdf_objects.c +172 -0
- data/ext/hpdf_outline.c +329 -0
- data/ext/hpdf_page_label.c +74 -0
- data/ext/hpdf_page_operator.c +2764 -0
- data/ext/hpdf_pages.c +1508 -0
- data/ext/hpdf_real.c +61 -0
- data/ext/hpdf_streams.c +1435 -0
- data/ext/hpdf_string.c +189 -0
- data/ext/hpdf_utils.c +438 -0
- data/ext/hpdf_xref.c +348 -0
- data/ext/include/hpdf.h +1227 -0
- data/ext/include/hpdf_annotation.h +74 -0
- data/ext/include/hpdf_catalog.h +81 -0
- data/ext/include/hpdf_conf.h +76 -0
- data/ext/include/hpdf_consts.h +549 -0
- data/ext/include/hpdf_destination.h +41 -0
- data/ext/include/hpdf_doc.h +159 -0
- data/ext/include/hpdf_encoder.h +311 -0
- data/ext/include/hpdf_encrypt.h +156 -0
- data/ext/include/hpdf_encryptdict.h +66 -0
- data/ext/include/hpdf_error.h +201 -0
- data/ext/include/hpdf_ext_gstate.h +38 -0
- data/ext/include/hpdf_font.h +112 -0
- data/ext/include/hpdf_fontdef.h +403 -0
- data/ext/include/hpdf_gstate.h +80 -0
- data/ext/include/hpdf_image.h +72 -0
- data/ext/include/hpdf_info.h +48 -0
- data/ext/include/hpdf_list.h +85 -0
- data/ext/include/hpdf_mmgr.h +82 -0
- data/ext/include/hpdf_objects.h +587 -0
- data/ext/include/hpdf_outline.h +74 -0
- data/ext/include/hpdf_page_label.h +35 -0
- data/ext/include/hpdf_pages.h +128 -0
- data/ext/include/hpdf_streams.h +276 -0
- data/ext/include/hpdf_types.h +488 -0
- data/ext/include/hpdf_utils.h +161 -0
- data/tests/arc_demo.rb +82 -0
- data/tests/demo.rb +91 -0
- data/tests/encryption.rb +41 -0
- data/tests/ext_gstater_demo.rb +171 -0
- data/tests/font_demo.rb +67 -0
- data/tests/line_demo.rb +301 -0
- data/tests/slide_show_demo.rb +139 -0
- data/tests/test_all_examples.rb +31 -0
- data/tests/text_demo2.rb +189 -0
- metadata +147 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.3 >> -- hpdf_font.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_FONT_H
|
16
|
+
#define _HPDF_FONT_H
|
17
|
+
|
18
|
+
#include "hpdf_fontdef.h"
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif
|
23
|
+
|
24
|
+
|
25
|
+
/*----------------------------------------------------------------------------*/
|
26
|
+
/*----- Writing Mode ---------------------------------------------------------*/
|
27
|
+
|
28
|
+
typedef enum _HPDF_FontType {
|
29
|
+
HPDF_FONT_TYPE1 = 0,
|
30
|
+
HPDF_FONT_TRUETYPE,
|
31
|
+
HPDF_FONT_TYPE3,
|
32
|
+
HPDF_FONT_TYPE0_CID,
|
33
|
+
HPDF_FONT_TYPE0_TT,
|
34
|
+
HPDF_FONT_CID_TYPE0,
|
35
|
+
HPDF_FONT_CID_TYPE2,
|
36
|
+
HPDF_FONT_MMTYPE1
|
37
|
+
} HPDF_FontType;
|
38
|
+
|
39
|
+
|
40
|
+
typedef HPDF_Dict HPDF_Font;
|
41
|
+
|
42
|
+
|
43
|
+
typedef HPDF_TextWidth
|
44
|
+
(*HPDF_Font_TextWidths_Func) (HPDF_Font font,
|
45
|
+
const HPDF_BYTE *text,
|
46
|
+
HPDF_UINT len);
|
47
|
+
|
48
|
+
|
49
|
+
typedef HPDF_UINT
|
50
|
+
(*HPDF_Font_MeasureText_Func) (HPDF_Font font,
|
51
|
+
const HPDF_BYTE *text,
|
52
|
+
HPDF_UINT len,
|
53
|
+
HPDF_REAL width,
|
54
|
+
HPDF_REAL fontsize,
|
55
|
+
HPDF_REAL charspace,
|
56
|
+
HPDF_REAL wordspace,
|
57
|
+
HPDF_BOOL wordwrap,
|
58
|
+
HPDF_REAL *real_width);
|
59
|
+
|
60
|
+
|
61
|
+
typedef struct _HPDF_FontAttr_Rec *HPDF_FontAttr;
|
62
|
+
|
63
|
+
typedef struct _HPDF_FontAttr_Rec {
|
64
|
+
HPDF_FontType type;
|
65
|
+
HPDF_WritingMode writing_mode;
|
66
|
+
HPDF_Font_TextWidths_Func text_width_fn;
|
67
|
+
HPDF_Font_MeasureText_Func measure_text_fn;
|
68
|
+
HPDF_FontDef fontdef;
|
69
|
+
HPDF_Encoder encoder;
|
70
|
+
|
71
|
+
/* if the encoding-type is HPDF_ENCODER_TYPE_SINGLE_BYTE, the width of
|
72
|
+
* each charactors are cashed in 'widths'.
|
73
|
+
* when HPDF_ENCODER_TYPE_DOUBLE_BYTE the width is calculate each time.
|
74
|
+
*/
|
75
|
+
HPDF_INT16* widths;
|
76
|
+
HPDF_BYTE* used;
|
77
|
+
|
78
|
+
HPDF_Xref xref;
|
79
|
+
HPDF_Font descendant_font;
|
80
|
+
HPDF_Dict map_stream;
|
81
|
+
HPDF_Dict cmap_stream;
|
82
|
+
} HPDF_FontAttr_Rec;
|
83
|
+
|
84
|
+
|
85
|
+
HPDF_Font
|
86
|
+
HPDF_Type1Font_New (HPDF_MMgr mmgr,
|
87
|
+
HPDF_FontDef fontdef,
|
88
|
+
HPDF_Encoder encoder,
|
89
|
+
HPDF_Xref xref);
|
90
|
+
|
91
|
+
HPDF_Font
|
92
|
+
HPDF_TTFont_New (HPDF_MMgr mmgr,
|
93
|
+
HPDF_FontDef fontdef,
|
94
|
+
HPDF_Encoder encoder,
|
95
|
+
HPDF_Xref xref);
|
96
|
+
|
97
|
+
HPDF_Font
|
98
|
+
HPDF_Type0Font_New (HPDF_MMgr mmgr,
|
99
|
+
HPDF_FontDef fontdef,
|
100
|
+
HPDF_Encoder encoder,
|
101
|
+
HPDF_Xref xref);
|
102
|
+
|
103
|
+
|
104
|
+
HPDF_BOOL
|
105
|
+
HPDF_Font_Validate (HPDF_Font font);
|
106
|
+
|
107
|
+
#ifdef __cplusplus
|
108
|
+
}
|
109
|
+
#endif /* __cplusplus */
|
110
|
+
|
111
|
+
#endif /* _HPDF_FONT_H */
|
112
|
+
|
@@ -0,0 +1,403 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.4 >> -- hpdf_fontdef.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_FONTDEF_H
|
16
|
+
#define _HPDF_FONTDEF_H
|
17
|
+
|
18
|
+
#include "hpdf_objects.h"
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif
|
23
|
+
|
24
|
+
|
25
|
+
#define HPDF_FONTDEF_SIG_BYTES 0x464F4E54L
|
26
|
+
|
27
|
+
/*------ collection of flags for defining characteristics. ---*/
|
28
|
+
|
29
|
+
#define HPDF_FONT_FIXED_WIDTH 1
|
30
|
+
#define HPDF_FONT_SERIF 2
|
31
|
+
#define HPDF_FONT_SYMBOLIC 4
|
32
|
+
#define HPDF_FONT_SCRIPT 8
|
33
|
+
/* Reserved 16 */
|
34
|
+
#define HPDF_FONT_STD_CHARSET 32
|
35
|
+
#define HPDF_FONT_ITALIC 64
|
36
|
+
/* Reserved 128
|
37
|
+
Reserved 256
|
38
|
+
Reserved 512
|
39
|
+
Reserved 1024
|
40
|
+
Reserved 2048
|
41
|
+
Reserved 4096
|
42
|
+
Reserved 8192
|
43
|
+
Reserved 16384
|
44
|
+
Reserved 32768 */
|
45
|
+
#define HPDF_FONT_ALL_CAP 65536
|
46
|
+
#define HPDF_FONT_SMALL_CAP 131072
|
47
|
+
#define HPDF_FONT_FOURCE_BOLD 262144
|
48
|
+
|
49
|
+
#define HPDF_CID_W_TYPE_FROM_TO 0
|
50
|
+
#define HPDF_CID_W_TYPE_FROM_ARRAY 1
|
51
|
+
|
52
|
+
/*-- HPDF_FontDef ---------------------------------------*/
|
53
|
+
|
54
|
+
typedef struct _HPDF_CharData {
|
55
|
+
HPDF_INT16 char_cd;
|
56
|
+
HPDF_UNICODE unicode;
|
57
|
+
HPDF_INT16 width;
|
58
|
+
} HPDF_CharData;
|
59
|
+
|
60
|
+
typedef enum _HPDF_FontDefType {
|
61
|
+
HPDF_FONTDEF_TYPE_TYPE1,
|
62
|
+
HPDF_FONTDEF_TYPE_TRUETYPE,
|
63
|
+
HPDF_FONTDEF_TYPE_CID,
|
64
|
+
HPDF_FONTDEF_TYPE_UNINITIALIZED,
|
65
|
+
HPDF_FONTDEF_TYPE_EOF
|
66
|
+
} HPDF_FontDefType;
|
67
|
+
|
68
|
+
typedef struct _HPDF_CID_Width {
|
69
|
+
HPDF_UINT16 cid;
|
70
|
+
HPDF_INT16 width;
|
71
|
+
} HPDF_CID_Width;
|
72
|
+
|
73
|
+
/*----------------------------------------------------------------------------*/
|
74
|
+
/*----- HPDF_FontDef ---------------------------------------------------------*/
|
75
|
+
|
76
|
+
typedef struct _HPDF_FontDef_Rec *HPDF_FontDef;
|
77
|
+
|
78
|
+
typedef void (*HPDF_FontDef_FreeFunc) (HPDF_FontDef fontdef);
|
79
|
+
|
80
|
+
typedef void (*HPDF_FontDef_CleanFunc) (HPDF_FontDef fontdef);
|
81
|
+
|
82
|
+
typedef HPDF_STATUS (*HPDF_FontDef_InitFunc) (HPDF_FontDef fontdef);
|
83
|
+
|
84
|
+
typedef struct _HPDF_FontDef_Rec {
|
85
|
+
HPDF_UINT32 sig_bytes;
|
86
|
+
char base_font[HPDF_LIMIT_MAX_NAME_LEN + 1];
|
87
|
+
HPDF_MMgr mmgr;
|
88
|
+
HPDF_Error error;
|
89
|
+
HPDF_FontDefType type;
|
90
|
+
HPDF_FontDef_CleanFunc clean_fn;
|
91
|
+
HPDF_FontDef_FreeFunc free_fn;
|
92
|
+
HPDF_FontDef_InitFunc init_fn;
|
93
|
+
|
94
|
+
HPDF_INT16 ascent;
|
95
|
+
HPDF_INT16 descent;
|
96
|
+
HPDF_UINT flags;
|
97
|
+
HPDF_Box font_bbox;
|
98
|
+
HPDF_INT16 italic_angle;
|
99
|
+
HPDF_UINT16 stemv;
|
100
|
+
HPDF_INT16 avg_width;
|
101
|
+
HPDF_INT16 max_width;
|
102
|
+
HPDF_INT16 missing_width;
|
103
|
+
HPDF_UINT16 stemh;
|
104
|
+
HPDF_UINT16 x_height;
|
105
|
+
HPDF_UINT16 cap_height;
|
106
|
+
|
107
|
+
/* the initial value of descriptor entry is NULL.
|
108
|
+
* when first font-object besed on the fontdef object is created,
|
109
|
+
* the font-descriptor object is created and descriptor entry is set.
|
110
|
+
*/
|
111
|
+
HPDF_Dict descriptor;
|
112
|
+
HPDF_Stream data;
|
113
|
+
|
114
|
+
HPDF_BOOL valid;
|
115
|
+
void *attr;
|
116
|
+
} HPDF_FontDef_Rec;
|
117
|
+
|
118
|
+
|
119
|
+
void
|
120
|
+
HPDF_FontDef_Free (HPDF_FontDef fontdef);
|
121
|
+
|
122
|
+
|
123
|
+
void
|
124
|
+
HPDF_FontDef_Cleanup (HPDF_FontDef fontdef);
|
125
|
+
|
126
|
+
|
127
|
+
HPDF_BOOL
|
128
|
+
HPDF_FontDef_Validate (HPDF_FontDef fontdef);
|
129
|
+
|
130
|
+
|
131
|
+
/*----------------------------------------------------------------------------*/
|
132
|
+
/*----- HPDF_Type1FontDef ---------------------------------------------------*/
|
133
|
+
|
134
|
+
typedef struct _HPDF_Type1FontDefAttrRec *HPDF_Type1FontDefAttr;
|
135
|
+
|
136
|
+
typedef struct _HPDF_Type1FontDefAttrRec {
|
137
|
+
HPDF_BYTE first_char; /* Required */
|
138
|
+
HPDF_BYTE last_char; /* Required */
|
139
|
+
HPDF_CharData *widths; /* Required */
|
140
|
+
HPDF_UINT widths_count;
|
141
|
+
|
142
|
+
HPDF_INT16 leading;
|
143
|
+
char *char_set;
|
144
|
+
char encoding_scheme[HPDF_LIMIT_MAX_NAME_LEN + 1];
|
145
|
+
HPDF_UINT length1;
|
146
|
+
HPDF_UINT length2;
|
147
|
+
HPDF_UINT length3;
|
148
|
+
HPDF_BOOL is_base14font;
|
149
|
+
HPDF_BOOL is_fixed_pitch;
|
150
|
+
|
151
|
+
HPDF_Stream font_data;
|
152
|
+
} HPDF_Type1FontDefAttr_Rec;
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
HPDF_FontDef
|
157
|
+
HPDF_Type1FontDef_New (HPDF_MMgr mmgr);
|
158
|
+
|
159
|
+
|
160
|
+
HPDF_FontDef
|
161
|
+
HPDF_Type1FontDef_Load (HPDF_MMgr mmgr,
|
162
|
+
HPDF_Stream afm,
|
163
|
+
HPDF_Stream font_data);
|
164
|
+
|
165
|
+
|
166
|
+
HPDF_FontDef
|
167
|
+
HPDF_Type1FontDef_Duplicate (HPDF_MMgr mmgr,
|
168
|
+
HPDF_FontDef src);
|
169
|
+
|
170
|
+
|
171
|
+
HPDF_STATUS
|
172
|
+
HPDF_Type1FontDef_SetWidths (HPDF_FontDef fontdef,
|
173
|
+
const HPDF_CharData *widths);
|
174
|
+
|
175
|
+
|
176
|
+
HPDF_INT16
|
177
|
+
HPDF_Type1FontDef_GetWidthByName (HPDF_FontDef fontdef,
|
178
|
+
const char *gryph_name);
|
179
|
+
|
180
|
+
|
181
|
+
HPDF_INT16
|
182
|
+
HPDF_Type1FontDef_GetWidth (HPDF_FontDef fontdef,
|
183
|
+
HPDF_UNICODE unicode);
|
184
|
+
|
185
|
+
|
186
|
+
HPDF_FontDef
|
187
|
+
HPDF_Base14FontDef_New (HPDF_MMgr mmgr,
|
188
|
+
const char *font_name);
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
/*----------------------------------------------------------------------------*/
|
193
|
+
/*----- HPDF_TTFontDef ------------------------------------------------------*/
|
194
|
+
|
195
|
+
#define HPDF_TTF_FONT_TAG_LEN 6
|
196
|
+
|
197
|
+
typedef struct _HPDF_TTF_Table {
|
198
|
+
char tag[4];
|
199
|
+
HPDF_UINT32 check_sum;
|
200
|
+
HPDF_UINT32 offset;
|
201
|
+
HPDF_UINT32 length;
|
202
|
+
} HPDF_TTFTable;
|
203
|
+
|
204
|
+
|
205
|
+
typedef struct _HPDF_TTF_OffsetTbl {
|
206
|
+
HPDF_UINT32 sfnt_version;
|
207
|
+
HPDF_UINT16 num_tables;
|
208
|
+
HPDF_UINT16 search_range;
|
209
|
+
HPDF_UINT16 entry_selector;
|
210
|
+
HPDF_UINT16 range_shift;
|
211
|
+
HPDF_TTFTable *table;
|
212
|
+
} HPDF_TTF_OffsetTbl;
|
213
|
+
|
214
|
+
|
215
|
+
typedef struct _HPDF_TTF_CmapRange {
|
216
|
+
HPDF_UINT16 format;
|
217
|
+
HPDF_UINT16 length;
|
218
|
+
HPDF_UINT16 language;
|
219
|
+
HPDF_UINT16 seg_count_x2;
|
220
|
+
HPDF_UINT16 search_range;
|
221
|
+
HPDF_UINT16 entry_selector;
|
222
|
+
HPDF_UINT16 range_shift;
|
223
|
+
HPDF_UINT16 *end_count;
|
224
|
+
HPDF_UINT16 reserved_pad;
|
225
|
+
HPDF_UINT16 *start_count;
|
226
|
+
HPDF_INT16 *id_delta;
|
227
|
+
HPDF_UINT16 *id_range_offset;
|
228
|
+
HPDF_UINT16 *glyph_id_array;
|
229
|
+
HPDF_UINT glyph_id_array_count;
|
230
|
+
} HPDF_TTF_CmapRange;
|
231
|
+
|
232
|
+
|
233
|
+
typedef struct _HPDF_TTF_GryphOffsets {
|
234
|
+
HPDF_UINT32 base_offset;
|
235
|
+
HPDF_UINT32 *offsets;
|
236
|
+
HPDF_BYTE *flgs; /* 0: unused, 1: used */
|
237
|
+
} HPDF_TTF_GryphOffsets;
|
238
|
+
|
239
|
+
|
240
|
+
typedef struct _HPDF_TTF_LongHorMetric {
|
241
|
+
HPDF_UINT16 advance_width;
|
242
|
+
HPDF_INT16 lsb;
|
243
|
+
} HPDF_TTF_LongHorMetric;
|
244
|
+
|
245
|
+
|
246
|
+
typedef struct _HPDF_TTF_FontHeader {
|
247
|
+
HPDF_BYTE version_number[4];
|
248
|
+
HPDF_UINT32 font_revision;
|
249
|
+
HPDF_UINT32 check_sum_adjustment;
|
250
|
+
HPDF_UINT32 magic_number;
|
251
|
+
HPDF_UINT16 flags;
|
252
|
+
HPDF_UINT16 units_per_em;
|
253
|
+
HPDF_BYTE created[8];
|
254
|
+
HPDF_BYTE modified[8];
|
255
|
+
HPDF_INT16 x_min;
|
256
|
+
HPDF_INT16 y_min;
|
257
|
+
HPDF_INT16 x_max;
|
258
|
+
HPDF_INT16 y_max;
|
259
|
+
HPDF_UINT16 mac_style;
|
260
|
+
HPDF_UINT16 lowest_rec_ppem;
|
261
|
+
HPDF_INT16 font_direction_hint;
|
262
|
+
HPDF_INT16 index_to_loc_format;
|
263
|
+
HPDF_INT16 glyph_data_format;
|
264
|
+
} HPDF_TTF_FontHeader;
|
265
|
+
|
266
|
+
|
267
|
+
typedef struct _HPDF_TTF_NameRecord {
|
268
|
+
HPDF_UINT16 platform_id;
|
269
|
+
HPDF_UINT16 encoding_id;
|
270
|
+
HPDF_UINT16 language_id;
|
271
|
+
HPDF_UINT16 name_id;
|
272
|
+
HPDF_UINT16 length;
|
273
|
+
HPDF_UINT16 offset;
|
274
|
+
} HPDF_TTF_NameRecord;
|
275
|
+
|
276
|
+
|
277
|
+
typedef struct _HPDF_TTF_NamingTable {
|
278
|
+
HPDF_UINT16 format;
|
279
|
+
HPDF_UINT16 count;
|
280
|
+
HPDF_UINT16 string_offset;
|
281
|
+
HPDF_TTF_NameRecord *name_records;
|
282
|
+
} HPDF_TTF_NamingTable;
|
283
|
+
|
284
|
+
|
285
|
+
typedef struct _HPDF_TTFontDefAttr_Rec *HPDF_TTFontDefAttr;
|
286
|
+
|
287
|
+
typedef struct _HPDF_TTFontDefAttr_Rec {
|
288
|
+
char base_font[HPDF_LIMIT_MAX_NAME_LEN + 1];
|
289
|
+
HPDF_BYTE first_char;
|
290
|
+
HPDF_BYTE last_char;
|
291
|
+
char *char_set;
|
292
|
+
char tag_name[HPDF_TTF_FONT_TAG_LEN + 1];
|
293
|
+
char tag_name2[(HPDF_TTF_FONT_TAG_LEN + 1) * 2];
|
294
|
+
HPDF_TTF_FontHeader header;
|
295
|
+
HPDF_TTF_GryphOffsets glyph_tbl;
|
296
|
+
HPDF_UINT16 num_glyphs;
|
297
|
+
HPDF_TTF_NamingTable name_tbl;
|
298
|
+
HPDF_TTF_LongHorMetric *h_metric;
|
299
|
+
HPDF_UINT16 num_h_metric;
|
300
|
+
HPDF_TTF_OffsetTbl offset_tbl;
|
301
|
+
HPDF_TTF_CmapRange cmap;
|
302
|
+
HPDF_UINT16 fs_type;
|
303
|
+
HPDF_BYTE panose[12];
|
304
|
+
HPDF_UINT32 code_page_range1;
|
305
|
+
HPDF_UINT32 code_page_range2;
|
306
|
+
|
307
|
+
HPDF_UINT length1;
|
308
|
+
|
309
|
+
HPDF_BOOL embedding;
|
310
|
+
HPDF_BOOL is_cidfont;
|
311
|
+
|
312
|
+
HPDF_Stream stream;
|
313
|
+
} HPDF_TTFontDefAttr_Rec;
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
HPDF_FontDef
|
318
|
+
HPDF_TTFontDef_New (HPDF_MMgr mmgr);
|
319
|
+
|
320
|
+
|
321
|
+
HPDF_FontDef
|
322
|
+
HPDF_TTFontDef_Load (HPDF_MMgr mmgr,
|
323
|
+
HPDF_Stream stream,
|
324
|
+
HPDF_BOOL embedding);
|
325
|
+
|
326
|
+
|
327
|
+
HPDF_FontDef
|
328
|
+
HPDF_TTFontDef_Load2 (HPDF_MMgr mmgr,
|
329
|
+
HPDF_Stream stream,
|
330
|
+
HPDF_UINT index,
|
331
|
+
HPDF_BOOL embedding);
|
332
|
+
|
333
|
+
|
334
|
+
HPDF_UINT16
|
335
|
+
HPDF_TTFontDef_GetGlyphid (HPDF_FontDef fontdef,
|
336
|
+
HPDF_UINT16 unicode);
|
337
|
+
|
338
|
+
|
339
|
+
HPDF_INT16
|
340
|
+
HPDF_TTFontDef_GetCharWidth (HPDF_FontDef fontdef,
|
341
|
+
HPDF_UINT16 unicode);
|
342
|
+
|
343
|
+
|
344
|
+
HPDF_INT16
|
345
|
+
HPDF_TTFontDef_GetGidWidth (HPDF_FontDef fontdef,
|
346
|
+
HPDF_UINT16 gid);
|
347
|
+
|
348
|
+
|
349
|
+
HPDF_STATUS
|
350
|
+
HPDF_TTFontDef_SaveFontData (HPDF_FontDef fontdef,
|
351
|
+
HPDF_Stream stream);
|
352
|
+
|
353
|
+
|
354
|
+
HPDF_Box
|
355
|
+
HPDF_TTFontDef_GetCharBBox (HPDF_FontDef fontdef,
|
356
|
+
HPDF_UINT16 unicode);
|
357
|
+
|
358
|
+
|
359
|
+
void
|
360
|
+
HPDF_TTFontDef_SetTagName (HPDF_FontDef fontdef,
|
361
|
+
char *tag);
|
362
|
+
|
363
|
+
|
364
|
+
/*----------------------------------------------------------------------------*/
|
365
|
+
/*----- HPDF_CIDFontDef -----------------------------------------------------*/
|
366
|
+
|
367
|
+
typedef struct _HPDF_CIDFontDefAttrRec *HPDF_CIDFontDefAttr;
|
368
|
+
|
369
|
+
typedef struct _HPDF_CIDFontDefAttrRec {
|
370
|
+
HPDF_List widths;
|
371
|
+
HPDF_INT16 DW;
|
372
|
+
HPDF_INT16 DW2[2];
|
373
|
+
} HPDF_CIDFontDefAttr_Rec;
|
374
|
+
|
375
|
+
|
376
|
+
HPDF_FontDef
|
377
|
+
HPDF_CIDFontDef_New (HPDF_MMgr mmgr,
|
378
|
+
char *name,
|
379
|
+
HPDF_FontDef_InitFunc init_fn);
|
380
|
+
|
381
|
+
|
382
|
+
HPDF_STATUS
|
383
|
+
HPDF_CIDFontDef_AddWidth (HPDF_FontDef fontdef,
|
384
|
+
const HPDF_CID_Width *widths);
|
385
|
+
|
386
|
+
|
387
|
+
HPDF_INT16
|
388
|
+
HPDF_CIDFontDef_GetCIDWidth (HPDF_FontDef fontdef,
|
389
|
+
HPDF_UINT16 cid);
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
HPDF_STATUS
|
394
|
+
HPDF_CIDFontDef_ChangeStyle (HPDF_FontDef fontdef,
|
395
|
+
HPDF_BOOL bold,
|
396
|
+
HPDF_BOOL italic);
|
397
|
+
|
398
|
+
#ifdef __cplusplus
|
399
|
+
}
|
400
|
+
#endif /* __cplusplus */
|
401
|
+
|
402
|
+
#endif /* _HPDF_FONTDEF_H */
|
403
|
+
|