From 0877a38303dfd526729b99c3170598055fb3dccd Mon Sep 17 00:00:00 2001 From: erg Date: Wed, 25 Jun 2008 20:37:41 +0000 Subject: [PATCH] Fix bug in emitting a sequence of text chunks with different font attributes. --- lib/common/htmltable.c | 23 ++++++++++++----------- lib/common/htmltable.h | 2 ++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index f1215d9a0..c2cd187cd 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -115,7 +115,6 @@ emit_htextparas(GVJ_t* job, int nparas, htextpara_t* paras, pointf p, { int i,j; double tmp, center_x, left_x, right_x, fsize_; - double offset; char *fname_ , *fcolor_; textpara_t tl; pointf p_ = {0.0, 0.0}; @@ -134,25 +133,22 @@ emit_htextparas(GVJ_t* job, int nparas, htextpara_t* paras, pointf p, gvrender_begin_context(job); for(i=0; ifont && (ti->font->size > 0)) fsize_ = ti->font->size; @@ -177,13 +173,18 @@ emit_htextparas(GVJ_t* job, int nparas, htextpara_t* paras, pointf p, tl.yoffset_centerline = ti->yoffset_centerline; tl.postscript_alias = ti->postscript_alias; tl.layout = ti->layout; - tl.width = paras[i].size; + tl.width = ti->size; tl.height = paras[i].lfsize; - tl.just = paras[i].just; + tl.just = 'l'; + p_.x = p.x; +#if 0 +/* or */ + tl.just = 'c'; + p_.x = p.x + (ti->size/2.0); +#endif gvrender_textpara(job, p_, &tl); - offset += ti->size; - p_.x = p.x + offset; + p.x += ti->size; ti++; } } diff --git a/lib/common/htmltable.h b/lib/common/htmltable.h index 5c64a1974..dd7ffc407 100644 --- a/lib/common/htmltable.h +++ b/lib/common/htmltable.h @@ -62,6 +62,7 @@ extern "C" { } htmltxt_t; #endif + /* atomic unit of text emitted using a single htmlfont_t */ typedef struct { char *str; char *xshow; @@ -72,6 +73,7 @@ extern "C" { double size, yoffset_layout, yoffset_centerline; } textitem_t; + /* line of textitems_t */ typedef struct { textitem_t *items; short nitems; -- 2.40.0