1 /*************************************************************************
2 ** MapLine.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_MAPLINE_H
22 #define DVISVGM_MAPLINE_H
23 
24 #include <istream>
25 #include <string>
26 #include "MessageException.h"
27 
28 
29 class InputReader;
30 class SubfontDefinition;
31 
32 
33 struct MapLineException : MessageException
34 {
MapLineExceptionMapLineException35 	MapLineException (const std::string &msg) : MessageException(msg) {}
36 };
37 
38 
39 class MapLine
40 {
41 	public:
42 		MapLine (std::istream &is);
texname()43 		const std::string& texname () const   {return _texname;}
psname()44 		const std::string& psname () const    {return _psname;}
fontfname()45 		const std::string& fontfname () const {return _fontfname;}
encname()46 		const std::string& encname () const   {return _encname;}
fontindex()47 		int fontindex () const                {return _fontindex;}
bold()48 		double bold () const                  {return _bold;}
slant()49 		double slant () const                 {return _slant;}
extend()50 		double extend () const                {return _extend;}
sfd()51 		SubfontDefinition* sfd () const       {return _sfd;}
52 
53 	protected:
54 		void init ();
55 		bool isDVIPSFormat (const char *line) const;
56 		void parse (const char *line);
57 		void parseDVIPSLine (InputReader &ir);
58 		void parseDVIPDFMLine (InputReader &ir);
59 		void parseFilenameOptions (std::string opt);
60 
61 	private:
62 		std::string _texname;     ///< TeX font name
63 		std::string _psname;      ///< PS font name
64 		std::string _fontfname;   ///< name of fontfile
65 		std::string _encname;     ///< name of encoding (without file suffix ".enc")
66 		SubfontDefinition *_sfd;  ///< subfont definition to be used
67 		int _fontindex;           ///< font index of file with multiple fonts (e.g. ttc files)
68 		double _slant, _bold, _extend;
69 };
70 
71 
72 #endif
73