32#ifndef HAVE_STRCASESTR
37 const char *endp, *sp, *pp;
38 if (!(p0 = *pat))
return (
char*)
str;
39 plen = strlen (pat++);
41 if (slen < plen)
return NULL;
42 endp =
str + slen - plen;
45 while (
str <= endp && p0 != toupper(*
str))
str++;
49 while ((pc = *pp++) && toupper(pc) == toupper(*sp)) sp++;
51 return (
char*)(
str-1);
57#include <pango/pangocairo.h>
63#define FNT_CONDENSED 1<<2
65#define FNT_EXTRALIGHT 1<<4
66#define FNT_ITALIC 1<<5
68#define FNT_MEDIUM 1<<7
69#define FNT_OBLIQUE 1<<8
70#define FNT_REGULAR 1<<9
73#define PS_AVANTGARDE "AvantGarde"
74#define PS_BOOKMAN "Bookman"
75#define PS_COURIER "Courier"
76#define PS_HELVETICA SAN_5
77#define PS_NEWCENTURYSCHLBK "NewCenturySchlbk"
78#define PS_PALATINO "Palatino"
79#define PS_SYMBOL "Symbol"
81#define PS_CHANCERY "ZapfChancery"
82#define PS_DINGBATS "ZapfDingbats"
84#define FNT_BOLD_ST "BOLD"
85#define FNT_BOOK_ST "BOOK"
86#define FNT_CONDENSED_ST "CONDENSED"
87#define FNT_DEMI_ST "DEMI"
88#define FNT_EXTRALIGHT_ST "EXTRALIGHT"
89#define FNT_ITALIC_ST "ITALIC"
90#define FNT_LIGHT_ST "LIGHT"
91#define FNT_MEDIUM_ST "MEDIUM"
92#define FNT_OBLIQUE_ST "OBLIQUE"
93#define FNT_REGULAR_ST "REGULAR"
94#define FNT_ROMAN_ST "ROMAN"
97#define SAN_1 "URW Gothic L"
98#define SAN_2 "Charcoal"
99#define SAN_3 "Nimbus Sans L"
100#define SAN_4 "Verdana"
101#define SAN_5 "Helvetica"
102#define SAN_6 "Bitstream Vera Sans"
103#define SAN_7 "DejaVu Sans"
104#define SAN_8 "Liberation Sans"
105#define SAN_9 "Luxi Sans"
106#define SAN_10 "FreeSans"
107#define SAN_11 "Arial"
110#define SER_1 "URW Bookman L"
111#define SER_2 "Times New Roman"
113#define SER_4 "Nimbus Roman No9 L"
114#define SER_5 "Bitstream Vera Serif"
115#define SER_6 "DejaVu Serif"
116#define SER_7 "Liberation Serif"
117#define SER_8 "Luxi Serif"
118#define SER_9 "FreeSerif"
119#define SER_10 "Century Schoolbook L"
120#define SER_11 "Charcoal"
121#define SER_12 "Georgia"
122#define SER_13 "URW Palladio L"
123#define SER_14 "Norasi"
124#define SER_15 "Rekha"
125#define SER_16 "URW Chancery L"
127#define MON_0 "monospace"
128#define MON_1 "Nimbus Mono L"
129#define MON_2 "Inconsolata"
130#define MON_3 "Courier New"
131#define MON_4 "Bitstream Vera Sans Mono"
132#define MON_5 "DejaVu Sans Mono"
133#define MON_6 "Liberation Mono"
134#define MON_7 "Luxi Mono"
135#define MON_8 "FreeMono"
137#define SYM_0 "fantasy"
138#define SYM_1 "Impact"
139#define SYM_2 "Copperplate Gothic Std"
140#define SYM_3 "Cooper Std"
141#define SYM_4 "Bauhaus Std"
143#define DING_0 "fantasy"
144#define DING_1 "Dingbats"
145#define DING_2 "Impact"
146#define DING_3 "Copperplate Gothic Std"
147#define DING_4 "Cooper Std"
148#define DING_5 "Bauhaus Std"
168#define FACELIST_SZ (sizeof(facelist)/sizeof(face_t))
177#define PS_AVANT_E_SZ (sizeof(PS_AVANT_E) / sizeof(char *))
182#define PS_BOOKMAN_E_SZ (sizeof(PS_BOOKMAN_E) / sizeof(char *))
187#define PS_COURIER_E_SZ (sizeof(PS_COURIER_E) / sizeof(char *))
192#define PS_HELVETICA_E_SZ (sizeof(PS_HELVETICA_E) / sizeof(char *))
197#define PS_NEWCENT_E_SZ (sizeof(PS_NEWCENT_E) / sizeof(char *))
200 SER_13,
SER_2,
SER_3,
SER_4,
SER_14,
SER_15,
SER_5,
SER_6,
SER_7,
SER_8,
SER_9
202#define PS_PALATINO_E_SZ (sizeof(PS_PALATINO_E) / sizeof(char *))
207#define PS_TIMES_E_SZ (sizeof(PS_TIMES_E) / sizeof(char *))
210#define PS_SYMBOL_E_SZ (sizeof(PS_SYMBOL_E) / sizeof(char *))
215#define PS_CHANCERY_E_SZ (sizeof(PS_CHANCERY_E) / sizeof(char *))
218#define PS_DINGBATS_E_SZ (sizeof(PS_DINGBATS_E) / sizeof(char *))
240#define GV_FONT_LIST_SIZE (sizeof(gv_ps_fontdefs)/sizeof(fontdef_t))
270 PangoFontFace **faces;
276 pango_font_family_list_faces(family, &faces, &n_faces);
277 for (i = 0; i < n_faces; i++) {
279 name = pango_font_face_get_face_name(face);
302 fprintf (stderr,
"ps font = %s not available\n",
gv_ps_fontdefs[j].fontname);
305 fprintf (stderr,
"ps font = %s available %d font = %s\n",
311 fprintf (stderr,
"\t%s\n",
facelist[i].name);
335 PangoFontFamily **families;
336 PangoFontFamily *family;
339 int i, k, array_sz, availfaces = 0;
343 pango_font_map_list_families(fontmap, &families, &n_families);
355 for (i = 0; i < n_families; i++) {
356 family = families[i];
357 name = pango_font_family_get_name(family);
359 if (strcasecmp(gv_ps_fontdef->
fontname, name) == 0) {
360 family_name =
strview(name,
'\0');
368 array_sz = gv_ps_fontdef->
eq_sz;
369 for (k = 0; k < array_sz; k++) {
370 for (i = 0; i < n_families; i++) {
371 family = families[i];
372 name = pango_font_family_get_name(family);
373 if (strcasecmp(gv_ps_fontdef->
equiv[k], name) == 0) {
374 family_name =
strview(name,
'\0');
386 for (i = 0; i < n_families; i++) {
387 family = families[i];
388 name = pango_font_family_get_name(family);
389 if (strcasecmp(gv_ps_fontdef->
generic_name, name) == 0) {
390 family_name =
strview(name,
'\0');
398 if (family_name.
data !=
NULL && availfaces) {
400 gv_afs->
faces = availfaces;
408 display_available_fonts(gv_af_p);
445 }
else if (
strcasestr(avail_faces,
"REGULAR")) {
447 }
else if (strstr(avail_faces,
"ROMAN")) {
456 if (ps_alias->
style) {
460 }
else if (!strcasecmp(ps_alias->
style,
"ITALIC")) {
465 }
else if (!strcasecmp(ps_alias->
style,
"OBLIQUE")) {
480 for (
size_t j = 0; j < sz; j++) {
483 fprintf(stderr,
" [%" PRISIZE_T "] %s => <Not available>\n", j,
484 gv_fmap[j].gv_ps_fontname);
486 fprintf(stderr,
" [%" PRISIZE_T "] %s => \"%s\"\n", j,
487 gv_fmap[j].gv_ps_fontname,
font);
497 static const size_t ps_fontnames_sz =
504 for (
size_t j = 0; j < ps_fontnames_sz; j++) {
513 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
#define PRISIZE_T
PRIu64 alike for printing size_t
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