高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】2.7.1 svg output underline overline
2.7.1 svg output underline overline?
2.7.1 svg output underline overline?
hi,
i am using dwgdirect 2.7.1 odamfcapp to export the attached drawing to a svg but the output that not export the underline or the overline text (%%d or %%o).
please see the attached files and compare "special_chars_underline_1_dwg.jpg" => text with underline and overline.
with "special_chars_underline_1_svg.jpg" => no underline or overline
could you advice on how to export the text to svg.
the compiler i am using is "microsoft visual c++ 2005".
regards.
luis
attached images
underline support will be added in the next release.
you can add it yourself, the fix is very local.
in \exports\svgexport\source\svgshxembedding.h addtspan() and setcontents() functions should be modified in the folowing way:
code:
void addtextdecorations(xml::node* ts, bool boverline, bool bunderline)
{
if (boverline && bunderline)
ts->_attributes.push_back(xml::attribute(l"text-decoration", l"overline,underline"));
else if (boverline)
ts->_attributes.push_back(xml::attribute(l"text-decoration", l"overline"));
else if (bunderline)
ts->_attributes.push_back(xml::attribute(l"text-decoration", l"underline"));
}
// add <tspan> element to <text> node
//
void addtspan( xml::node* text, const odstring& s, const odgitextstyle* ptextstyle, bool bigfont, bool boverline, bool bunderline )
{
if ( s.isempty() ) return;
xml::node* ts = text->addchild( new xml::node( dd_t("tspan") ) );
ts->_contents = s;
addtextdecorations(ts, boverline, bunderline);
addstyle( ts, ptextstyle, bigfont );
}
// set text content, converting special sequences
// if font is switched - tspans are added
//
void setcontents( xml::node* text, odbasetextiteratorptr& iter, const odgitextstyle* ptextstyle )
{
odstring res;
bool bigfont = false;
bool boverline = false;
bool bunderline = false;
do
{
oduint16 ch = iter->nextchar();
if ( ch == 0 ) break;
if ( bigfont != iter->currproperties().binbigfont
|| boverline != iter->currproperties().boverlined
|| bunderline != iter->currproperties().bunderlined )
{
addtspan( text, res, ptextstyle, bigfont, boverline, bunderline );
bigfont = iter->currproperties().binbigfont;
boverline = iter->currproperties().boverlined;
bunderline = iter->currproperties().bunderlined;
res = dd_t("");
}
if ( ch < 128 ) res += (char)ch;
else
{
odstring u; u.format( dd_t("&#%d;"), ch );
res += u;
}
}
while ( !iter->currproperties().blastchar );
// if font did not switch - set contents directly
if ( text->_children.empty() && !res.isempty() )
{
text->_contents = res;
addtextdecorations(text, boverline, bunderline);
// set shx font style
if ( ptextstyle->ttfdecriptor().typeface().isempty() )
addstyle( text, ptextstyle, bigfont );
}
else addtspan( text, res, ptextstyle, bigfont, boverline, bunderline );
}
vladimir
|