1 /************************************************************************* 2 ** EmSpecialHandler.h ** 3 ** ** 4 ** This file is part of dvisvgm -- the DVI to SVG converter ** 5 ** Copyright (C) 2005-2015 Martin Gieseking <martin.gieseking@uos.de> ** 6 ** ** 7 ** This program is free software; you can redistribute it and/or ** 8 ** modify it under the terms of the GNU General Public License as ** 9 ** published by the Free Software Foundation; either version 3 of ** 10 ** the License, or (at your option) any later version. ** 11 ** ** 12 ** This program is distributed in the hope that it will be useful, but ** 13 ** WITHOUT ANY WARRANTY; without even the implied warranty of ** 14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 15 ** GNU General Public License for more details. ** 16 ** ** 17 ** You should have received a copy of the GNU General Public License ** 18 ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** 19 *************************************************************************/ 20 21 #ifndef DVISVGM_EMSPECIALHANDLER_H 22 #define DVISVGM_EMSPECIALHANDLER_H 23 24 #include <list> 25 #include <map> 26 #include "Pair.h" 27 #include "SpecialHandler.h" 28 29 30 class EmSpecialHandler : public SpecialHandler, public DVIEndPageListener 31 { 32 struct Line { LineLine33 Line (int pp1, int pp2, char cc1, char cc2, double w) : p1(pp1), p2(pp2), c1(cc1), c2(cc2), width(w) {} 34 int p1, p2; ///< point numbers of line ends 35 char c1, c2; ///< cut type of line ends (h, v or p) 36 double width; ///< line width 37 }; 38 39 public: 40 EmSpecialHandler (); name()41 const char* name () const {return "em";} info()42 const char* info () const {return "line drawing statements of the emTeX special set";} 43 const char** prefixes () const; 44 bool process (const char *prefix, std::istream &in, SpecialActions *actions); 45 46 protected: 47 void dviEndPage (unsigned pageno); 48 49 private: 50 std::map<int, DPair> _points; ///< points defined by special em:point 51 std::list<Line> _lines; ///< list of lines with undefined end points 52 double _linewidth; ///< global line width 53 DPair _pos; ///< current position of "graphic cursor" 54 SpecialActions *_actions; 55 }; 56 57 #endif 58