From 6ab3020dba87e4f3b5b3f28457c34480b4daa244 Mon Sep 17 00:00:00 2001 From: John Ellson Date: Wed, 6 Nov 2013 14:03:46 -0500 Subject: [PATCH] rename htmlfont_t to textfont_t as it is now generic --- lib/common/emit.c | 2 +- lib/common/fontmetrics.c | 4 +++- lib/common/htmllex.c | 10 +++++----- lib/common/htmlparse.y | 12 ++++++------ lib/common/htmltable.c | 18 +++++++++--------- lib/common/htmltable.h | 4 ++-- lib/common/labels.c | 2 +- lib/common/textspan.h | 4 ++-- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 97f5a596d..e693c09e0 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -2959,7 +2959,7 @@ boxf xdotBB (Agraph_t* g) op->span->str = strdup (op->op.u.text.text); op->span->just = adjust [op->op.u.text.align]; /* FIXME - use mkFont() */ - op->span->font = NEW(htmlfont_t); + op->span->font = NEW(textfont_t); op->span->font->name=fontname; op->span->font->size=fontsize; op->span->font->flags=0; diff --git a/lib/common/fontmetrics.c b/lib/common/fontmetrics.c index 41cc839de..013c4e486 100644 --- a/lib/common/fontmetrics.c +++ b/lib/common/fontmetrics.c @@ -193,12 +193,14 @@ static PostscriptAlias* translate_postscript_fontname(char* fontname) pointf textspan_size(GVC_t *gvc, textspan_t * span) { char **fpp = NULL, *fontpath = NULL; - htmlfont_t *font; + textfont_t *font; assert(span->font); +/* FIXME -- move into font creation function */ font = span->font; font->postscript_alias = translate_postscript_fontname(font->name); +/**/ if (Verbose && emit_once(font->name)) fpp = &fontpath; diff --git a/lib/common/htmllex.c b/lib/common/htmllex.c index d51c6223f..76cf54a18 100644 --- a/lib/common/htmllex.c +++ b/lib/common/htmllex.c @@ -403,19 +403,19 @@ static int colspanfn(htmlcell_t * p, char *v) return 0; } -static int fontcolorfn(htmlfont_t * p, char *v) +static int fontcolorfn(textfont_t * p, char *v) { p->color = strdup(v); return 0; } -static int facefn(htmlfont_t * p, char *v) +static int facefn(textfont_t * p, char *v) { p->name = strdup(v); return 0; } -static int ptsizefn(htmlfont_t * p, char *v) +static int ptsizefn(textfont_t * p, char *v) { long u; @@ -563,9 +563,9 @@ static htmlimg_t *mkImg(char **atts) return img; } -static htmlfont_t *mkFont(char **atts, int flags, int ul) +static textfont_t *mkFont(char **atts, int flags, int ul) { - htmlfont_t *font = NEW(htmlfont_t); + textfont_t *font = NEW(textfont_t); font->size = -1.0; /* unassigned */ font->flags = flags; diff --git a/lib/common/htmlparse.y b/lib/common/htmlparse.y index 99d3a14ce..7b1c8cf90 100644 --- a/lib/common/htmlparse.y +++ b/lib/common/htmlparse.y @@ -20,7 +20,7 @@ extern int yyparse(void); typedef struct sfont_t { - htmlfont_t *cfont; + textfont_t *cfont; struct sfont_t *pfont; } sfont_t; @@ -175,8 +175,8 @@ static Dtdisc_t fspanDisc = { /* dupFont: */ -static htmlfont_t * -dupFont (htmlfont_t *f) +static textfont_t * +dupFont (textfont_t *f) { if (f) f->cnt++; return f; @@ -388,10 +388,10 @@ static int nonSpace (char* s) * Fonts are allocated in the lexer. */ static void -pushFont (htmlfont_t *f) +pushFont (textfont_t *f) { sfont_t *ft = NEW(sfont_t); - htmlfont_t* curfont = HTMLstate.fontstack->cfont; + textfont_t* curfont = HTMLstate.fontstack->cfont; if (curfont) { if (!f->color && curfont->color) @@ -429,7 +429,7 @@ popFont (void) htmltxt_t* txt; htmlcell_t* cell; htmltbl_t* tbl; - htmlfont_t* font; + textfont_t* font; htmlimg_t* img; pitem* p; } diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index b7f331bb8..c6b70a741 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -44,7 +44,7 @@ typedef struct { pointf pos; - htmlfont_t finfo; + textfont_t finfo; void *obj; graph_t *g; char *imgscale; @@ -72,7 +72,7 @@ static void printCell(htmlcell_t * cp, int ind); * set in env. The attributes are restored via popFontInfo. */ static void -pushFontInfo(htmlenv_t * env, htmlfont_t * fp, htmlfont_t * savp) +pushFontInfo(htmlenv_t * env, textfont_t * fp, textfont_t * savp) { if (env->finfo.name) { if (fp->name) { @@ -101,7 +101,7 @@ pushFontInfo(htmlenv_t * env, htmlfont_t * fp, htmlfont_t * savp) * Restore saved font attributes. * Copy only set values. */ -static void popFontInfo(htmlenv_t * env, htmlfont_t * savp) +static void popFontInfo(htmlenv_t * env, textfont_t * savp) { if (savp->name) env->finfo.name = savp->name; @@ -113,12 +113,12 @@ static void popFontInfo(htmlenv_t * env, htmlfont_t * savp) static void emit_htextspans(GVJ_t * job, int nspans, htextspan_t * spans, pointf p, - double halfwidth_x, htmlfont_t finfo, boxf b, int simple) + double halfwidth_x, textfont_t finfo, boxf b, int simple) { int i, j; double center_x, left_x, right_x; textspan_t tl; - htmlfont_t tf; + textfont_t tf; pointf p_ = { 0.0, 0.0 }; textspan_t *ti; @@ -478,7 +478,7 @@ static void emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env) pointf pos = env->pos; htmlcell_t **cells = tbl->u.n.cells; htmlcell_t *cp; - static htmlfont_t savef; + static textfont_t savef; htmlmap_data_t saved; int anchor; /* if true, we need to undo anchor settings. */ int doAnchor = (tbl->data.href || tbl->data.target); @@ -743,7 +743,7 @@ void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t * tp) freeObj(job); } -void free_html_font(htmlfont_t * fp) +void free_html_font(textfont_t * fp) { fp->cnt--; if (fp->cnt == 0) { @@ -982,7 +982,7 @@ static int size_html_txt(graph_t * g, htmltxt_t * ftxt, htmlenv_t * env) double width; char *fname; textspan_t lp; - htmlfont_t lhf; + textfont_t lhf; double maxoffset, mxysize; int simple = 1; /* one item per span, same font size/face, no flags */ double prev_fsize = -1; @@ -1818,7 +1818,7 @@ size_html_tbl(graph_t * g, htmltbl_t * tbl, htmlcell_t * parent, { int i, wd, ht; int rv = 0; - static htmlfont_t savef; + static textfont_t savef; if (tbl->font) pushFontInfo(env, tbl->font, &savef); diff --git a/lib/common/htmltable.h b/lib/common/htmltable.h index 2db6b375a..d34c0bd06 100644 --- a/lib/common/htmltable.h +++ b/lib/common/htmltable.h @@ -110,7 +110,7 @@ extern "C" { int *widths; /* widths of the columns */ int rc; /* number of rows */ int cc; /* number of columns */ - htmlfont_t *font; /* font info */ + textfont_t *font; /* font info */ unsigned char flags; }; @@ -156,7 +156,7 @@ extern "C" { extern void free_html_label(htmllabel_t *, int); extern void free_html_data(htmldata_t *); extern void free_html_text(htmltxt_t *); - extern void free_html_font(htmlfont_t*); + extern void free_html_font(textfont_t*); extern boxf *html_port(node_t * n, char *pname, int* sides); extern int html_path(node_t * n, port* p, int side, boxf * rv, int *k); diff --git a/lib/common/labels.c b/lib/common/labels.c index 1d21dc821..a3dc51c79 100644 --- a/lib/common/labels.c +++ b/lib/common/labels.c @@ -30,7 +30,7 @@ static void storeline(GVC_t *gvc, textlabel_t *lp, char *line, char terminator) span->just = terminator; if (line && line[0]) { /* FIXME -- use mkFont() */ - span->font = NEW(htmlfont_t); + span->font = NEW(textfont_t); span->font->name = strdup(lp->fontname); span->font->size = lp->fontsize; span->font->color = NULL; diff --git a/lib/common/textspan.h b/lib/common/textspan.h index 6d8e92c16..7fdb7771d 100644 --- a/lib/common/textspan.h +++ b/lib/common/textspan.h @@ -49,12 +49,12 @@ extern "C" { int flags:7; /* HTML_UL, HTML_IF, HTML_BF, etc. */ PostscriptAlias *postscript_alias; int cnt:(sizeof(int) * 8 - 7); /* reference count */ - } htmlfont_t; + } textfont_t; /* atomic unit of text emitted using a single htmlfont_t */ typedef struct { char *str; /* stored in utf-8 */ - htmlfont_t *font; + textfont_t *font; void *layout; void (*free_layout) (void *layout); /* FIXME - this is ugly */ double yoffset_layout, yoffset_centerline; -- 2.40.0