1114402Sru// -*- C++ -*- 2151497Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004 3114402Sru Free Software Foundation, Inc. 4114402Sru Written by James Clark (jjc@jclark.com) 5114402Sru 6114402SruThis file is part of groff. 7114402Sru 8114402Srugroff is free software; you can redistribute it and/or modify it under 9114402Sruthe terms of the GNU General Public License as published by the Free 10114402SruSoftware Foundation; either version 2, or (at your option) any later 11114402Sruversion. 12114402Sru 13114402Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 14114402SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 15114402SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16114402Srufor more details. 17114402Sru 18114402SruYou should have received a copy of the GNU General Public License along 19114402Sruwith groff; see the file COPYING. If not, write to the Free Software 20151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 21114402Sru 22114402Sru#include "lib.h" 23114402Sru 24114402Sru#include <assert.h> 25114402Sru#include <stdlib.h> 26114402Sru#include <errno.h> 27114402Sru#include "font.h" 28114402Sru#include "searchpath.h" 29114402Sru#include "device.h" 30114402Sru#include "defs.h" 31114402Sru 32114402Sruconst char *const FONT_ENV_VAR = "GROFF_FONT_PATH"; 33114402Sru 34114402Srustatic search_path font_path(FONT_ENV_VAR, FONTPATH, 0, 0); 35114402Sru 36114402Sruint font::res = 0; 37114402Sruint font::hor = 1; 38114402Sruint font::vert = 1; 39114402Sruint font::unitwidth = 0; 40114402Sruint font::paperwidth = 0; 41114402Sruint font::paperlength = 0; 42114402Sruconst char *font::papersize = 0; 43114402Sruint font::biggestfont = 0; 44114402Sruint font::spare2 = 0; 45114402Sruint font::sizescale = 1; 46114402Sruint font::tcommand = 0; 47114402Sruint font::pass_filenames = 0; 48151497Sruint font::unscaled_charwidths = 0; 49114402Sruint font::use_charnames_in_special = 0; 50151497Sruconst char *font::image_generator = NULL; 51114402Sruconst char **font::font_name_table = 0; 52114402Sruint *font::sizes = 0; 53114402Sruconst char *font::family = 0; 54114402Sruconst char **font::style_table = 0; 55114402SruFONT_COMMAND_HANDLER font::unknown_desc_command_handler = 0; 56114402Sru 57114402Sruvoid font::command_line_font_dir(const char *dir) 58114402Sru{ 59114402Sru font_path.command_line_dir(dir); 60114402Sru} 61114402Sru 62151497SruFILE *font::open_file(const char *nm, char **pathp) 63114402Sru{ 64151497Sru char *filename = new char[strlen(nm) + strlen(device) + 5]; 65151497Sru sprintf(filename, "dev%s/%s", device, nm); 66114402Sru FILE *fp = font_path.open_file(filename, pathp); 67114402Sru a_delete filename; 68114402Sru return fp; 69114402Sru} 70