summaryrefslogtreecommitdiff
path: root/support/dktools/f2lto.h
blob: c219597a6641fa1af4904b650b732b36fc3ec876 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
Copyright (C) 2013-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: f2lto.ctr
*/

/**	@file f2lto.h Header file for the f2lto module.
*/

#ifndef F2LTO_H_INCLUDED
/** Avoid multiple inclusions. */
#define F2LTO_H_INCLUDED 1


#line 9 "f2lto.ctr"

#ifdef __cplusplus
extern "C" {
#endif

/**	Register PS font in a storage.
	@param	sFonts		Fonts storage.
	@param	iFonts		Storage iterator.
	@param	nFonts		Pointer to variable for total number of used
				fonts.
	@param	fontno		PS font number.
	@param	fontsize	Font size.
	@param	app		Application structure for diagnostics.
	@return	Pointer to text handling on success, NULL on error.
*/
f2l_text_handling_t *
f2l_tool_register_font(
  dk3_sto_t		*sFonts,
  dk3_sto_it_t		*iFonts,
  unsigned long		*nFonts,
  int			 fontno,
  double		 fontsize,
  dk3_app_t		*app
);

/**	Start LaTeX part of EPS+TEX or PDF+TEX.
	@param	of		Output file.
	@param	job		Job structure.
	@param	shortOutFile	Short output file name of EPS or PDF file.
	@param	iFonts		Font storage iterator.
	@param	nFonts		Total number of fonts.
*/
void
f2l_tool_start_tex_part(
  FILE			*of,
  f2l_job_t		*job,
  char const		*shortOutFile,
  dk3_sto_it_t		*iFonts,
  unsigned long		 nFonts
);

/**	Start LaTeX part of EPS+TEX, PDF+TEX or PGF.
	@param	of		Output file.
	@param	job		Job structure.
	@param	shortOutFile	Short output file name of EPS or PDF file.
	@param	iFonts		Font storage iterator.
	@param	nFonts		Total number of fonts.
	@param	wp		Flag: With picture environments.
*/
void
f2l_tool_start_tex_part_with_picture(
  FILE			*of,
  f2l_job_t		*job,
  char const		*shortOutFile,
  dk3_sto_it_t		*iFonts,
  unsigned long		 nFonts,
  int			 wp
);

/**	End LaTeX part of EPS+TEX or PDF+TEX.
	@param	of	Output file.
*/
void
f2l_tool_end_tex_part(
  FILE			*of
);

/**	Write one font name.
	@param	of	Output file.
	@param	fontno	Number of font to write.
	@param	nFonts	Total number of font definitions.
*/
void
f2l_tool_write_font_name(
  FILE			*of,
  unsigned long		 fontno,
  unsigned long		 nFonts
);

/**	Write inner part of text object.
	This function is used both for writing to a picture environment
	in a *.tex file and pgf text labels.
	@param	of	Output file.
	@param	job	Job structure.
	@param	drw	Drawing structure.
	@param	obj	Text object.
	@param	nFonts	Total number of PS fonts.
*/
void
f2l_tool_inner_text_object(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw,
  dk3_fig_obj_t		*obj,
  unsigned long		 nFonts
);

/**	Write one text object to LaTeX output in a picture environment.
	@param	of	Output file.
	@param	job	Job structure.
	@param	drw	Drawing structure.
	@param	obj	Text object.
	@param	x	X position.
	@param	y	Y position.
	@param	nFonts	Total number of PS fonts.
*/
void
f2l_tool_text_object(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw,
  dk3_fig_obj_t		*obj,
  double		 x,
  double		 y,
  unsigned long		 nFonts
);

/**	Write string to LaTeX output.
	@param	of	Output file.
	@param	txt	String, ISO-LATIN-1 encoded.
*/
void
f2l_tool_tex_string(
  FILE			*of,
  char const		*txt
);

/**	Create image file data.
	@param	filename	File name.
	@param	app		Application structure for diagnostics.
	@param	li		Line number of object definition.
	@return	Pointer to image file data on success, NULL on error.
*/
f2l_image_t *
f2l_tool_image_new(char const *filename, dk3_app_t *app, unsigned long li);

/**	Destroy image data.
	@param	im	Image data to destroy.
*/
void
f2l_tool_image_delete(f2l_image_t *im);

/**	Compare two image entries.
	@param	l	Left image entry.
	@param	r	Right image entry or unique file identifier.
	@param	cr	Comparison criteria (0=image/image, 1=image/ufi).
	@return	Comparison result.
*/
int
f2l_tool_compare_images(void const *l, void const *r, int cr);

/**	Set exit status code to error code if exit status indicates success.
	@param	job	Job structure.
	@param	exval	Error code.
*/
void
f2l_tool_set_exit_status(f2l_job_t *job, int exval);

/**	Begin LaTeX document (write document preamble and begin document line).
	@param	of	Output file.
	@param	job	Job structure.
*/
void
f2l_tool_begin_latex_document(
  FILE			*of,
  f2l_job_t		*job
);

/**	End LaTeX document (write end document line).
	@param	of	Output file.
*/
void
f2l_tool_end_latex_document(
  FILE			*of
);

/**	Find drawing direction for embedded image.
	@param	drw	Drawing structure.
	@param	obj	Current object to process.
	@param	ec	Pointer to error code variable, may be NULL.
	@return	Drawing direction.
*/
int
f2lto_find_draw_direction(
  dk3_fig_drawing_t	*drw,
  dk3_fig_obj_t		*obj,
  int			*ec
);

/**	Find suitable length for gaps in line styles.
	@param	job	Job structure.
	@param	lw	Line width.
	@param	lsv	Style value.
	@return	Gap length.
*/
double
f2lto_find_gap_length(f2l_job_t *job, double lw, double lsv);

#ifdef __cplusplus
}
#endif




#endif