From: Fridrich S. <str...@us...> - 2010-06-10 20:47:49
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv29477/src/lib Modified Files: WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: writing out text attributes into SVG Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- WPGSVGGenerator.h 10 Jun 2010 18:48:07 -0000 1.24 +++ WPGSVGGenerator.h 10 Jun 2010 20:47:39 -0000 1.25 @@ -59,8 +59,8 @@ void endTextObject(); void startTextLine(const ::WPXPropertyList &propList) {} void endTextLine() {} - void startTextSpan(const ::WPXPropertyList &propList) {} - void endTextSpan() {} + void startTextSpan(const ::WPXPropertyList &propList); + void endTextSpan(); void insertText(const ::WPXString &str); private: Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- WPGSVGGenerator.cpp 10 Jun 2010 18:48:07 -0000 1.39 +++ WPGSVGGenerator.cpp 10 Jun 2010 20:47:39 -0000 1.40 @@ -259,17 +259,40 @@ { m_outputSink << "<text "; if (propList["svg:x"] && propList["svg:y"]) - m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\" >\n"; + m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\">\n"; } -void libwpg::WPGSVGGenerator::insertText(const ::WPXString &str) +void libwpg::WPGSVGGenerator::endTextObject() { - m_outputSink << str.cstr() << "\n"; + m_outputSink << "</text>\n"; } -void libwpg::WPGSVGGenerator::endTextObject() +void libwpg::WPGSVGGenerator::startTextSpan(const ::WPXPropertyList &propList) { - m_outputSink << "</text >\n"; + m_outputSink << "<tspan "; + if (propList["style:font-name"]) + m_outputSink << "font-family=\"" << propList["style:font-name"]->getStr().cstr() << "\" "; + if (propList["fo:font-style"]) + m_outputSink << "font-style=\"" << propList["fo:font-style"]->getStr().cstr() << "\" "; + if (propList["fo:font-weight"]) + m_outputSink << "font-weight=\"" << propList["fo:font-weight"]->getStr().cstr() << "\" "; + if (propList["fo:font-variant"]) + m_outputSink << "font-variant=\"" << propList["fo:font-weight"]->getStr().cstr() << "\" "; + if (propList["fo:font-size"]) + m_outputSink << "font-size=\"" << propList["fo:font-size"]->getStr().cstr() << "\" "; + if (propList["fo:color"]) + m_outputSink << "fill=\"" << propList["fo:color"]->getStr().cstr() << "\" "; + m_outputSink << ">\n"; +} + +void libwpg::WPGSVGGenerator::endTextSpan() +{ + m_outputSink << "</tspan>\n"; +} + +void libwpg::WPGSVGGenerator::insertText(const ::WPXString &str) +{ + m_outputSink << str.cstr() << "\n"; } // create "style" attribute based on current pen and brush |