/* Copyright (C) 1989, 1990 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
This file is part of groff.
groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along
with groff; see the file LICENSE. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define FONTPATH "/usr/local/lib/font:/usr/lib/font"
const char *const FONT_ENV_VAR
= "GROFF_FONT_PATH";
int font::paperwidth
= 0;
int font::paperlength
= 0;
int font::biggestfont
= 0;
const char **font::font_name_table
= 0;
char *font::dev_name
= 0;
char *font::cl_font_dirs
= 0;
const char *font::family
= 0;
const char **font::style_table
= 0;
void font::command_line_font_dir(const char *dir
)
cl_font_dirs
= new char[strlen(dir
)+1];
strcpy(cl_font_dirs
, dir
);
int len
= strlen(cl_font_dirs
);
if (len
> 0 && cl_font_dirs
[len
-1] != ':')
char *old_dirs
= cl_font_dirs
;
cl_font_dirs
= new char[len
+ need_colon
+ strlen(dir
) + 1];
strcpy(cl_font_dirs
, old_dirs
);
strcat(cl_font_dirs
, ":");
strcat(cl_font_dirs
, dir
);
void font::forget_command_line_font_dirs()
FILE *font::open_file(const char *name
, char **pathp
)
dir_vec
[0] = cl_font_dirs
;
dir_vec
[1] = getenv(FONT_ENV_VAR
);
for (int i
= 0; i
< 3; i
++)
const char *dirs
= dir_vec
[i
];
const char *p
= strchr(dirs
, ':');
if (p
> dirs
&& p
[-1] != '/')
char *path
= new char[(p
- dirs
) + need_slash
+ 3
memcpy(path
, dirs
, p
- dirs
);
FILE *fp
= fopen(path
, "r");
void font::set_device_name(const char *s
)
dev_name
= new char[strlen(s
)+1];
const char *font::get_device_name()