@@ -1637,7 +1637,6 @@ struct jm_lineart_device
16371637 fz_rect pathrect = {};
16381638 int clips = {};
16391639 int linecount = {};
1640- float linewidth = {};
16411640 int path_type = {};
16421641 long depth = {};
16431642 size_t seqno = {};
@@ -1747,7 +1746,8 @@ static void jm_trace_text_span(
17471746 fz_colorspace* colorspace,
17481747 const float * color,
17491748 float alpha,
1750- size_t seqno
1749+ size_t seqno,
1750+ const fz_stroke_state* stroke
17511751 )
17521752{
17531753 // printf("extra.jm_trace_text_span(): seqno=%zi\n", seqno);
@@ -1900,24 +1900,18 @@ static void jm_trace_text_span(
19001900 {
19011901 rgb[0 ] = rgb[1 ] = rgb[2 ] = 0 ;
19021902 }
1903- double linewidth;
1904- if (dev->linewidth > 0 ) // width of character border
1903+ if (0 )
19051904 {
1906- linewidth = (double ) dev->linewidth ;
1905+ std::cout << " fsize=" << fsize;
1906+ if (stroke)
1907+ std::cout << " linewidth=" << stroke->linewidth ;
1908+ std::cout << " \n " ;
19071909 }
1908- else
1909- {
1910- linewidth = fsize * 0.05 ; // default: 5% of font size
1911- }
1912- if (0 ) std::cout
1913- << " dev->linewidth=" << dev->linewidth
1914- << " fsize=" << fsize
1915- << " linewidth=" << linewidth
1916- << " \n " ;
19171910 dict_setitem_drop (span_dict, dictkey_color, Py_BuildValue (" fff" , rgb[0 ], rgb[1 ], rgb[2 ]));
19181911 dict_setitem_drop (span_dict, dictkey_size, PyFloat_FromDouble (fsize));
19191912 dict_setitemstr_drop (span_dict, " opacity" , PyFloat_FromDouble ((double ) alpha));
1920- dict_setitemstr_drop (span_dict, " linewidth" , PyFloat_FromDouble ((double ) linewidth));
1913+ if (stroke)
1914+ dict_setitemstr_drop (span_dict, " linewidth" , PyFloat_FromDouble ((double ) stroke->linewidth ));
19211915 dict_setitemstr_drop (span_dict, " spacewidth" , PyFloat_FromDouble (space_adv));
19221916 dict_setitem_drop (span_dict, dictkey_type, PyLong_FromLong ((long ) type));
19231917 dict_setitem_drop (span_dict, dictkey_bbox, JM_py_from_rect (span_bbox));
@@ -1987,7 +1981,7 @@ static void jm_fill_image_mask(
19871981 jm_increase_seqno (ctx, dev);
19881982}
19891983
1990- static void jm_dev_linewidth (
1984+ static void jm_stroke_path (
19911985 fz_context* ctx,
19921986 fz_device* dev_,
19931987 const fz_path* path,
@@ -1999,11 +1993,6 @@ static void jm_dev_linewidth(
19991993 fz_color_params color_params
20001994 )
20011995{
2002- jm_tracedraw_device* dev = (jm_tracedraw_device*) dev_;
2003- if (0 ) std::cout << " jm_dev_linewidth(): changing dev->linewidth from " << dev->linewidth
2004- << " to stroke->linewidth=" << stroke->linewidth
2005- << " \n " ;
2006- dev->linewidth = stroke->linewidth ;
20071996 jm_increase_seqno (ctx, dev_);
20081997}
20091998
@@ -2015,13 +2004,14 @@ static void jm_trace_text(
20152004 fz_colorspace* colorspace,
20162005 const float * color,
20172006 float alpha,
2018- size_t seqno
2007+ size_t seqno,
2008+ const fz_stroke_state* stroke
20192009 )
20202010{
20212011 fz_text_span* span;
20222012 for (span = text->head ; span; span = span->next )
20232013 {
2024- jm_trace_text_span (dev, span, type, ctm, colorspace, color, alpha, seqno);
2014+ jm_trace_text_span (dev, span, type, ctm, colorspace, color, alpha, seqno, stroke );
20252015 }
20262016}
20272017
@@ -2044,7 +2034,7 @@ jm_tracedraw_fill_text(
20442034 )
20452035{
20462036 jm_tracedraw_device* dev = (jm_tracedraw_device*) dev_;
2047- jm_trace_text (dev, text, 0 , ctm, colorspace, color, alpha, dev->seqno );
2037+ jm_trace_text (dev, text, 0 , ctm, colorspace, color, alpha, dev->seqno , NULL );
20482038 dev->seqno += 1 ;
20492039}
20502040
@@ -2062,7 +2052,7 @@ jm_tracedraw_stroke_text(
20622052 )
20632053{
20642054 jm_tracedraw_device* dev = (jm_tracedraw_device*) dev_;
2065- jm_trace_text (dev, text, 1 , ctm, colorspace, color, alpha, dev->seqno );
2055+ jm_trace_text (dev, text, 1 , ctm, colorspace, color, alpha, dev->seqno , stroke );
20662056 dev->seqno += 1 ;
20672057}
20682058
@@ -2076,7 +2066,7 @@ jm_tracedraw_ignore_text(
20762066 )
20772067{
20782068 jm_tracedraw_device* dev = (jm_tracedraw_device*) dev_;
2079- jm_trace_text (dev, text, 3 , ctm, nullptr , nullptr , 1 , dev->seqno );
2069+ jm_trace_text (dev, text, 3 , ctm, nullptr , nullptr , 1 , dev->seqno , NULL );
20802070 dev->seqno += 1 ;
20812071}
20822072
@@ -2105,7 +2095,7 @@ mupdf::FzDevice JM_new_texttrace_device(PyObject* out)
21052095 dev->super .close_device = nullptr ;
21062096 dev->super .drop_device = jm_lineart_drop_device;
21072097 dev->super .fill_path = jm_fill_path;
2108- dev->super .stroke_path = jm_dev_linewidth ;
2098+ dev->super .stroke_path = jm_stroke_path ;
21092099 dev->super .clip_path = nullptr ;
21102100 dev->super .clip_stroke_path = nullptr ;
21112101
0 commit comments