1 /* Copyright (C) 1989, 1993, 1996, 1997 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: gsfont.h,v 1.12 2005/07/27 11:24:38 igor Exp $ */ 18 /* Generic font and font cache interface */ 19 20 #ifndef gsfont_INCLUDED 21 # define gsfont_INCLUDED 22 23 #ifndef gs_matrix_DEFINED 24 # define gs_matrix_DEFINED 25 typedef struct gs_matrix_s gs_matrix; 26 #endif 27 28 /* A 'font directory' object (to avoid making fonts global). */ 29 /* 'directory' is something of a misnomer: this structure */ 30 /* just keeps track of the defined fonts, and the scaled font and */ 31 /* rendered character caches. */ 32 #ifndef gs_font_dir_DEFINED 33 # define gs_font_dir_DEFINED 34 typedef struct gs_font_dir_s gs_font_dir; 35 #endif 36 37 /* Font objects */ 38 #ifndef gs_font_DEFINED 39 # define gs_font_DEFINED 40 typedef struct gs_font_s gs_font; 41 #endif 42 43 /* Initialization */ 44 /* These procedures return 0 if they fail. */ 45 gs_font_dir *gs_font_dir_alloc2(gs_memory_t * struct_mem, 46 gs_memory_t * bits_mem); 47 gs_font_dir *gs_font_dir_alloc2_limits(gs_memory_t * struct_mem, 48 gs_memory_t * bits_mem, 49 uint smax, uint bmax, uint mmax, 50 uint cmax, uint upper); 51 52 /* Backward compatibility */ 53 #define gs_font_dir_alloc(mem) gs_font_dir_alloc2(mem, mem) 54 #define gs_font_dir_alloc_limits(mem, smax, bmax, mmax, cmax, upper)\ 55 gs_font_dir_alloc2_limits(mem, mem, smax, bmax, mmax, cmax, upper) 56 57 /* Font manipulations */ 58 /* Use gs_definefont only with original (unscaled) fonts! */ 59 int gs_definefont(gs_font_dir *, gs_font *); 60 61 /* Find a sililar registered font of same type. */ 62 int gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont, 63 int (*similar)(const gs_font *, const gs_font *)); 64 65 /* gs_scalefont and gs_makefont return 0 if the scaled font */ 66 /* was already in the cache, 1 if a new font was created. */ 67 int gs_scalefont(gs_font_dir *, const gs_font *, floatp, gs_font **); 68 int gs_makefont(gs_font_dir *, const gs_font *, const gs_matrix *, gs_font **); 69 int gs_setfont(gs_state *, gs_font *); 70 gs_font *gs_currentfont(const gs_state *); 71 gs_font *gs_rootfont(const gs_state *); 72 void gs_set_currentfont(gs_state *, gs_font *); 73 void gs_purge_font(gs_font *); 74 /* Locate a gs_font by gs_id. */ 75 gs_font *gs_find_font_by_id(gs_font_dir *pdir, gs_id id, gs_matrix *FontMatrix); 76 77 /* Font cache parameter operations */ 78 void gs_cachestatus(const gs_font_dir *, uint[7]); 79 80 #define gs_setcachelimit(pdir,limit) gs_setcacheupper(pdir,limit) 81 uint gs_currentcachesize(const gs_font_dir *); 82 int gs_setcachesize(gs_font_dir *, uint); 83 uint gs_currentcachelower(const gs_font_dir *); 84 int gs_setcachelower(gs_font_dir *, uint); 85 uint gs_currentcacheupper(const gs_font_dir *); 86 int gs_setcacheupper(gs_font_dir *, uint); 87 uint gs_currentaligntopixels(const gs_font_dir *); 88 int gs_setaligntopixels(gs_font_dir *, uint); 89 uint gs_currentgridfittt(const gs_font_dir *); 90 int gs_setgridfittt(gs_font_dir *, uint); 91 92 #endif /* gsfont_INCLUDED */ 93