2 * << Haru Free PDF Library >> -- hpdf_fontdef_cnt.c
4 * URL: http://libharu.org
6 * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
7 * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
9 * Permission to use, copy, modify, distribute and sell this software
10 * and its documentation for any purpose is hereby granted without fee,
11 * provided that the above copyright notice appear in all copies and
12 * that both that copyright notice and this permission notice appear
13 * in supporting documentation.
14 * It is provided "as is" without express or implied warranty.
18 #include "hpdf_conf.h"
19 #include "hpdf_utils.h"
22 /*----------------------------------------------------------------------------*/
24 static const HPDF_CID_Width MING_LIU_W_ARRAY[] = {
156 MingLiU_Init (HPDF_FontDef fontdef)
160 HPDF_PTRACE ((" HPDF_FontDef_MingLiU_Init\n"));
162 fontdef->ascent = 800;
163 fontdef->descent = -199;
164 fontdef->cap_height = 769;
165 fontdef->font_bbox = HPDF_ToBox(0, -199, 1000, 800);
166 fontdef->flags = HPDF_FONT_SYMBOLIC + HPDF_FONT_FIXED_WIDTH +
168 fontdef->italic_angle = 0;
170 if ((ret = HPDF_CIDFontDef_AddWidth (fontdef, MING_LIU_W_ARRAY)) !=
175 fontdef->type = HPDF_FONTDEF_TYPE_CID;
176 fontdef->valid = HPDF_TRUE;
183 MingLiU_Bold_Init (HPDF_FontDef fontdef)
185 HPDF_STATUS ret = MingLiU_Init (fontdef);
190 return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_FALSE);
195 MingLiU_Italic_Init (HPDF_FontDef fontdef)
197 HPDF_STATUS ret = MingLiU_Init (fontdef);
202 return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_FALSE, HPDF_TRUE);
206 MingLiU_BoldItalic_Init (HPDF_FontDef fontdef)
208 HPDF_STATUS ret = MingLiU_Init (fontdef);
213 return HPDF_CIDFontDef_ChangeStyle (fontdef, HPDF_TRUE, HPDF_TRUE);
217 HPDF_EXPORT(HPDF_STATUS)
218 HPDF_UseCNTFonts (HPDF_Doc pdf)
220 HPDF_FontDef fontdef;
223 if (!HPDF_HasDoc (pdf))
224 return HPDF_INVALID_DOCUMENT;
227 fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "MingLiU",
230 if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
233 fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "MingLiU,Bold",
236 if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
239 fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "MingLiU,Italic",
240 MingLiU_Italic_Init);
242 if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)
245 fontdef = HPDF_CIDFontDef_New (pdf->mmgr, "MingLiU,BoldItalic",
246 MingLiU_BoldItalic_Init);
248 if ((ret = HPDF_Doc_RegisterFontDef (pdf, fontdef)) != HPDF_OK)