hpdf 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,194 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_fontdef_cid.c
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2004 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
|
+
#include "hpdf_conf.h"
|
16
|
+
#include "hpdf_utils.h"
|
17
|
+
#include "hpdf_fontdef.h"
|
18
|
+
|
19
|
+
void
|
20
|
+
HPDF_CIDFontDef_FreeWidth (HPDF_FontDef fontdef);
|
21
|
+
|
22
|
+
|
23
|
+
void
|
24
|
+
HPDF_CIDFontDef_FreeFunc (HPDF_FontDef fontdef);
|
25
|
+
|
26
|
+
|
27
|
+
/*----------------------------------------------------------------------*/
|
28
|
+
/*----- HPDF_CIDFontDef ------------------------------------------------*/
|
29
|
+
|
30
|
+
void
|
31
|
+
HPDF_CIDFontDef_FreeWidth (HPDF_FontDef fontdef)
|
32
|
+
{
|
33
|
+
HPDF_CIDFontDefAttr attr = (HPDF_CIDFontDefAttr)fontdef->attr;
|
34
|
+
HPDF_UINT i;
|
35
|
+
|
36
|
+
HPDF_PTRACE ((" HPDF_FontDef_Validate\n"));
|
37
|
+
|
38
|
+
for (i = 0; i < attr->widths->count; i++) {
|
39
|
+
HPDF_CID_Width *w =
|
40
|
+
(HPDF_CID_Width *)HPDF_List_ItemAt (attr->widths, i);
|
41
|
+
|
42
|
+
HPDF_FreeMem (fontdef->mmgr, w);
|
43
|
+
}
|
44
|
+
|
45
|
+
HPDF_List_Free (attr->widths);
|
46
|
+
attr->widths = NULL;
|
47
|
+
|
48
|
+
fontdef->valid = HPDF_FALSE;
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
HPDF_FontDef
|
53
|
+
HPDF_CIDFontDef_New (HPDF_MMgr mmgr,
|
54
|
+
char *name,
|
55
|
+
HPDF_FontDef_InitFunc init_fn)
|
56
|
+
{
|
57
|
+
HPDF_FontDef fontdef;
|
58
|
+
HPDF_CIDFontDefAttr fontdef_attr;
|
59
|
+
|
60
|
+
HPDF_PTRACE ((" HPDF_CIDFontDef_New\n"));
|
61
|
+
|
62
|
+
if (!mmgr)
|
63
|
+
return NULL;
|
64
|
+
|
65
|
+
fontdef = HPDF_GetMem (mmgr, sizeof(HPDF_FontDef_Rec));
|
66
|
+
if (!fontdef)
|
67
|
+
return NULL;
|
68
|
+
|
69
|
+
HPDF_MemSet (fontdef, 0, sizeof(HPDF_FontDef_Rec));
|
70
|
+
fontdef->sig_bytes = HPDF_FONTDEF_SIG_BYTES;
|
71
|
+
HPDF_StrCpy (fontdef->base_font, name, fontdef->base_font +
|
72
|
+
HPDF_LIMIT_MAX_NAME_LEN);
|
73
|
+
fontdef->mmgr = mmgr;
|
74
|
+
fontdef->error = mmgr->error;
|
75
|
+
fontdef->type = HPDF_FONTDEF_TYPE_UNINITIALIZED;
|
76
|
+
fontdef->free_fn = HPDF_CIDFontDef_FreeFunc;
|
77
|
+
fontdef->init_fn = init_fn;
|
78
|
+
fontdef->valid = HPDF_FALSE;
|
79
|
+
fontdef_attr = HPDF_GetMem (mmgr, sizeof(HPDF_CIDFontDefAttr_Rec));
|
80
|
+
if (!fontdef_attr) {
|
81
|
+
HPDF_FreeMem (fontdef->mmgr, fontdef);
|
82
|
+
return NULL;
|
83
|
+
}
|
84
|
+
|
85
|
+
fontdef->attr = fontdef_attr;
|
86
|
+
HPDF_MemSet ((HPDF_BYTE *)fontdef_attr, 0,
|
87
|
+
sizeof(HPDF_CIDFontDefAttr_Rec));
|
88
|
+
|
89
|
+
fontdef_attr->widths = HPDF_List_New (mmgr, HPDF_DEF_CHAR_WIDTHS_NUM);
|
90
|
+
if (!fontdef_attr->widths) {
|
91
|
+
HPDF_FreeMem (fontdef->mmgr, fontdef);
|
92
|
+
HPDF_FreeMem (fontdef->mmgr, fontdef_attr);
|
93
|
+
return NULL;
|
94
|
+
}
|
95
|
+
|
96
|
+
fontdef->missing_width = 500;
|
97
|
+
fontdef_attr->DW = 1000;
|
98
|
+
fontdef_attr->DW2[0] = 880;
|
99
|
+
fontdef_attr->DW2[1] = -1000;
|
100
|
+
|
101
|
+
return fontdef;
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
HPDF_INT16
|
106
|
+
HPDF_CIDFontDef_GetCIDWidth (HPDF_FontDef fontdef,
|
107
|
+
HPDF_UINT16 cid)
|
108
|
+
{
|
109
|
+
HPDF_CIDFontDefAttr attr = (HPDF_CIDFontDefAttr)fontdef->attr;
|
110
|
+
HPDF_UINT i;
|
111
|
+
|
112
|
+
HPDF_PTRACE ((" HPDF_CIDFontDef_GetCIDWidth\n"));
|
113
|
+
|
114
|
+
for (i = 0; i < attr->widths->count; i++) {
|
115
|
+
HPDF_CID_Width *w = (HPDF_CID_Width *)HPDF_List_ItemAt (attr->widths,
|
116
|
+
i);
|
117
|
+
|
118
|
+
if (w->cid == cid)
|
119
|
+
return w->width;
|
120
|
+
}
|
121
|
+
|
122
|
+
/* Not found in pdf_cid_width array. */
|
123
|
+
return attr->DW;
|
124
|
+
}
|
125
|
+
|
126
|
+
void
|
127
|
+
HPDF_CIDFontDef_FreeFunc (HPDF_FontDef fontdef)
|
128
|
+
{
|
129
|
+
HPDF_CIDFontDefAttr attr = (HPDF_CIDFontDefAttr)fontdef->attr;
|
130
|
+
|
131
|
+
HPDF_PTRACE ((" HPDF_CIDFontDef_FreeFunc\n"));
|
132
|
+
|
133
|
+
HPDF_CIDFontDef_FreeWidth (fontdef);
|
134
|
+
HPDF_FreeMem (fontdef->mmgr, attr);
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
HPDF_STATUS
|
139
|
+
HPDF_CIDFontDef_AddWidth (HPDF_FontDef fontdef,
|
140
|
+
const HPDF_CID_Width *widths)
|
141
|
+
{
|
142
|
+
HPDF_CIDFontDefAttr attr = (HPDF_CIDFontDefAttr)fontdef->attr;
|
143
|
+
|
144
|
+
HPDF_PTRACE ((" HPDF_CIDFontDef_AddWidth\n"));
|
145
|
+
|
146
|
+
while (widths->cid != 0xFFFF) {
|
147
|
+
HPDF_CID_Width *w = HPDF_GetMem (fontdef->mmgr,
|
148
|
+
sizeof (HPDF_CID_Width));
|
149
|
+
HPDF_STATUS ret;
|
150
|
+
|
151
|
+
if (!w)
|
152
|
+
return fontdef->error->error_no;
|
153
|
+
|
154
|
+
w->cid = widths->cid;
|
155
|
+
w->width = widths->width;
|
156
|
+
|
157
|
+
if ((ret = HPDF_List_Add (attr->widths, w)) != HPDF_OK) {
|
158
|
+
HPDF_FreeMem (fontdef->mmgr, w);
|
159
|
+
|
160
|
+
return ret;
|
161
|
+
}
|
162
|
+
|
163
|
+
widths++;
|
164
|
+
}
|
165
|
+
|
166
|
+
return HPDF_OK;
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
HPDF_STATUS
|
171
|
+
HPDF_CIDFontDef_ChangeStyle (HPDF_FontDef fontdef,
|
172
|
+
HPDF_BOOL bold,
|
173
|
+
HPDF_BOOL italic)
|
174
|
+
{
|
175
|
+
HPDF_PTRACE ((" HPDF_CIDFontDef_ChangeStyle\n"));
|
176
|
+
|
177
|
+
if (!fontdef || !fontdef->attr)
|
178
|
+
return HPDF_INVALID_FONTDEF_DATA;
|
179
|
+
|
180
|
+
if (bold) {
|
181
|
+
fontdef->stemv *= 2;
|
182
|
+
fontdef->flags |= HPDF_FONT_FOURCE_BOLD;
|
183
|
+
}
|
184
|
+
|
185
|
+
if (italic) {
|
186
|
+
fontdef->italic_angle -= 11;
|
187
|
+
fontdef->flags |= HPDF_FONT_ITALIC;
|
188
|
+
}
|
189
|
+
|
190
|
+
return HPDF_OK;
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
@@ -0,0 +1,471 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_fontdef_cns.c
|
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
|
+
#include "hpdf_conf.h"
|
16
|
+
#include "hpdf_utils.h"
|
17
|
+
#include "hpdf.h"
|
18
|
+
|
19
|
+
/*----------------------------------------------------------------------------*/
|
20
|
+
|
21
|
+
static const HPDF_CID_Width SIMSUN_W_ARRAY[] = {
|
22
|
+
{668, 500},
|
23
|
+
{669, 500},
|
24
|
+
{670, 500},
|
25
|
+
{671, 500},
|
26
|
+
{672, 500},
|
27
|
+
{673, 500},
|
28
|
+
{674, 500},
|
29
|
+
{675, 500},
|
30
|
+
{676, 500},
|
31
|
+
{677, 500},
|
32
|
+
{678, 500},
|
33
|
+
{679, 500},
|
34
|
+
{680, 500},
|
35
|
+
{681, 500},
|
36
|
+
{682, 500},
|
37
|
+
{683, 500},
|
38
|
+
{684, 500},
|
39
|
+
{685, 500},
|
40
|
+
{686, 500},
|
41
|
+
{687, 500},
|
42
|
+
{688, 500},
|
43
|
+
{689, 500},
|
44
|
+
{690, 500},
|
45
|
+
{691, 500},
|
46
|
+
{692, 500},
|
47
|
+
{693, 500},
|
48
|
+
{694, 500},
|
49
|
+
{696, 500},
|
50
|
+
{697, 500},
|
51
|
+
{698, 500},
|
52
|
+
{699, 500},
|
53
|
+
{814, 500},
|
54
|
+
{815, 500},
|
55
|
+
{816, 500},
|
56
|
+
{817, 500},
|
57
|
+
{818, 500},
|
58
|
+
{819, 500},
|
59
|
+
{820, 500},
|
60
|
+
{821, 500},
|
61
|
+
{822, 500},
|
62
|
+
{823, 500},
|
63
|
+
{824, 500},
|
64
|
+
{825, 500},
|
65
|
+
{826, 500},
|
66
|
+
{827, 500},
|
67
|
+
{828, 500},
|
68
|
+
{829, 500},
|
69
|
+
{830, 500},
|
70
|
+
{831, 500},
|
71
|
+
{832, 500},
|
72
|
+
{833, 500},
|
73
|
+
{834, 500},
|
74
|
+
{835, 500},
|
75
|
+
{836, 500},
|
76
|
+
{837, 500},
|
77
|
+
{838, 500},
|
78
|
+
{839, 500},
|
79
|
+
{840, 500},
|
80
|
+
{841, 500},
|
81
|
+
{842, 500},
|
82
|
+
{843, 500},
|
83
|
+
{844, 500},
|
84
|
+
{845, 500},
|
85
|
+
{846, 500},
|
86
|
+
{847, 500},
|
87
|
+
{848, 500},
|
88
|
+
{849, 500},
|
89
|
+
{850, 500},
|
90
|
+
{851, 500},
|
91
|
+
{852, 500},
|
92
|
+
{853, 500},
|
93
|
+
{854, 500},
|
94
|
+
{855, 500},
|
95
|
+
{856, 500},
|
96
|
+
{857, 500},
|
97
|
+
{858, 500},
|
98
|
+
{859, 500},
|
99
|
+
{860, 500},
|
100
|
+
{861, 500},
|
101
|
+
{862, 500},
|
102
|
+
{863, 500},
|
103
|
+
{864, 500},
|
104
|
+
{865, 500},
|
105
|
+
{866, 500},
|
106
|
+
{867, 500},
|
107
|
+
{868, 500},
|
108
|
+
{869, 500},
|
109
|
+
{870, 500},
|
110
|
+
{871, 500},
|
111
|
+
{872, 500},
|
112
|
+
{873, 500},
|
113
|
+
{874, 500},
|
114
|
+
{875, 500},
|
115
|
+
{876, 500},
|
116
|
+
{877, 500},
|
117
|
+
{878, 500},
|
118
|
+
{879, 500},
|
119
|
+
{880, 500},
|
120
|
+
{881, 500},
|
121
|
+
{882, 500},
|
122
|
+
{883, 500},
|
123
|
+
{884, 500},
|
124
|
+
{885, 500},
|
125
|
+
{886, 500},
|
126
|
+
{887, 500},
|
127
|
+
{888, 500},
|
128
|
+
{889, 500},
|
129
|
+
{890, 500},
|
130
|
+
{891, 500},
|
131
|
+
{892, 500},
|
132
|
+
{893, 500},
|
133
|
+
{894, 500},
|
134
|
+
{895, 500},
|
135
|
+
{896, 500},
|
136
|
+
{897, 500},
|
137
|
+
{898, 500},
|
138
|
+
{899, 500},
|
139
|
+
{900, 500},
|
140
|
+
{901, 500},
|
141
|
+
{902, 500},
|
142
|
+
{903, 500},
|
143
|
+
{904, 500},
|
144
|
+
{905, 500},
|
145
|
+
{906, 500},
|
146
|
+
{907, 500},
|
147
|
+
{7716, 500},
|
148
|
+
{0xFFFF, 0}
|
149
|
+
};
|
150
|
+
|
151
|
+
|
152
|
+
static const HPDF_CID_Width SIMHEI_W_ARRAY[] = {
|
153
|
+
{668, 500},
|
154
|
+
{669, 500},
|
155
|
+
{670, 500},
|
156
|
+
{671, 500},
|
157
|
+
{672, 500},
|
158
|
+
{673, 500},
|
159
|
+
{674, 500},
|
160
|
+
{675, 500},
|
161
|
+
{676, 500},
|
162
|
+
{677, 500},
|
163
|
+
{678, 500},
|
164
|
+
{679, 500},
|
165
|
+
{680, 500},
|
166
|
+
{681, 500},
|
167
|
+
{682, 500},
|
168
|
+
{683, 500},
|
169
|
+
{684, 500},
|
170
|
+
{685, 500},
|
171
|
+
{686, 500},
|
172
|
+
{687, 500},
|
173
|
+
{688, 500},
|
174
|
+
{689, 500},
|
175
|
+
{690, 500},
|
176
|
+
{691, 500},
|
177
|
+
{692, 500},
|
178
|
+
{693, 500},
|
179
|
+
{694, 500},
|
180
|
+
{696, 500},
|
181
|
+
{697, 500},
|
182
|
+
{698, 500},
|
183
|
+
{699, 500},
|
184
|
+
{814, 500},
|
185
|
+
{815, 500},
|
186
|
+
{816, 500},
|
187
|
+
{817, 500},
|
188
|
+
{818, 500},
|
189
|
+
{819, 500},
|
190
|
+
{820, 500},
|
191
|
+
{821, 500},
|
192
|
+
{822, 500},
|
193
|
+
{823, 500},
|
194
|
+
{824, 500},
|
195
|
+
{825, 500},
|
196
|
+
{826, 500},
|
197
|
+
{827, 500},
|
198
|
+
{828, 500},
|
199
|
+
{829, 500},
|
200
|
+
{830, 500},
|
201
|
+
{831, 500},
|
202
|
+
{832, 500},
|
203
|
+
{833, 500},
|
204
|
+
{834, 500},
|
205
|
+
{835, 500},
|
206
|
+
{836, 500},
|
207
|
+
{837, 500},
|
208
|
+
{838, 500},
|
209
|
+
{839, 500},
|
210
|
+
{840, 500},
|
211
|
+
{841, 500},
|
212
|
+
{842, 500},
|
213
|
+
{843, 500},
|
214
|
+
{844, 500},
|
215
|
+
{845, 500},
|
216
|
+
{846, 500},
|
217
|
+
{847, 500},
|
218
|
+
{848, 500},
|
219
|
+
{849, 500},
|
220
|
+
{850, 500},
|
221
|
+
{851, 500},
|
222
|
+
{852, 500},
|
223
|
+
{853, 500},
|
224
|
+
{854, 500},
|
225
|
+
{855, 500},
|
226
|
+
{856, 500},
|
227
|
+
{857, 500},
|
228
|
+
{858, 500},
|
229
|
+
{859, 500},
|
230
|
+
{860, 500},
|
231
|
+
{861, 500},
|
232
|
+
{862, 500},
|
233
|
+
{863, 500},
|
234
|
+
{864, 500},
|
235
|
+
{865, 500},
|
236
|
+
{866, 500},
|
237
|
+
{867, 500},
|
238
|
+
{868, 500},
|
239
|
+
{869, 500},
|
240
|
+
{870, 500},
|
241
|
+
{871, 500},
|
242
|
+
{872, 500},
|
243
|
+
{873, 500},
|
244
|
+
{874, 500},
|
245
|
+
{875, 500},
|
246
|
+
{876, 500},
|
247
|
+
{877, 500},
|
248
|
+
{878, 500},
|
249
|
+
{879, 500},
|
250
|
+
{880, 500},
|
251
|
+
{881, 500},
|
252
|
+
{882, 500},
|
253
|
+
{883, 500},
|
254
|
+
{884, 500},
|
255
|
+
{885, 500},
|
256
|
+
{886, 500},
|
257
|
+
{887, 500},
|
258
|
+
{888, 500},
|
259
|
+
{889, 500},
|
260
|
+
{890, 500},
|
261
|
+
{891, 500},
|
262
|
+
{892, 500},
|
263
|
+
{893, 500},
|
264
|
+
{894, 500},
|
265
|
+
{895, 500},
|
266
|
+
{896, 500},
|
267
|
+
{897, 500},
|
268
|
+
{898, 500},
|
269
|
+
{899, 500},
|
270
|
+
{900, 500},
|
271
|
+
{901, 500},
|
272
|
+
{902, 500},
|
273
|
+
{903, 500},
|
274
|
+
{904, 500},
|
275
|
+
{905, 500},
|
276
|
+
{906, 500},
|
277
|
+
{907, 500},
|
278
|
+
{7716, 500},
|
279
|
+
{0xFFFF, 0}
|
280
|
+
};
|
281
|
+
|
282
|
+
|
283
|
+
/*---------------------------------------------------------------------------*/
|
284
|
+
/*----- SimHei Font ---------------------------------------------------------*/
|
285
|
+
|
286
|
+
|
287
|
+
static HPDF_STATUS
|
288
|
+
SimSun_Init (HPDF_FontDef fontdef)
|
289
|
+
{
|
290
|
+
HPDF_STATUS ret;
|
291
|
+
|
292
|
+
HPDF_PTRACE ((" HPDF_FontDef_SimSun_Init\n"));
|
293
|
+
|
294
|
+
fontdef->ascent = 859;
|
295
|
+
fontdef->descent = -140;
|
296
|
+
fontdef->cap_height = 683;
|
297
|
+
fontdef->font_bbox = HPDF_ToBox(0, -140, 996, 855);
|
298
|
+
fontdef->flags = HPDF_FONT_SYMBOLIC + HPDF_FONT_FIXED_WIDTH +
|
299
|
+
HPDF_FONT_SERIF;
|
300
|
+
fontdef->italic_angle = 0;
|
301
|
+
fontdef->stemv = 78;
|
302
|
+
if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, SIMSUN_W_ARRAY)) !=
|
303
|
+
HPDF_OK) {
|
304
|
+
return ret;
|
305
|
+
}
|
306
|
+
|
307
|
+
fontdef->type = HPDF_FONTDEF_TYPE_CID;
|
308
|
+
fontdef->valid = HPDF_TRUE;
|
309
|
+
|
310
|
+
return HPDF_OK;
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
static HPDF_STATUS
|
315
|
+
SimSun_Bold_Init (HPDF_FontDef fontdef)
|
316
|
+
{
|
317
|
+
HPDF_STATUS ret = SimSun_Init (fontdef);
|
318
|
+
|
319
|
+
if (ret != HPDF_OK)
|
320
|
+
return ret;
|
321
|
+
|
322
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_FALSE);
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
static HPDF_STATUS
|
327
|
+
SimSun_Italic_Init (HPDF_FontDef fontdef)
|
328
|
+
{
|
329
|
+
HPDF_STATUS ret = SimSun_Init (fontdef);
|
330
|
+
|
331
|
+
if (ret != HPDF_OK)
|
332
|
+
return ret;
|
333
|
+
|
334
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_FALSE, HPDF_TRUE);
|
335
|
+
}
|
336
|
+
|
337
|
+
static HPDF_STATUS
|
338
|
+
SimSun_BoldItalic_Init (HPDF_FontDef fontdef)
|
339
|
+
{
|
340
|
+
HPDF_STATUS ret = SimSun_Init (fontdef);
|
341
|
+
|
342
|
+
if (ret != HPDF_OK)
|
343
|
+
return ret;
|
344
|
+
|
345
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_TRUE);
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
static HPDF_STATUS
|
350
|
+
SimHei_Init (HPDF_FontDef fontdef)
|
351
|
+
{
|
352
|
+
HPDF_STATUS ret;
|
353
|
+
|
354
|
+
HPDF_PTRACE ((" HPDF_FontDef_SimHei_Init\n"));
|
355
|
+
|
356
|
+
fontdef->ascent = 859;
|
357
|
+
fontdef->descent = -140;
|
358
|
+
fontdef->cap_height = 769;
|
359
|
+
fontdef->font_bbox = HPDF_ToBox(-0, -140, 996, 855);
|
360
|
+
fontdef->flags = HPDF_FONT_SYMBOLIC + HPDF_FONT_FIXED_WIDTH;
|
361
|
+
fontdef->italic_angle = 0;
|
362
|
+
fontdef->stemv = 78;
|
363
|
+
if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, SIMHEI_W_ARRAY)) !=
|
364
|
+
HPDF_OK) {
|
365
|
+
return ret;
|
366
|
+
}
|
367
|
+
|
368
|
+
fontdef->type = HPDF_FONTDEF_TYPE_CID;
|
369
|
+
fontdef->valid = HPDF_TRUE;
|
370
|
+
|
371
|
+
return HPDF_OK;
|
372
|
+
}
|
373
|
+
|
374
|
+
|
375
|
+
static HPDF_STATUS
|
376
|
+
SimHei_Bold_Init (HPDF_FontDef fontdef)
|
377
|
+
{
|
378
|
+
HPDF_STATUS ret = SimHei_Init (fontdef);
|
379
|
+
|
380
|
+
if (ret != HPDF_OK)
|
381
|
+
return ret;
|
382
|
+
|
383
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_FALSE);
|
384
|
+
}
|
385
|
+
|
386
|
+
|
387
|
+
static HPDF_STATUS
|
388
|
+
SimHei_Italic_Init (HPDF_FontDef fontdef)
|
389
|
+
{
|
390
|
+
HPDF_STATUS ret = SimHei_Init (fontdef);
|
391
|
+
|
392
|
+
if (ret != HPDF_OK)
|
393
|
+
return ret;
|
394
|
+
|
395
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_FALSE, HPDF_TRUE);
|
396
|
+
}
|
397
|
+
|
398
|
+
static HPDF_STATUS
|
399
|
+
SimHei_BoldItalic_Init (HPDF_FontDef fontdef)
|
400
|
+
{
|
401
|
+
HPDF_STATUS ret = SimHei_Init (fontdef);
|
402
|
+
|
403
|
+
if (ret != HPDF_OK)
|
404
|
+
return ret;
|
405
|
+
|
406
|
+
return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_TRUE);
|
407
|
+
}
|
408
|
+
|
409
|
+
|
410
|
+
HPDF_EXPORT(HPDF_STATUS)
|
411
|
+
HPDF_UseCNSFonts (HPDF_Doc pdf)
|
412
|
+
{
|
413
|
+
HPDF_FontDef fontdef;
|
414
|
+
HPDF_STATUS ret;
|
415
|
+
|
416
|
+
if (!HPDF_HasDoc (pdf))
|
417
|
+
return HPDF_INVALID_DOCUMENT;
|
418
|
+
|
419
|
+
/* SimSun */
|
420
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimSun",
|
421
|
+
SimSun_Init);
|
422
|
+
|
423
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
424
|
+
return ret;
|
425
|
+
|
426
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimSun,Bold",
|
427
|
+
SimSun_Bold_Init);
|
428
|
+
|
429
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
430
|
+
return ret;
|
431
|
+
|
432
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimSun,Italic",
|
433
|
+
SimSun_Italic_Init);
|
434
|
+
|
435
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
436
|
+
return ret;
|
437
|
+
|
438
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimSun,BoldItalic",
|
439
|
+
SimSun_BoldItalic_Init);
|
440
|
+
|
441
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
442
|
+
return ret;
|
443
|
+
|
444
|
+
/* SimHei */
|
445
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimHei",
|
446
|
+
SimHei_Init);
|
447
|
+
|
448
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
449
|
+
return ret;
|
450
|
+
|
451
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimHei,Bold",
|
452
|
+
SimHei_Bold_Init);
|
453
|
+
|
454
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
455
|
+
return ret;
|
456
|
+
|
457
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimHei,Italic",
|
458
|
+
SimHei_Italic_Init);
|
459
|
+
|
460
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
461
|
+
return ret;
|
462
|
+
|
463
|
+
fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "SimHei,BoldItalic",
|
464
|
+
SimHei_BoldItalic_Init);
|
465
|
+
|
466
|
+
if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
|
467
|
+
return ret;
|
468
|
+
|
469
|
+
return HPDF_OK;
|
470
|
+
}
|
471
|
+
|