right-aligned) on the point if j is -1 (0, 1), respectively. The value
w gives the width of the text as computed by the library.
<TR><TD>t f
-<TD>Set font characteristics. The integer f is the OR of BOLD=1, ITALIC=2, UNDERLINE=4, SUPERSCRIPT=8, SUBSCRIPT=16, and STRIKE-THROUGH=32. (1.5)
+<TD>Set font characteristics. The integer f is the OR of BOLD=1, ITALIC=2, UNDERLINE=4, SUPERSCRIPT=8, SUBSCRIPT=16, (1.5) STRIKE-THROUGH=32 (1.6),
+and OVERLINE=64 (1.7).
<TR><TD>C n -<I>b<sub>1</sub>b<sub>2</sub>...b<sub>n</sub></I>
<TD>Set fill color. The color value consists of the
n bytes following '-'. (1.1)
<TR><TD>1.4</TD><TD>2.32</TD><TD>Add gradient colors</TD</TR>
<TR><TD>1.5</TD><TD>2.34</TD><TD>Fix text layout problem; fix inverted vector in gradient; support version-specific output; new <B>t</B> op for text characteristics</TD</TR>
<TR><TD>1.6</TD><TD>2.35</TD><TD>Add STRIKE-THROUGH bit for <tt>t</tt></TD</TR>
+<TR><TD>1.7</TD><TD>2.37</TD><TD>Add OVERLINE for <tt>t</tt></TD</TR>
</TABLE>
<DT><A NAME=d:cgimage HREF=#a:cgimage><STRONG>cgimage</STRONG></A>
right-aligned) on the point if j is -1 (0, 1), respectively. The value
w gives the width of the text as computed by the library.
<TR><TD>t f
-<TD>Set font characteristics. The integer f is the OR of BOLD=1, ITALIC=2, UNDERLINE=4, SUPERSCRIPT=8, SUBSCRIPT=16, and STRIKE-THROUGH=32. (1.5)
+<TD>Set font characteristics. The integer f is the OR of BOLD=1, ITALIC=2, UNDERLINE=4, SUPERSCRIPT=8, SUBSCRIPT=16, (1.5) STRIKE-THROUGH=32 (1.6),
+and OVERLINE=64 (1.7).
<TR><TD>C n -<I>b<sub>1</sub>b<sub>2</sub>...b<sub>n</sub></I>
<TD>Set fill color. The color value consists of the
n bytes following '-'. (1.1)
<TR><TD>1.4</TD><TD>2.32</TD><TD>Add gradient colors</TD</TR>
<TR><TD>1.5</TD><TD>2.34</TD><TD>Fix text layout problem; fix inverted vector in gradient; support version-specific output; new <B>t</B> op for text characteristics</TD</TR>
<TR><TD>1.6</TD><TD>2.35</TD><TD>Add STRIKE-THROUGH bit for <tt>t</tt></TD</TR>
+<TR><TD>1.7</TD><TD>2.37</TD><TD>Add OVERLINE for <tt>t</tt></TD</TR>
</TABLE>
:plain/plain-ext:Simple text format
The plain and plain-ext formats produce output using
} else if (strcasecmp(name, "U") == 0) {
htmllval.font = mkFont(gvc, 0, HTML_UL, 1);
state.tok = T_underline;
+ } else if (strcasecmp(name, "O") == 0) {
+ htmllval.font = mkFont(gvc, 0, HTML_OL, 1);
+ state.tok = T_overline;
} else if (strcasecmp(name, "I") == 0) {
htmllval.font = mkFont(gvc, 0, HTML_IF, 0);
state.tok = T_italic;
state.tok = T_n_bold;
} else if (strcasecmp(name, "U") == 0) {
state.tok = T_n_underline;
+ } else if (strcasecmp(name, "O") == 0) {
+ state.tok = T_n_overline;
} else if (strcasecmp(name, "I") == 0) {
state.tok = T_n_italic;
} else if (strcasecmp(name, "SUP") == 0) {
case T_n_underline:
s = "T_n_underline";
break;
+ case T_overline:
+ s = "T_overline";
+ break;
+ case T_n_overline:
+ s = "T_n_overline";
+ break;
case T_italic:
s = "T_italic";
break;
%token T_end_br T_end_img T_row T_end_row T_html T_end_html
%token T_end_table T_end_cell T_end_font T_string T_error
-%token T_n_italic T_n_bold T_n_underline T_n_sup T_n_sub T_n_s
+%token T_n_italic T_n_bold T_n_underline T_n_overline T_n_sup T_n_sub T_n_s
%token T_HR T_hr T_end_hr
%token T_VR T_vr T_end_vr
%token <i> T_BR T_br
%token <img> T_IMG T_img
%token <tbl> T_table
%token <cell> T_cell
-%token <font> T_font T_italic T_bold T_underline T_sup T_sub T_s
+%token <font> T_font T_italic T_bold T_underline T_overline T_sup T_sub T_s
%type <txt> fonttext
%type <cell> cell cells
| font text n_font
| italic text n_italic
| underline text n_underline
+ | overline text n_overline
| bold text n_bold
| sup text n_sup
| sub text n_sub
n_underline : T_n_underline {popFont();}
;
+overline : T_overline {pushFont($1);}
+ ;
+
+n_overline : T_n_overline {popFont();}
+ ;
+
sup : T_sup {pushFont($1);}
;
| font table n_font { $$=$2; }
| italic table n_italic { $$=$2; }
| underline table n_underline { $$=$2; }
+ | overline table n_overline { $$=$2; }
| bold table n_bold { $$=$2; }
;
#endif
/* Bold, Italic, Underline, Sup, Sub, Strike */
-#define HTML_BF 1
-#define HTML_IF 2
-#define HTML_UL 4
-#define HTML_SUP 8
-#define HTML_SUB 16
-#define HTML_S 32
+/* Stored in textfont_t.flags, which is 7 bits, so full */
+/* Probably should be moved to textspan_t */
+#define HTML_BF (1 << 0)
+#define HTML_IF (1 << 1)
+#define HTML_UL (1 << 2)
+#define HTML_SUP (1 << 3)
+#define HTML_SUB (1 << 4)
+#define HTML_S (1 << 5)
+#define HTML_OL (1 << 6)
typedef struct _PostscriptAlias {
char* name;
char* color;
PostscriptAlias *postscript_alias;
double size;
- int flags:7; /* HTML_UL, HTML_IF, HTML_BF, etc. */
+ unsigned int flags:7; /* HTML_UL, HTML_IF, HTML_BF, etc. */
unsigned int cnt:(sizeof(unsigned int) * 8 - 7); /* reference count */
} textfont_t;
return (p);
}
+
static char *parseInt(char *s, int *ip)
{
char* endp;
return endp;
}
+static char *parseUInt(char *s, unsigned int *ip)
+{
+ char* endp;
+
+ *ip = (unsigned int)strtoul (s, &endp, 10);
+ if (s == endp)
+ return 0;
+ else
+ return endp;
+}
+
#ifdef UNUSED
static char *parsePoint(char *s, xdot_point * pp)
{
case 't':
op->kind = xd_fontchar;
- s = parseInt(s, &op->u.fontchar);
+ s = parseUInt(s, &op->u.fontchar);
CHK(s);
if (ops)
op->drawfunc = ops[xop_fontchar];
xdot_color grad_color; /* xd_grad_fill_color, xd_grad_pen_color */
xdot_font font; /* xd_font */
char* style; /* xd_style */
- int fontchar; /* xd_fontchar */
+ unsigned int fontchar; /* xd_fontchar */
} u;
drawfunc_t drawfunc;
};
// #pragma comment( lib, "ingraphs.lib" )
#endif
-#define XDOTVERSION "1.6"
+#define XDOTVERSION "1.7"
#define NUMXBUFS (EMIT_HLABEL+1)
/* There are as many xbufs as there are values of emit_state_t.
g->clos->disc.io = io_save;
}
+static unsigned int flag_masks[] = { 0x1F, 0x3F, 0x7F };
+
static void xdot_textspan(GVJ_t * job, pointf p, textspan_t * span)
{
emit_state_t emit_state = job->obj->emit_state;
else
flags = 0;
if (xd->version >= 15) {
- unsigned int mask = (xd->version >= 16?0x3F:0x1F);
+ unsigned int mask = flag_masks[xd->version-15];
unsigned int bits = flags & mask;
if (textflags[emit_state] != bits) {
- sprintf (buf, "t %d ", bits);
+ sprintf (buf, "t %u ", bits);
agxbput(xbufs[emit_state], buf);
textflags[emit_state] = bits;
}
obj_state_t *obj = job->obj;
PostscriptAlias *pA;
char *family = NULL, *weight = NULL, *stretch = NULL, *style = NULL;
- int flags;
+ unsigned int flags;
gvputs(job, "<text");
switch (span->just) {
gvprintf(job, " font-weight=\"bold\"");
if ((flags & HTML_IF) && !style)
gvprintf(job, " font-style=\"italic\"");
- if ((flags & (HTML_UL|HTML_S))) {
+ if ((flags & (HTML_UL|HTML_S|HTML_OL))) {
int comma = 0;
gvprintf(job, " text-decoration=\"");
if ((flags & HTML_UL)) {
gvprintf(job, "underline");
comma = 1;
}
+ if ((flags & HTML_OL)) {
+ gvprintf(job, "%soverline", (comma?",":""));
+ comma = 1;
+ }
if ((flags & HTML_S))
gvprintf(job, "%sline-through", (comma?",":""));
gvprintf(job, "\"");
#include <cairo-svg.h>
#endif
+static void cairogen_polyline(GVJ_t * job, pointf * A, int n);
+
static void cairogen_set_color(cairo_t * cr, gvcolor_t * color)
{
cairo_set_source_rgba(cr, color->u.RGBA[0], color->u.RGBA[1],
{
obj_state_t *obj = job->obj;
cairo_t *cr = (cairo_t *) job->context;
+ pointf A[2];
cairo_set_dash (cr, dashed, 0, 0.0); /* clear any dashing */
cairogen_set_color(cr, &(obj->pencolor));
cairo_scale(cr, POINTS_PER_INCH / FONT_DPI, POINTS_PER_INCH / FONT_DPI);
pango_cairo_show_layout(cr, (PangoLayout*)(span->layout));
cairo_restore(cr);
+
+ if ((span->font) && (span->font->flags & HTML_OL)) {
+ A[0].x = p.x;
+ A[1].x = p.x + span->size.x;
+ A[1].y = A[0].y = p.y;
+ cairogen_polyline(job, A, 2);
+ }
}
static void cairogen_set_penstyle(GVJ_t *job, cairo_t *cr)