summaryrefslogtreecommitdiff
path: root/src/Postscript.H
blob: 06f1515f3b0d62b5bc8061f90f4fd6ed7b990e61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Copyright 2007-2009 Johannes Hofmann <Johannes.Hofmann@gmx.de>
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.

#ifndef POSTSCRIPT_H
#define POSTSCRIPT_H

#include <stdio.h>
#include "PSEditModel.H"

class PSParser {
	protected:
		PSEditModel *pse;

		int cur_size;

		PSEditColor cur_text_color;

		int page;

	public: 
		PSParser(PSEditModel *p);
		virtual ~PSParser() {};

		virtual int parse(char *line);
};

class PSParser_2 : public PSParser {
	private:
		int inside;

	public:
		PSParser_2(PSEditModel *p);

		int parse(char *line);
};

class PSWriter {
	protected:
		PSEditModel *pse;

		const char * pos_format;
		const char * size_format;
		const char * text_format;
		const char * color_format;
		const char * glyph_format;
		const char * tag_format;

		void write_string(FILE *out, char *s);

		void write_main_block(FILE *out);

		void write_internal_format(FILE *out);

		int write_text(FILE *out, PSEditText *t);

		virtual const char *ps_header();

		virtual const char *ps_trailer();

	public: 
		PSWriter(PSEditModel *p);
		virtual ~PSWriter() {};

		int write(FILE *in, FILE *out);
};

class PSLevel1Writer : public PSWriter {
	protected:
		const char *ps_header();

		const char *ps_trailer();

	public:
		PSLevel1Writer(PSEditModel *p);
};

#endif