From 9b1145b184184084da9370b2fbb618f9cd3d8199 Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Wed, 24 Aug 2011 15:23:42 -0400 Subject: [PATCH] Fix core svg renderer to support font markup --- plugin/core/gvrender_core_svg.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c index 03b736bf2..c97954339 100644 --- a/plugin/core/gvrender_core_svg.c +++ b/plugin/core/gvrender_core_svg.c @@ -317,6 +317,8 @@ static void svg_textpara(GVJ_t * job, pointf p, textpara_t * para) { obj_state_t *obj = job->obj; PostscriptAlias *pA; + char *family=NULL, *weight=NULL, *stretch=NULL, *style=NULL; + int flags; gvputs(job, "just) { @@ -335,7 +337,6 @@ static void svg_textpara(GVJ_t * job, pointf p, textpara_t * para) gvprintf(job, " x=\"%g\" y=\"%g\"", p.x, -p.y); pA = para->postscript_alias; if (pA) { - char *family=NULL, *weight=NULL, *stretch=NULL, *style=NULL; switch(GD_fontnames(job->gvc->g)) { case PSFONTS: family = pA->name; @@ -365,6 +366,14 @@ static void svg_textpara(GVJ_t * job, pointf p, textpara_t * para) } else gvprintf(job, " font-family=\"%s\"", para->fontname); + if ((para->font) && (flags = para->font->flags)) { + if ((flags & HTML_BF) && !weight) gvprintf(job, " font-weight=\"bold\""); + if ((flags & HTML_IF) && !style) gvprintf(job, " font-style=\"italic\""); + if ((flags & HTML_UL)) gvprintf(job, " text-decoration=\"underline\""); + if ((flags & HTML_SUP)) gvprintf(job, " baseline-shift=\"super\""); + if ((flags & HTML_SUB)) gvprintf(job, " baseline-shift=\"sub\""); + } + gvprintf(job, " font-size=\"%.2f\"", para->fontsize); switch (obj->pencolor.type) { case COLOR_STRING: -- 2.40.0