1.1 --- a/NEWS Mon Nov 09 09:42:14 2009 +0100
1.2 +++ b/NEWS Mon Nov 09 12:20:35 2009 +0100
1.3 @@ -1,7 +1,8 @@
1.4 dvisvgm-0.8.7
1.5 -- fixed bounding box issue concerning italic corrections
1.6 +- fixed a bounding box issue concerning italic corrections
1.7 - PS handler: zero-length paths are now drawn as dots
1.8 - PS handler: fixed a path positioning issue
1.9 +- PS handler: colors set by color specials are now considered properly
1.10 - added macro {?nl} to be used with special dvisvgm:raw
1.11
1.12 dvisvgm-0.8.6
2.1 --- a/src/Color.cpp Mon Nov 09 09:42:14 2009 +0100
2.2 +++ b/src/Color.cpp Mon Nov 09 12:20:35 2009 +0100
2.3 @@ -117,3 +117,10 @@
2.4 }
2.5 }
2.6 }
2.7 +
2.8 +
2.9 +void Color::getRGB (float &r, float &g, float &b) const {
2.10 + r = ((_rgb >> 16) & 255) / 255.0;
2.11 + g = ((_rgb >> 8) & 255) / 255.0;
2.12 + b = (_rgb & 255) / 255.0;
2.13 +}
3.1 --- a/src/Color.h Mon Nov 09 09:42:14 2009 +0100
3.2 +++ b/src/Color.h Mon Nov 09 12:20:35 2009 +0100
3.3 @@ -46,6 +46,7 @@
3.4 void setGray (float g) {set(g,g,g);}
3.5 void setHSB (float h, float s, float b);
3.6 void setCMYK (float c, float m, float y, float k);
3.7 + void getRGB (float &r, float &g, float &b) const;
3.8 void operator *= (double c);
3.9 std::string rgbString () const;
3.10 static void CMYK2RGB (const std::vector<float> &cmyk, std::vector<float> &rgb);
4.1 --- a/src/PsSpecialHandler.cpp Mon Nov 09 09:42:14 2009 +0100
4.2 +++ b/src/PsSpecialHandler.cpp Mon Nov 09 12:20:35 2009 +0100
4.3 @@ -48,7 +48,7 @@
4.4 /** Initializes the PostScript handler. It's called by the first use of process(). The
4.5 * deferred initialization speeds up the conversion of DVI files that doesn't contain
4.6 * PS specials. */
4.7 -void PsSpecialHandler::initialize () {
4.8 +void PsSpecialHandler::initialize (SpecialActions *actions) {
4.9 if (!_initialized) {
4.10 // initial values of graphics state
4.11 _linewidth = 1;
4.12 @@ -68,8 +68,15 @@
4.13 }
4.14 // push dictionary "TeXDict" with dvips definitions on dictionary stack
4.15 // and initialize basic dvips PostScript variables
4.16 - _psi.execute(" TeXDict begin 0 0 1000 72.27 72.27 () @start ");
4.17 - _psi.execute(" 0 0 moveto ");
4.18 + ostringstream oss;
4.19 + oss << " TeXDict begin 0 0 1000 72.27 72.27 () @start "
4.20 + " 0 0 moveto ";
4.21 + if (actions) {
4.22 + float r, g, b;
4.23 + actions->getColor().getRGB(r, g, b);
4.24 + oss << r << ' ' << g << ' ' << b << " setrgbcolor ";
4.25 + }
4.26 + _psi.execute(oss.str());
4.27 _initialized = true;
4.28 }
4.29 }
4.30 @@ -94,7 +101,7 @@
4.31
4.32 bool PsSpecialHandler::process (const char *prefix, istream &is, SpecialActions *actions) {
4.33 if (!_initialized)
4.34 - initialize();
4.35 + initialize(actions);
4.36 _actions = actions;
4.37
4.38 if (*prefix == '"') {
5.1 --- a/src/PsSpecialHandler.h Mon Nov 09 09:42:14 2009 +0100
5.2 +++ b/src/PsSpecialHandler.h Mon Nov 09 12:20:35 2009 +0100
5.3 @@ -58,7 +58,7 @@
5.4 bool process (const char *prefix, std::istream &is, SpecialActions *actions);
5.5
5.6 protected:
5.7 - void initialize ();
5.8 + void initialize (SpecialActions *actions);
5.9 void updatePos ();
5.10 void psfile (const std::string &fname, const std::map<std::string,std::string> &attr);
5.11
6.1 --- a/src/SVGTree.cpp Mon Nov 09 09:42:14 2009 +0100
6.2 +++ b/src/SVGTree.cpp Mon Nov 09 12:20:35 2009 +0100
6.3 @@ -127,14 +127,16 @@
6.4 bool set_matrix = (_matrix.changed() && !_matrix.get().isIdentity());
6.5 if (set_color || set_matrix) {
6.6 _span = new XMLElementNode("g");
6.7 - if (set_color)
6.8 + if (_color.get() != Color::BLACK)
6.9 _span->addAttribute("fill", _color.get().rgbString());
6.10 - if (set_matrix)
6.11 + if (!_matrix.get().isIdentity())
6.12 _span->addAttribute("transform", _matrix.get().getSVG());
6.13 _page->append(_span);
6.14 node = _span;
6.15 + _color.changed(false);
6.16 + _matrix.changed(false);
6.17 }
6.18 - else
6.19 + else if (_color.get() == Color::BLACK && _matrix.get().isIdentity())
6.20 node = _span = 0;
6.21 }
6.22