几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】2.7.1 svg output underline overline (http://www.dimcax.com/hust/showthread.php?t=14910)

yang686526 2009-05-04 02:55 PM

【转帖】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


所有的时间均为北京时间。 现在的时间是 05:52 AM.