summaryrefslogtreecommitdiff
path: root/support/dktools/f2lto.h
blob: b2d5b54a633e3785d7ba55347b6de90585704487 (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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
/*
	WARNING: This file was generated by dkct.
	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
*/

/*
Copyright (C) 2013-2017, Dirk Krause

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above opyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used
  to endorse or promote products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**	@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	drw		Drawing 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,
  dk3_fig_drawing_t	*drw,
  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	drw		Drawing 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,
  dk3_fig_drawing_t	*drw,
  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 commands to choose a font.
	@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_font_selection(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw,
  dk3_fig_obj_t		*obj,
  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
);

/**	Write instruction to select a font by features to LaTeX output.
	@param	of		Output file.
	@param	job		Job structure.
	@param	drw		Drawing structure.
	@param	obj		Text object.
	@param	fontSize	Font size.
	@param	fontFeatures	Font features.
	@param	useFamily	Flag: Choose font family.
*/
void
f2l_tool_font_select_by_features(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw,
  dk3_fig_obj_t		*obj,
  double		 fontSize,
  int			 fontFeatures,
  int			 useFamily
);

/**	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.
	@param	drw	Drawing structure.
*/
void
f2l_tool_begin_latex_document(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw
);

/**	End LaTeX document (write end document line).
	@param	of	Output file.
	@param	job	Job structure.
	@param	drw	Drawing structure.
*/
void
f2l_tool_end_latex_document(
  FILE			*of,
  f2l_job_t		*job,
  dk3_fig_drawing_t	*drw
);

/**	Find drawing direction for embedded image.
	@param	job	Job structure.
	@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(
  f2l_job_t		*job,
  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