37#ifndef HAVE_STRCASESTR
41 const char *endp, *sp, *pp;
48 endp =
str + slen - plen;
51 while (
str <= endp && p0 != toupper(*
str))
57 while ((pc = *pp++) && toupper(pc) == toupper(*sp))
60 return (
char *)(
str - 1);
68#include <pango/pangocairo.h>
70#define FNT_BOLD 1 << 0
71#define FNT_BOOK 1 << 1
72#define FNT_CONDENSED 1 << 2
73#define FNT_DEMI 1 << 3
74#define FNT_EXTRALIGHT 1 << 4
75#define FNT_ITALIC 1 << 5
76#define FNT_LIGHT 1 << 6
77#define FNT_MEDIUM 1 << 7
78#define FNT_OBLIQUE 1 << 8
79#define FNT_REGULAR 1 << 9
80#define FNT_ROMAN 1 << 9
82#define PS_AVANTGARDE "AvantGarde"
83#define PS_BOOKMAN "Bookman"
84#define PS_COURIER "Courier"
85#define PS_HELVETICA SAN_5
86#define PS_NEWCENTURYSCHLBK "NewCenturySchlbk"
87#define PS_PALATINO "Palatino"
88#define PS_SYMBOL "Symbol"
90#define PS_CHANCERY "ZapfChancery"
91#define PS_DINGBATS "ZapfDingbats"
93#define FNT_BOLD_ST "BOLD"
94#define FNT_BOOK_ST "BOOK"
95#define FNT_CONDENSED_ST "CONDENSED"
96#define FNT_DEMI_ST "DEMI"
97#define FNT_EXTRALIGHT_ST "EXTRALIGHT"
98#define FNT_ITALIC_ST "ITALIC"
99#define FNT_LIGHT_ST "LIGHT"
100#define FNT_MEDIUM_ST "MEDIUM"
101#define FNT_OBLIQUE_ST "OBLIQUE"
102#define FNT_REGULAR_ST "REGULAR"
103#define FNT_ROMAN_ST "ROMAN"
106#define SAN_1 "URW Gothic L"
107#define SAN_2 "Charcoal"
108#define SAN_3 "Nimbus Sans L"
109#define SAN_4 "Verdana"
110#define SAN_5 "Helvetica"
111#define SAN_6 "Bitstream Vera Sans"
112#define SAN_7 "DejaVu Sans"
113#define SAN_8 "Liberation Sans"
114#define SAN_9 "Luxi Sans"
115#define SAN_10 "FreeSans"
116#define SAN_11 "Arial"
119#define SER_1 "URW Bookman L"
120#define SER_2 "Times New Roman"
122#define SER_4 "Nimbus Roman No9 L"
123#define SER_5 "Bitstream Vera Serif"
124#define SER_6 "DejaVu Serif"
125#define SER_7 "Liberation Serif"
126#define SER_8 "Luxi Serif"
127#define SER_9 "FreeSerif"
128#define SER_10 "Century Schoolbook L"
129#define SER_11 "Charcoal"
130#define SER_12 "Georgia"
131#define SER_13 "URW Palladio L"
132#define SER_14 "Norasi"
133#define SER_15 "Rekha"
134#define SER_16 "URW Chancery L"
136#define MON_0 "monospace"
137#define MON_1 "Nimbus Mono L"
138#define MON_2 "Inconsolata"
139#define MON_3 "Courier New"
140#define MON_4 "Bitstream Vera Sans Mono"
141#define MON_5 "DejaVu Sans Mono"
142#define MON_6 "Liberation Mono"
143#define MON_7 "Luxi Mono"
144#define MON_8 "FreeMono"
146#define SYM_0 "fantasy"
147#define SYM_1 "Impact"
148#define SYM_2 "Copperplate Gothic Std"
149#define SYM_3 "Cooper Std"
150#define SYM_4 "Bauhaus Std"
152#define DING_0 "fantasy"
153#define DING_1 "Dingbats"
154#define DING_2 "Impact"
155#define DING_3 "Copperplate Gothic Std"
156#define DING_4 "Cooper Std"
157#define DING_5 "Bauhaus Std"
176#define FACELIST_SZ (sizeof(facelist) / sizeof(face_t))
184#define PS_AVANT_E_SZ (sizeof(PS_AVANT_E) / sizeof(char *))
188#define PS_BOOKMAN_E_SZ (sizeof(PS_BOOKMAN_E) / sizeof(char *))
192#define PS_COURIER_E_SZ (sizeof(PS_COURIER_E) / sizeof(char *))
196#define PS_HELVETICA_E_SZ (sizeof(PS_HELVETICA_E) / sizeof(char *))
200#define PS_NEWCENT_E_SZ (sizeof(PS_NEWCENT_E) / sizeof(char *))
205#define PS_PALATINO_E_SZ (sizeof(PS_PALATINO_E) / sizeof(char *))
209#define PS_TIMES_E_SZ (sizeof(PS_TIMES_E) / sizeof(char *))
212#define PS_SYMBOL_E_SZ (sizeof(PS_SYMBOL_E) / sizeof(char *))
216#define PS_CHANCERY_E_SZ (sizeof(PS_CHANCERY_E) / sizeof(char *))
219#define PS_DINGBATS_E_SZ (sizeof(PS_DINGBATS_E) / sizeof(char *))
241#define GV_FONT_LIST_SIZE (sizeof(gv_ps_fontdefs) / sizeof(fontdef_t))
269 PangoFontFace **faces;
275 pango_font_family_list_faces(family, &faces, &n_faces);
276 for (i = 0; i < n_faces; i++) {
278 name = pango_font_face_get_face_name(face);
294static void display_available_fonts(
availfonts_t gv_af_p) {
301 fprintf(stderr,
"ps font = %s not available\n",
305 fprintf(stderr,
"ps font = %s available %d font = %s\n",
311 fprintf(stderr,
"\t%s\n",
facelist[i].name);
333 PangoFontFamily **families;
334 PangoFontFamily *family;
337 int i, k, array_sz, availfaces = 0;
341 pango_font_map_list_families(fontmap, &families, &n_families);
353 for (i = 0; i < n_families; i++) {
354 family = families[i];
355 name = pango_font_family_get_name(family);
357 if (strcasecmp(gv_ps_fontdef->
fontname, name) == 0) {
358 family_name =
strview(name,
'\0');
366 array_sz = gv_ps_fontdef->
eq_sz;
367 for (k = 0; k < array_sz; k++) {
368 for (i = 0; i < n_families; i++) {
369 family = families[i];
370 name = pango_font_family_get_name(family);
371 if (strcasecmp(gv_ps_fontdef->
equiv[k], name) == 0) {
372 family_name =
strview(name,
'\0');
385 for (i = 0; i < n_families; i++) {
386 family = families[i];
387 name = pango_font_family_get_name(family);
388 if (strcasecmp(gv_ps_fontdef->
generic_name, name) == 0) {
389 family_name =
strview(name,
'\0');
397 if (family_name.
data !=
NULL && availfaces) {
399 gv_afs->
faces = availfaces;
407 display_available_fonts(gv_af_p);
442 }
else if (
strcasestr(avail_faces,
"REGULAR")) {
444 }
else if (strstr(avail_faces,
"ROMAN")) {
453 if (ps_alias->
style) {
457 }
else if (!strcasecmp(ps_alias->
style,
"ITALIC")) {
462 }
else if (!strcasecmp(ps_alias->
style,
"OBLIQUE")) {
477 for (
size_t j = 0; j < sz; j++) {
480 fprintf(stderr,
" [%" PRISIZE_T "] %s => <Not available>\n", j,
481 gv_fmap[j].gv_ps_fontname);
483 fprintf(stderr,
" [%" PRISIZE_T "] %s => \"%s\"\n", j,
484 gv_fmap[j].gv_ps_fontname,
font);
493 static const size_t ps_fontnames_sz =
502 for (
size_t j = 0; j < ps_fontnames_sz; j++) {
512 fprintf(stderr,
"Verbose %d\n",
Verbose);
static void agxbfree(agxbuf *xb)
free any malloced resources
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static WUR char * agxbuse(agxbuf *xb)
static int agxbputc(agxbuf *xb, char c)
add character to buffer
static char * agxbdisown(agxbuf *xb)
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
replacements for ctype.h functions
static char gv_toupper(int c)
static char * get_avail_faces(int faces, agxbuf *xb)
static fontdef_t gv_ps_fontdefs[]
static void gv_flist_free_af(availfonts_t gv_af_p)
static const char * PS_TIMES_E[]
static const char * PS_BOOKMAN_E[]
static PostscriptAlias postscript_alias[]
#define PS_NEWCENTURYSCHLBK
static const char * PS_CHANCERY_E[]
static const char * PS_COURIER_E[]
#define GV_FONT_LIST_SIZE
static const char * PS_SYMBOL_E[]
static const char * PS_NEWCENT_E[]
static const char * PS_HELVETICA_E[]
static const char * PS_AVANT_E[]
#define PS_HELVETICA_E_SZ
static const char * PS_PALATINO_E[]
static char * gv_get_font(availfonts_t gv_af_p, PostscriptAlias *ps_alias, agxbuf *xb, agxbuf *xb2)
static int get_faces(PangoFontFamily *family)
static const char * PS_DINGBATS_E[]
static void copyUpper(agxbuf *xb, char *s)
static void printFontMap(gv_font_map *gv_fmap, size_t sz)
static availfonts_t gv_get_ps_fontlist(PangoFontMap *fontmap)
#define FNT_EXTRALIGHT_ST
gv_font_map * get_font_mapping(PangoFontMap *fontmap)
char * strcasestr(const char *str, const char *pat)
textitem scanner parser str
platform abstraction for case-insensitive string functions
availfont_t fonts[GV_FONT_LIST_SIZE]
a non-owning string reference
const char * data
start of the pointed to string
Non-owning string references.
static char * strview_str(strview_t source)
make a heap-allocated string from this string view
static strview_t strview(const char *referent, char terminator)
create a string reference