Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

font.c

Go to the documentation of this file.
00001 /*  $Id: font.c,v 1.1 2000/12/02 07:26:03 dbryson Exp $
00002 **
00003 **  Copyright (c) 2000 Derry Bryson <derry@techass.com>
00004 **
00005 **  Description:
00006 **  
00007 **    Postscript Library
00008 **
00009 **
00010 **  License:
00011 **
00012 **    This library is free software; you can redistribute it and/or
00013 **    modify it under the terms of the GNU Lesser General Public
00014 **    License as published by the Free Software Foundation; either
00015 **    version 2.1 of the License, or (at your option) any later version.
00016 **
00017 **    This library is distributed in the hope that it will be useful,
00018 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 **    Lesser General Public License for more details.
00021 **
00022 **    You should have received a copy of the GNU Lesser General Public
00023 **    License along with this library; if not, write to the Free Software
00024 **    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 **
00026 **
00027 **  Contact:
00028 **
00029 **      Mail:
00030 **
00031 **        Technology Associates, Inc.
00032 **        LIBPS Project
00033 **        1455 Deming Way #11
00034 **        Sparks, NV  89431
00035 **        USA
00036 **
00037 **      Email:
00038 **
00039 **        libps@techass.com
00040 **
00041 **      See our website at:
00042 **
00043 **        libps.sourceforge.net
00044 **
00045 */
00046 
00051 #ifdef HAVE_CONFIG_H
00052 # include "psconfig.h"
00053 #endif
00054 
00055 #include <stdio.h>
00056 #include <stdlib.h>
00057 #include <string.h>
00058 #include <unistd.h>
00059 #include <sys/stat.h>
00060 #include <ctype.h>
00061 #include "ps/ps.h"
00062 
00063 #if HAVE_DIRENT_H
00064 # include <dirent.h>
00065 # define NAMLEN(dirent) strlen((dirent)->d_name)
00066 #else
00067 # define dirent direct
00068 # define NAMLEN(dirent) (dirent)->d_namlen
00069 # if HAVE_SYS_NDIR_H
00070 #  include <sys/ndir.h>
00071 # endif
00072 # if HAVE_SYS_DIR_H
00073 #  include <sys/dir.h>
00074 # endif
00075 # if HAVE_NDIR_H
00076 #  include <ndir.h>
00077 # endif
00078 #endif
00079 
00087 char
00088   *psWeightNames[] =
00089   {
00090     "unknown",
00091     "thin",
00092     "extra-light",
00093     "light",
00094     "normal",
00095     "medium",
00096     "semi-bold",
00097     "bold",
00098     "extra-bold",
00099     "black"
00100   };
00101   
00109 char
00110   *psWidthNames[] =
00111   {
00112     "unknown",
00113     "ultra-condensed",
00114     "extra-condensed",
00115     "condensed",
00116     "semi-condensed",
00117     "normal",
00118     "semi-expanded",
00119     "expanded",
00120     "extra-expanded",
00121     "ultra-expanded"
00122   };
00123   
00131 PSFont* 
00132 psFontAlloc(void)
00133 {
00134   return psFontCalloc(1);
00135 }
00136 
00146 PSFont* 
00147 psFontCalloc(int count)
00148 {
00149   int
00150     i;
00151     
00152   PSFont
00153     *fonts;
00154     
00155   fonts = calloc(count, sizeof(PSFont));
00156   if(fonts)
00157   {
00158     for(i = 0; i < count; i++)
00159       fonts[i].xFontNames = psListAlloc((PSListDestroyFunc)free);
00160   }
00161   
00162   return fonts;  
00163 }
00164 
00173 void
00174 psFontFree(PSFont* font)
00175 {
00176   if(font->fontFileName)
00177     free(font->fontFileName);
00178   if(font->fontMetricFileName)
00179     free(font->fontMetricFileName);
00180   if(font->fontName)
00181     free(font->fontName);
00182   if(font->fontFamily)
00183     free(font->fontFamily);
00184   if(font->fontMetric)
00185     psAFMFree(font->fontMetric);    
00186   if(font->xFontNames)
00187     psListFree(font->xFontNames);
00188   free(font);
00189 }
00190 

Generated at Mon Dec 11 22:46:27 2000 for Postscript Utility Library by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000