Skip to content

Commit

Permalink
{?color} macro now considers currentColor setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mgieseki committed Jul 5, 2023
1 parent 5bcbbef commit e8c81d1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/DvisvgmSpecialHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
** along with this program; if not, see <http://www.gnu.org/licenses/>. **
*************************************************************************/

#include <array>
#include <cstring>
#include <utility>
#include "Calculator.hpp"
Expand Down Expand Up @@ -218,17 +217,16 @@ static void expand_constants (string &str, SpecialActions &actions) {
}
}
}
struct Constant {
const struct Constant {
const char *name;
string val;
};
const array<Constant, 5> constants {{
} constants[] = {
{"x", XMLString(actions.getX())},
{"y", XMLString(actions.getY())},
{"color", actions.getColor().svgColorString()},
{"color", SVGElement::USE_CURRENTCOLOR && SVGElement::CURRENTCOLOR == actions.getColor() ? "currentColor" : actions.getColor().svgColorString()},
{"matrix", actions.getMatrix().toSVG()},
{"nl", "\n"},
}};
};
for (const Constant &constant : constants) {
const string pattern = string("{?")+constant.name+"}";
auto pos = str.find(pattern);
Expand Down

0 comments on commit e8c81d1

Please sign in to comment.