1 /* Copyright (C) 1989, 1993, 1996, 1997 artofcode LLC. All rights reserved. 2 3 This program is free software; you can redistribute it and/or modify it 4 under the terms of the GNU General Public License as published by the 5 Free Software Foundation; either version 2 of the License, or (at your 6 option) any later version. 7 8 This program is distributed in the hope that it will be useful, but 9 WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along 14 with this program; if not, write to the Free Software Foundation, Inc., 15 59 Temple Place, Suite 330, Boston, MA, 02111-1307. 16 17 */ 18 19 /*$Id: gsfont.h,v 1.2.6.1.2.1 2003/01/17 00:49:02 giles Exp $ */ 20 /* Generic font and font cache interface */ 21 /* Requires gsmatrix.h */ 22 23 #ifndef gsfont_INCLUDED 24 # define gsfont_INCLUDED 25 26 /* A 'font directory' object (to avoid making fonts global). */ 27 /* 'directory' is something of a misnomer: this structure */ 28 /* just keeps track of the defined fonts, and the scaled font and */ 29 /* rendered character caches. */ 30 #ifndef gs_font_dir_DEFINED 31 # define gs_font_dir_DEFINED 32 typedef struct gs_font_dir_s gs_font_dir; 33 #endif 34 35 /* Font objects */ 36 #ifndef gs_font_DEFINED 37 # define gs_font_DEFINED 38 typedef struct gs_font_s gs_font; 39 #endif 40 41 /* Initialization */ 42 /* These procedures return 0 if they fail. */ 43 gs_font_dir *gs_font_dir_alloc2(P2(gs_memory_t * struct_mem, 44 gs_memory_t * bits_mem)); 45 gs_font_dir *gs_font_dir_alloc2_limits(P7(gs_memory_t * struct_mem, 46 gs_memory_t * bits_mem, 47 uint smax, uint bmax, uint mmax, 48 uint cmax, uint upper)); 49 50 /* Backward compatibility */ 51 #define gs_font_dir_alloc(mem) gs_font_dir_alloc2(mem, mem) 52 #define gs_font_dir_alloc_limits(mem, smax, bmax, mmax, cmax, upper)\ 53 gs_font_dir_alloc2_limits(mem, mem, smax, bmax, mmax, cmax, upper) 54 55 /* Font manipulations */ 56 /* Use gs_definefont only with original (unscaled) fonts! */ 57 int gs_definefont(P2(gs_font_dir *, gs_font *)); 58 59 /* gs_scalefont and gs_makefont return 0 if the scaled font */ 60 /* was already in the cache, 1 if a new font was created. */ 61 int gs_scalefont(P4(gs_font_dir *, const gs_font *, floatp, gs_font **)); 62 int gs_makefont(P4(gs_font_dir *, const gs_font *, const gs_matrix *, gs_font **)); 63 int gs_setfont(P2(gs_state *, gs_font *)); 64 gs_font *gs_currentfont(P1(const gs_state *)); 65 gs_font *gs_rootfont(P1(const gs_state *)); 66 void gs_set_currentfont(P2(gs_state *, gs_font *)); 67 void gs_purge_font(P1(gs_font *)); 68 69 /* Font cache parameter operations */ 70 void gs_cachestatus(P2(const gs_font_dir *, uint[7])); 71 72 #define gs_setcachelimit(pdir,limit) gs_setcacheupper(pdir,limit) 73 uint gs_currentcachesize(P1(const gs_font_dir *)); 74 int gs_setcachesize(P2(gs_font_dir *, uint)); 75 uint gs_currentcachelower(P1(const gs_font_dir *)); 76 int gs_setcachelower(P2(gs_font_dir *, uint)); 77 uint gs_currentcacheupper(P1(const gs_font_dir *)); 78 int gs_setcacheupper(P2(gs_font_dir *, uint)); 79 80 #endif /* gsfont_INCLUDED */ 81