| 1 | /* |
|---|---|
| 2 | * << Haru Free PDF Library >> -- hpdf_fontdef.c |
| 3 | * |
| 4 | * URL: http://libharu.org |
| 5 | * |
| 6 | * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> |
| 7 | * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org> |
| 8 | * |
| 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. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #include "hpdf_conf.h" |
| 19 | #include "hpdf_utils.h" |
| 20 | #include "hpdf_fontdef.h" |
| 21 | |
| 22 | void |
| 23 | HPDF_FontDef_Cleanup (HPDF_FontDef fontdef) |
| 24 | { |
| 25 | if (!fontdef) |
| 26 | return; |
| 27 | |
| 28 | HPDF_PTRACE ((" HPDF_FontDef_Cleanup\n")); |
| 29 | |
| 30 | if (fontdef->clean_fn) |
| 31 | fontdef->clean_fn (fontdef); |
| 32 | |
| 33 | fontdef->descriptor = NULL; |
| 34 | } |
| 35 | |
| 36 | void |
| 37 | HPDF_FontDef_Free (HPDF_FontDef fontdef) |
| 38 | { |
| 39 | if (!fontdef) |
| 40 | return; |
| 41 | |
| 42 | HPDF_PTRACE ((" HPDF_FontDef_Free\n")); |
| 43 | |
| 44 | if (fontdef->free_fn) |
| 45 | fontdef->free_fn (fontdef); |
| 46 | HPDF_FreeMem (fontdef->mmgr, fontdef); |
| 47 | } |
| 48 | |
| 49 | HPDF_BOOL |
| 50 | HPDF_FontDef_Validate (HPDF_FontDef fontdef) |
| 51 | { |
| 52 | HPDF_PTRACE ((" HPDF_FontDef_Validate\n")); |
| 53 | |
| 54 | if (!fontdef || fontdef->sig_bytes != HPDF_FONTDEF_SIG_BYTES) |
| 55 | return HPDF_FALSE; |
| 56 | else |
| 57 | return HPDF_TRUE; |
| 58 | } |
| 59 | |
| 60 |