summaryrefslogtreecommitdiff
path: root/support/dktools/f2leps.ctr
diff options
context:
space:
mode:
Diffstat (limited to 'support/dktools/f2leps.ctr')
-rw-r--r--support/dktools/f2leps.ctr2506
1 files changed, 0 insertions, 2506 deletions
diff --git a/support/dktools/f2leps.ctr b/support/dktools/f2leps.ctr
deleted file mode 100644
index 2cf68ecf58..0000000000
--- a/support/dktools/f2leps.ctr
+++ /dev/null
@@ -1,2506 +0,0 @@
-%% options
-
-copyright owner = Dirk Krause
-copyright year = 2012-xxxx
-SPDX-License-Identifier: BSD-3-Clause
-
-
-
-%% header
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Driver initialization for pdf with tex driver.
- @param job Job structure.
- @param drw Drawing structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_with_tex_initialize(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Driver cleanup for pdf with tex driver.
- @param job Job structure.
- @param drw Drawing structure.
-*/
-void
-f2leps_eps_with_tex_end(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Write start of output for eps with tex driver.
- @param job Job structure.
- @param drw Drawing structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_with_tex_start_processing(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Write end of output for eps with tex driver.
- @param job Job structure.
- @param drw Drawing structure.
-*/
-void
-f2leps_eps_with_tex_end_processing(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Open output files for eps with tex driver.
- @param job Job structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_with_tex_open_output_files(f2l_job_t *job);
-
-/** Close output files for eps with tex driver.
- @param job Job structure.
-*/
-void
-f2leps_eps_with_tex_close_output_files(f2l_job_t *job);
-
-/** Process one text object.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_with_tex_text_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Process one image object.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param outbb Bounding box for image.
- @param drawdir Drawing direction.
- @param ec Pointer to error code variable, may be NULL.
-*/
-void
-f2leps_eps_with_tex_image_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- dk3_bb_t *outbb,
- int drawdir,
- int *ec
-);
-
-/** Start new path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_newpath(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Move to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_with_tex_moveto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Draw line to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_with_tex_lineto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Draw curve to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param xcs Start control point y.
- @param ycs Start control point y.
- @param xce End control point x.
- @param yce End control point y.
- @param xe End point x.
- @param ye End point y.
-*/
-void
-f2leps_eps_with_tex_curveto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double xcs,
- double ycs,
- double xce,
- double yce,
- double xe,
- double ye
-);
-
-/** Close path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_closepath(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Fill path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_fill(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Clip drawing operations to path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_clip(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Stroke path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_stroke(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Save graphics state.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_gsave(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Restore graphics state.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_with_tex_grestore(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Set color.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param r Red.
- @param g Green.
- @param b Blue.
-*/
-void
-f2leps_eps_with_tex_setcolor(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double r,
- double g,
- double b
-);
-
-/** Set line width.
- The line width is not set again if we already
- have a current line width equal to the new line width.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig Object.
- @param lw New line width in output coordinates.
-*/
-void
-f2leps_eps_with_tex_set_line_width(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double lw
-);
-
-/** Set line style.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Object to set up.
- @param ls Line style, see @ref dk3figlinestyles.
- @param sv Style value in output coordinates.
- @param lw Dot length in output coordinates.
-*/
-void
-f2leps_eps_with_tex_set_line_style(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int ls,
- double sv,
- double lw
-);
-
-/** Set line end.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig object.
- @param le Line end, see @ref dk3figlinecap.
-*/
-void
-f2leps_eps_with_tex_set_line_end(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int le
-);
-
-/** Set line join.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig object.
- @param lj Line join style, see @ref dk3figlinejoin.
-*/
-void
-f2leps_eps_with_tex_set_line_join(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int lj
-);
-
-/** Set current color or stroking color (PGF, PDF).
- @param job Job structure.
- @param drw Drawing structure.
- @param rgb New color value.
-*/
-void
-f2leps_eps_with_tex_set_color_1(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_rgb_color_t *rgb
-);
-
-/** Set non-stroking color (PGF, PDF).
- @param job Job structure.
- @param drw Drawing structure.
- @param rgb New color value.
-*/
-void
-f2leps_eps_with_tex_set_color_2(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_rgb_color_t *rgb
-);
-
-
-/** Write debugging line to output file.
- @param job Job structure.
- @param msg Message to write to output file.
-*/
-void
-f2leps_eps_with_tex_debug(
- f2l_job_t *job,
- char const *msg
-);
-
-/** Driver initialization for tex with pdf driver.
- @param job Job structure.
- @param drw Drawing structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_pure_initialize(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Driver cleanup for tex with pdf driver.
- @param job Job structure.
- @param drw Drawing structure.
-*/
-void
-f2leps_eps_pure_end(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Write start of output for eps driver.
- @param job Job structure.
- @param drw Drawing structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_pure_start_processing(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Write end of output for eps driver.
- @param job Job structure.
- @param drw Drawing structure.
-*/
-void
-f2leps_eps_pure_end_processing(f2l_job_t *job, dk3_fig_drawing_t *drw);
-
-/** Open output files for eps driver.
- @param job Job structure.
- @return 1 on success, 0 on error.
-*/
-int
-f2leps_eps_pure_open_output_files(f2l_job_t *job);
-
-/** Close output files for eps driver.
- @param job Job structure.
-*/
-void
-f2leps_eps_pure_close_output_files(f2l_job_t *job);
-
-/** Process one text object.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_pure_text_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Process one image object.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param outbb Bounding box for image.
- @param drawdir Drawing direction.
- @param ec Pointer to error code variable, may be NULL.
-*/
-void
-f2leps_eps_pure_image_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- dk3_bb_t *outbb,
- int drawdir,
- int *ec
-);
-
-/** Start new path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_newpath(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Move to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_pure_moveto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Draw line to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param x Point x.
- @param y Point y.
-*/
-void
-f2leps_eps_pure_lineto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-);
-
-/** Draw curve to point.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param xcs Start control point y.
- @param ycs Start control point y.
- @param xce End control point x.
- @param yce End control point y.
- @param xe End point x.
- @param ye End point y.
-*/
-void
-f2leps_eps_pure_curveto(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double xcs,
- double ycs,
- double xce,
- double yce,
- double xe,
- double ye
-);
-
-/** Close path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_closepath(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Fill path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_fill(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Clip drawing operations to path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_clip(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Stroke path.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_stroke(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Save graphics state.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_gsave(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Restore graphics state.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
-*/
-void
-f2leps_eps_pure_grestore(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj
-);
-
-/** Set color.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Current object to process.
- @param r Red.
- @param g Green.
- @param b Blue.
-*/
-void
-f2leps_eps_pure_setcolor(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double r,
- double g,
- double b
-);
-
-
-/** Set line width.
- The line width is not set again if we already
- have a current line width equal to the new line width.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig object.
- @param lw New line width in output coordinates.
-*/
-void
-f2leps_eps_pure_set_line_width(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double lw
-);
-
-/** Set line style.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Object to set up.
- @param ls Line style, see @ref dk3figlinestyles.
- @param sv Style value in output coordinates.
- @param lw Dot length in output coordinates.
-*/
-void
-f2leps_eps_pure_set_line_style(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int ls,
- double sv,
- double lw
-);
-
-/** Set line end.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig object.
- @param le Line end, see @ref dk3figlinecap.
-*/
-void
-f2leps_eps_pure_set_line_end(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int le
-);
-
-/** Set line join.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Fig object.
- @param lj Line join style, see @ref dk3figlinejoin.
-*/
-void
-f2leps_eps_pure_set_line_join(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int lj
-);
-
-/** Set current color or stroking color (PGF, PDF).
- @param job Job structure.
- @param drw Drawing structure.
- @param rgb New color value.
-*/
-void
-f2leps_eps_pure_set_color_1(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_rgb_color_t *rgb
-);
-
-/** Set non-stroking color (PGF, PDF).
- @param job Job structure.
- @param drw Drawing structure.
- @param rgb New color value.
-*/
-void
-f2leps_eps_pure_set_color_2(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_rgb_color_t *rgb
-);
-
-/** Write debugging line to output file.
- @param job Job structure.
- @param msg Message to write to output file.
-*/
-void
-f2leps_eps_pure_debug(
- f2l_job_t *job,
- char const *msg
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-%% module
-
-#include "dk3all.h"
-#include "dk3bezcu.h"
-#include "fig2lat.h"
-#include "f2lud.h"
-#include "f2lsvg.h"
-#include "f2leps.h"
-#include "dk3figto.h"
-#if 0
-#include "dkt-version.h"
-#endif
-#include "dk4vers.h"
-#include "dk3font.h"
-#include "dk3bm.h"
-#include "dk3bmeps.h"
-#include "dk3unused.h"
-
-
-
-$!trace-include
-
-
-
-/** Drawing-related information for EPS output.
-*/
-typedef struct {
- char const *shortOutFile; /**< Short output file name. */
- dk3_sto_t *sFonts; /**< Fonts and sizes (dk3_fig_font_t). */
- dk3_sto_it_t *iFonts; /**< Fonts storage iterator. */
- int *fonts; /**< 35 flags: Font used. */
- unsigned long nFonts; /**< Number of fonts in sFonts. */
- int havetext; /**< Flag: Text to show as PS text. */
- int alignedright; /**< Flag: Right-aligned text found. */
- int alignedcenter; /**< Flag: Centered text found. */
- int dictsize; /**< Size of dictionary. */
-} f2leps_drawing_info_t;
-
-
-
-#if 0
-/** Font reencoding to write ISO-LATIN-1 encoded strings.
-*/
-static char const * const f2leps_font_reencode_2[] = {
-$!text
-/FontReEncode % originalname encodedname --
-{
- 5 dict begin /nn exch def /an exch def an findfont dup
- length dict /nf exch def
- {
- 1 index /FID ne
- { nf 3 1 roll put }
- { pop pop }
- ifelse
- }
- forall
- nf /Encoding ISOLatin1Encoding put nn nf end definefont pop
-}
-def
-$!end
-};
-#else
-/** Font reencoding to write ISO-LATIN-1 encoded strings.
-*/
-static char const * const f2leps_font_reencode_2[] = {
-$!text
-/FontReEncode % originalname newname --
-{ % on nn
- exch % nn on
- findfont % nn of
- dup % nn of of
- length % nn of length
- 1 add % nn of length
- dict % nn of nf
- exch % nn nf of
- { % nn nf key value
- 1 index % nn nf key value key
- /FID eq % nn nf key value flag
- { % nn nf key value
- pop pop % nn nf
- }
- { % nn nf key value
- 2 index % nn nf key value nf
- 3 1 roll % nn nf nf key value
- put % nn nf
- }
- ifelse % nn nf
- }
- forall % nn nf
- dup % nn nf nf
- /Encoding ISOLatin1Encoding put % nn nf
- definefont % nf
- pop %
-}
-def
-$!end
-};
-#endif
-
-#if 0
-
-/** Procedure for right aligned text.
-*/
-static char const * const f2leps_right_aligned_text[] = {
-$!text
-/TextAlignedRight % text --
-{
- currentpoint % text x y
- 3 -1 roll % x y text
- dup % x y text text
- true charpath % x y text
- flattenpath % x y text
- pathbbox % x y text x1 y1 x2 y2
- pop exch pop % x y text x1 x2
- exch sub abs % x y text length
- newpath 4 -2 roll % text length x y
- moveto % text length
- 0 exch sub % text distance
- 0 rmoveto % text
- show %
-} def
-$!end
-};
-
-
-
-/** Procedure for centered text.
-*/
-static char const * const f2leps_centered_aligned_text[] = {
-$!text
-/TextAlignedCentered % text --
-{
- currentpoint % text x y
- 3 -1 roll % x y text
- dup % x y text text
- true charpath % x y text
- flattenpath % x y text
- pathbbox % x y text x1 y1 x2 y2
- pop exch pop % x y text x1 x2
- exch sub abs % x y text length
- newpath 4 -2 roll % text length x y
- moveto % text length
- 0.5 mul % text distance
- 0 exch sub % text xshift
- 0 rmoveto % text
- show %
-} def
-$!end
-};
-
-#else
-
-/** Procedure for right aligned text.
-*/
-static char const * const f2leps_right_aligned_text[] = {
-$!text
-/TextAlignedRight % x y text --
-{
- dup % x y text text
- newpath % x y text text
- 0 0 moveto % x y text text
- true charpath % x y text
- pathbbox % x y text x1 y1 x2 y2
- pop % x y text x1 y1 x2
- exch % x y text x1 x2 y1
- pop % x y text x1 x2
- exch % x y text x2 x1
- pop % x y text width
- newpath % x y text width
- 4 3 roll % y text width x
- exch % y text x width
- sub % y text x
- 3 2 roll % text x y
- moveto % text
- show % -
-} def
-$!end
-};
-
-
-
-/** Procedure for centered text.
-*/
-static char const * const f2leps_centered_aligned_text[] = {
-$!text
-/TextAlignedCentered % x y text --
-{
- dup % x y text text
- newpath % x y text text
- 0 0 moveto % x y text text
- true charpath % x y text
- pathbbox % x y text x1 y1 x2 y2
- pop % x y text x1 y1 x2
- exch % x y text x1 x2 y1
- pop % x y text x1 x2
- exch % x y text x2 x1
- pop % x y text width
- 0.5 mul % x y text width/2
- newpath % x y text width/2
- 4 3 roll % y text width/2 x
- exch % y text x width/2
- sub % y text x
- 3 2 roll % text x y
- moveto % text
- show % -
-} def
-$!end
-};
-
-#endif
-
-
-
-/** Keywords used by the module.
-*/
-static
-char const * const f2leps_c8_kw[] = {
-$!string-table
-#
-# 0: Newline
-#
-\n
-#
-# 1: Space
-#
-
-#
-# 2: File header for PS level 3
-#
-\%!PS-Adobe-3.0 EPSF-3.0\n
-#
-# 3: File header for PS level 2
-#
-\%!PS-Adobe-2.0 EPSF-2.0\n
-#
-# 4: Language level 3
-#
-\%%LanguageLevel: 3\n
-#
-# 5: Language level 2
-#
-\%%LanguageLevel: 2\n
-#
-# 6: Bounding box
-#
-\%%BoundingBox:
-#
-# 7: Format string for bounding box data.
-#
-0 0 %ld %ld\n
-#
-# 8: Creator string
-#
-\%%Creator: http://sourceforge.net/p/dktools/wiki/fig2lat/\n
-#
-# 9: Title string.
-#
-\%%Title: Converted Fig image\n
-#
-# 10: Pages
-#
-\%%Pages: 1\n
-#
-# 11: PageOrder
-#
-\%%PageOrder: Ascend\n
-#
-# 12: DocumentData
-#
-\%%DocumentData: Clean7Bit\n
-#
-# 13: EndComments
-#
-\%%EndComments\n
-#
-# 14: Page
-#
-\%%Page: 1 1\n
-#
-# 15: gsave
-#
-gsave\n
-#
-# 16: grestore
-#
-grestore\n
-#
-# 17: xxx dict begin
-#
-\%d dict begin\n
-#
-# 18: end
-#
-end\n
-#
-# 19: showpage
-#
-showpage\n
-#
-# 20: Trailer and EOF
-#
-\%%Trailer\n%%EOF\n
-#
-# 21: newpath
-#
-newpath\n
-#
-# 22: clip to bounding box
-#
-0 0 moveto %ld 0 lineto %ld %ld lineto 0 %ld lineto 0 0 lineto\n
-#
-# 23: Close path and clip
-#
-closepath clip\n
-#
-# 24: Font reencoding
-#
-/%s /fnt%02d FontReEncode\n
-#
-# 25: Move to
-#
-\%g %g moveto\n
-#
-# 26: Line to
-#
-\%g %g lineto\n
-#
-# 27: Curve to
-#
-\%g %g %g %g %g %g curveto\n
-#
-# 28: Close path
-#
-closepath\n
-#
-# 29: Fill using even/odd rule
-#
-eofill\n
-#
-# 30: Clip using even/odd rule
-#
-eoclip\n
-#
-# 31: Stroke
-#
-stroke\n
-#
-# 32: Set RGB color
-#
-\%g %g %g setrgbcolor\n
-#
-# 33: Set line width
-#
-\%g setlinewidth\n
-#
-# 34: Set line cap
-#
-\%d setlinecap\n
-#
-# 35: Set line join
-#
-\%d setlinejoin\n
-#
-# 36: Dash for solid line.
-#
-[] 0 setdash\n
-#
-# 37: Dashed line.
-#
-[%g %g] 0 setdash\n
-#
-# 38: Dash-dotted line
-#
-[%g %g %g %g] 0 setdash\n
-#
-# 39: Dash-double-dotted line
-#
-[%g %g %g %g %g %g] 0 setdash\n
-#
-# 40: Dash-triple-dotted line
-#
-[%g %g %g %g %g %g %g %g] 0 setdash\n
-#
-# 41: Start of string.
-#
-(
-#
-# 42: End of string.
-#
-)
-#
-# 43: Font setup
-#
-/fnt%02d findfont %g scalefont setfont\n
-#
-# 44: Show left-justified text
-#
- show\n
-#
-# 45: Show centered text
-#
- TextAlignedCentered\n
-#
-# 46: Show right-justified text
-#
- TextAlignedRight\n
-#
-# 47: Translate
-#
-\%g %g translate\n
-#
-# 48: Rotate
-#
-\%g rotate\n
-#
-# 49: Go to origin
-#
-0 0 moveto\n
-#
-# 50: Procedure to show string.
-#
- 3 -2 roll newpath moveto show\n
-#
-# 51: Origin coordinates
-#
-0 0
-#
-# 52: Start of debug line.
-#
-%
-$!end
-};
-
-
-$*
-Tool functions
-$*
-
-
-
-/** Destroy drawing info structure.
- @param pdi Structure to destroy.
-*/
-static
-void
-f2leps_drawing_info_delete(
- f2leps_drawing_info_t *pdi
-)
-{
- void *ptr; /* Current text handling information to delete. */
-
- if(pdi) {
- dk3_release(pdi->shortOutFile);
- if(pdi->sFonts) {
- if(pdi->iFonts) {
- dk3sto_it_reset(pdi->iFonts);
- while(NULL != (ptr = dk3sto_it_next(pdi->iFonts))) {
- dk3_delete(ptr);
- }
- dk3sto_it_close(pdi->iFonts);
- }
- dk3sto_close(pdi->sFonts);
- } pdi->sFonts = NULL; pdi->iFonts = NULL;
- dk3_release(pdi->fonts);
- dk3_delete(pdi);
- }
-}
-
-
-
-/** Create drawing information structure.
- @param job Job structure.
- @param withFonts Flag: Gather LaTeX font information.
- This flag is set to 1 for EPS/LaTeX and set to 0 for
- pure EPS.
- @return Pointer to new structure on success, NULL on error.
-*/
-static
-f2leps_drawing_info_t *
-f2leps_drawing_info_new(
- f2l_job_t *job,
- int withFonts
-)
-{
- f2leps_drawing_info_t *back;
- int ok = 0;
- back = dk3_new_app(f2leps_drawing_info_t,1,job->app);
- if(back) {
- back->nFonts = 0UL;
- back->sFonts = NULL;
- back->iFonts = NULL;
- back->fonts = NULL;
- back->havetext = 0;
- back->alignedright = 0;
- back->alignedcenter = 0;
- back->dictsize = 0;
- back->shortOutFile = NULL;
- if(withFonts) {
- back->sFonts = dk3sto_open_app(job->app);
- if(back->sFonts) {
- dk3sto_set_comp(back->sFonts, dk3fig_tool_font_compare, 0);
- back->iFonts = dk3sto_it_open(back->sFonts);
- if(back->iFonts) {
- ok = 1;
- }
- }
- } else {
- back->fonts = dk3_new_app(int,35,job->app);
- if(back->fonts) {
- ok = 1;
- }
- }
- if(!(ok)) {
- f2leps_drawing_info_delete(back);
- back = NULL;
- }
- }
- return back;
-}
-
-
-
-/** Write a text section to the output file.
- @param of Output file.
- @param ta String array to write.
-*/
-static
-void
-f2leps_write_text_section(
- FILE *of,
- char const * const *ta
-)
-{
- char const * const *ptr;
- ptr = ta;
- while(*ptr) {
- fputs(*(ptr++), of);
- fputc('\n', of);
- }
-}
-
-
-
-/** Write EPS file header.
- @param job Job structure.
- @param drw Drawing structure.
- @param of Output file.
- @param pure Flag: Pure EPS (1) or EPS/LaTeX (0).
-*/
-static
-void
-f2leps_file_header(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- FILE *of,
- int pure
-)
-{
- f2leps_drawing_info_t *pdi;
- int i;
- pdi = (f2leps_drawing_info_t *)(drw->dsd);
- /* %!PS-Adobe-3.0 EPSF-3.0 */
- if(2 < job->pslevel) {
- fputs(f2leps_c8_kw[2], of);
- fputs(f2leps_c8_kw[4], of);
- } else {
- fputs(f2leps_c8_kw[3], of);
- fputs(f2leps_c8_kw[5], of);
- }
- /* bounding box */
- fputs(f2leps_c8_kw[6], of);
- fprintf(of, f2leps_c8_kw[7], job->lwidth, job->lheight);
- if(job->dsc) {
- /* Creator */
- fputs(f2leps_c8_kw[8], of);
- /* Title */
- fputs(f2leps_c8_kw[9], of);
- /* Pages */
- fputs(f2leps_c8_kw[10], of);
- /* PageOrder */
- fputs(f2leps_c8_kw[11], of);
- /* DocumentData */
- fputs(f2leps_c8_kw[12], of);
- if(pure) {
- /* ##### HIER WEITER: DocumentNeededFonts */
- }
- /* EndComments */
- fputs(f2leps_c8_kw[13], of);
- /* Page */
- fputs(f2leps_c8_kw[14], of);
- }
- fputs(f2leps_c8_kw[15], of);
- fputs(f2leps_c8_kw[21], of);
- fprintf(
- of, f2leps_c8_kw[22],
- job->lwidth, job->lwidth, job->lheight, job->lheight
- );
- fputs(f2leps_c8_kw[23], of);
- if(pure) {
- /* xxx dict begin */
- fprintf(of, f2leps_c8_kw[17], pdi->dictsize);
- }
- /* Text procedures */
- if(pdi->havetext) {
- f2leps_write_text_section(of, f2leps_font_reencode_2);
- if(pdi->alignedcenter) {
- f2leps_write_text_section(of, f2leps_centered_aligned_text);
- }
- if(pdi->alignedright) {
- f2leps_write_text_section(of, f2leps_right_aligned_text);
- }
- /* Font reencodings */
- for(i = 0; i < 35; i++) {
- if((pdi->fonts)[i]) {
- fprintf(of, f2leps_c8_kw[24], dk3font_get_ps_font_name(i), i);
- }
- }
- }
-}
-
-
-
-/** Write EPS file header.
- @param job Job structure.
- @param drw Drawing structure.
- @param of Output file.
- @param pure Flag: Pure EPS (1) or EPS/LaTeX (0).
-*/
-static
-void
-f2leps_file_footer(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- FILE *of,
- int pure
-)
-{
- DK3_UNUSED_ARG(drw)
- if(pure) {
- /* end */
- fputs(f2leps_c8_kw[18], of);
- }
- /* grestore */
- fputs(f2leps_c8_kw[16], of);
- if(job->showpage) {
- /* showpage */
- fputs(f2leps_c8_kw[19], of);
- }
- if(job->dsc) {
- /* Trailer, EOF */
- fputs(f2leps_c8_kw[20], of);
- }
-}
-
-
-
-/** Check whether a text character is literal.
- @param c Character to check.
- @return 1 to issue character as is, 0 for octal encoding.
-*/
-static
-int
-f2leps_is_literal(char c)
-{
- int back = 0;
- if(('A' <= c) && ('Z' >= c)) {
- back = 1;
- } else {
- if(('a' <= c) && ('z' >= c)) {
- back = 1;
- } else {
- if(('0' <= c) && ('9' >= c)) {
- back = 1;
- } else {
- switch(c) {
- case ' ':
- {
- back = 1;
- } break;
- }
- }
- }
- }
- return back;
-}
-
-
-
-/** Write string PS-encoded to output.
- @param of Output file.
- @param str String to write.
-*/
-static
-void
-f2leps_encode_string(
- FILE *of,
- char const *str
-)
-{
- char buf[32];
- char const *ptr;
- char c;
- unsigned char uc;
- unsigned u;
- ptr = str;
- fputs(f2leps_c8_kw[41], of);
- while(*ptr) {
- c = *(ptr++);
- if(f2leps_is_literal(c)) {
- fputc(c, of);
- } else {
- uc = (unsigned char)c;
- u = (unsigned)uc;
- while(255 < u) { u = u - 256; }
- sprintf(buf, "\\%03o", u);
- fputs(buf, of);
- }
- }
- fputs(f2leps_c8_kw[42], of);
-}
-
-
-
-/** Process an embedded bitmap image.
- @param of Output file.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Image object.
- @param outbb Destination image area.
- @param drawdir Drawing direction / coordinates origin.
- @param ec Pointer to error code variable.
-*/
-static
-void
-f2leps_image_object(
- FILE *of,
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t *obj,
- dk3_bb_t *outbb,
- int drawdir,
- int *ec
-)
-{
- int res = 0;
- DK3_UNUSED_ARG(drw)
- res = dk3bm_ps_place_object(
- of,outbb,drawdir,(obj->dt).pol.fn,job->app,job->pslevel,ec
- );
- if(!(res)) {
- job->exval = FIG2LAT_EXIT_ERROR_UNKNOWN; $? ". exitcode"
- }
-}
-
-
-
-/** Set line style.
- @param of Output file.
- @param job Job structure.
- @param drw Drawing structure.
- @param obj Object using the line style.
- @param ls Line style.
- @param sv Style value (gap length).
- @param lw Line width.
-*/
-static
-void
-f2leps_set_line_style(
- FILE *of,
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- int ls,
- double sv,
- double lw
-)
-{
- double gw; /* Gap width. */
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- gw = f2lto_find_gap_length(job, lw, sv);
- switch(ls) {
- case DK3_FIG_LS_DASHED: {
- fprintf(of, f2leps_c8_kw[37], sv, gw);
- } break;
- case DK3_FIG_LS_DOTTED: {
- fprintf(of, f2leps_c8_kw[37], lw, gw);
- } break;
- case DK3_FIG_LS_DASH_DOTTED: {
- fprintf(of, f2leps_c8_kw[38], sv, gw, lw, gw);
- } break;
- case DK3_FIG_LS_DASH_DOUBLE_DOTTED: {
- fprintf(of, f2leps_c8_kw[39], sv, gw, lw, gw, lw, gw);
- } break;
- case DK3_FIG_LS_DASH_TRIPLE_DOTTED: {
- fprintf(of, f2leps_c8_kw[40], sv, gw, lw, gw, lw, gw, lw, gw);
- } break;
- default: {
- fputs(f2leps_c8_kw[36], of);
- } break;
- }
-}
-
-
-
-/** Write debug line to output.
- @param of Output file.
- @param job Job structure.
- @param msg Message text to write.
-*/
-static
-void
-f2leps_debug(
- FILE *of,
- f2l_job_t *job,
- char const *msg
-)
-{
- if((job) && (msg)) {
- fputs(f2leps_c8_kw[52], of);
- fputs(msg, of);
- fputs(f2leps_c8_kw[0], of);
- }
-}
-
-
-
-$*
-Driver: EPS with LaTeX
-$*
-
-
-int
-f2leps_eps_with_tex_initialize(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- f2leps_drawing_info_t *pdi;
- dk3_fig_obj_t *pobj;
- dkChar const *oldsourcename = NULL;
- unsigned long oldsourceline = 0UL;
- int back = 0;
- int ff;
- $? "+ f2leps_eps_with_tex_initialize"
- drw->dsd = (void *)(pdi = f2leps_drawing_info_new(job, 1));
- if(drw->dsd) { $? ". dsd"
- oldsourcename = dk3app_get_source_file(job->app);
- oldsourceline = dk3app_get_source_line(job->app);
- pdi->shortOutFile = dk3fig_tool_short_output_file_name(job->on2, job->app);
- if(pdi->shortOutFile) { $? ". shortOutFile"
- back = 1; $? ". back = 1"
- dk3sto_it_reset(drw->iobj);
- while(NULL != (pobj = (dk3_fig_obj_t *)dk3sto_it_next(drw->iobj))) {
- $? ". object found %d %d", pobj->ot, pobj->st
- dk3app_set_source_line(job->app, pobj->li);
- switch(pobj->ot) {
- case DK3_FIG_OBJ_TEXT: { $? ". text"
- ff = (pobj->dt).txt.ff;
- if(!(ff & DK3_FIG_FONT_FLAG_HIDDEN)) { $? ". not hidden"
- if(!(ff & DK3_FIG_FONT_FLAG_SPECIAL)) { $? ". not special"
- if(ff & DK3_FIG_FONT_FLAG_PS) { $? ". PS font"
- if(job->ntf) { $? ". ntf"
- pobj->dsd = (void *)f2l_tool_register_font(
- pdi->sFonts, pdi->iFonts, &(pdi->nFonts),
- (pobj->dt).txt.fo, (pobj->dt).txt.fs, job->app
- );
- if(!(pobj->dsd)) {
- back = 0;
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- } else { $? ". no ntf"
- }
- }
- }
- }
- } break;
- }
- }
- } else { $? "! shortOutFile"
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- dk3app_set_source_file(job->app, oldsourcename);
- dk3app_set_source_line(job->app, oldsourceline);
- } else { $? "! dsd"
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- } $? "- f2leps_eps_with_tex_initialize %d", back
- return back;
-}
-
-
-
-void
-f2leps_eps_with_tex_end(
- f2l_job_t * DK3_SILENCE_ARG_UNUSED(job),
- dk3_fig_drawing_t *drw
-)
-{
- $? "+ f2leps_eps_with_tex_end"
- DK3_UNUSED_ARG(job)
- if(drw->dsd) {
- f2leps_drawing_info_delete((f2leps_drawing_info_t *)(drw->dsd));
- }
- $? "- f2leps_eps_with_tex_end"
-}
-
-
-
-int
-f2leps_eps_with_tex_open_output_files(f2l_job_t *job)
-{
- int back = 0;
- $? "+ f2leps_eps_with_tex_open_output_files"
- job->of1 = dk3sf_fopen_app(job->on1, dkT("w"), job->app);
- if(job->of1) {
- job->of2 = dk3sf_fopen_app(job->on2, dkT("wb"), job->app);
- if(job->of2) {
- back = 1;
- } else {
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- } else {
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- $? "- f2leps_eps_with_tex_open_output_files %d", back
- return back;
-}
-
-
-
-void
-f2leps_eps_with_tex_close_output_files(f2l_job_t *job)
-{
- $? "+ f2leps_eps_with_tex_close_output_files"
- if(job->of2) {
- dk3sf_fclose_app(job->of2, job->app);
- } job->of2 = NULL;
- if(job->of1) {
- dk3sf_fclose_app(job->of1, job->app);
- } job->of1 = NULL;
- $? "- f2leps_eps_with_tex_close_output_files"
-}
-
-
-
-int
-f2leps_eps_with_tex_start_processing(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- f2leps_drawing_info_t *pdi;
- int back = 1;
- $? "+ f2leps_eps_with_tex_start_processing"
- pdi = (f2leps_drawing_info_t *)(drw->dsd);
- f2leps_file_header(job, drw, job->of2, 0);
- f2l_tool_start_tex_part(
- job->of1, job, pdi->shortOutFile, pdi->iFonts, pdi->nFonts
- );
- $? "- f2leps_eps_with_tex_start_processing %d", back
- return back;
-}
-
-
-
-void
-f2leps_eps_with_tex_end_processing(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- $? "+ f2leps_eps_with_tex_end_processing"
- f2leps_file_footer(job, drw, job->of2, 0);
- f2l_tool_end_tex_part(job->of1);
- $? "- f2leps_eps_with_tex_end_processing"
-}
-
-
-
-void
-f2leps_eps_with_tex_text_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-)
-{
- f2leps_drawing_info_t *pdi;
- pdi = (f2leps_drawing_info_t *)(drw->dsd);
- f2l_tool_text_object(job->of1, job, drw, obj, x, y, pdi->nFonts);
-}
-
-
-
-void
-f2leps_eps_with_tex_image_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- dk3_bb_t *outbb,
- int drawdir,
- int *ec
-)
-{
- f2leps_image_object(job->of2, job, drw, obj, outbb, drawdir, ec);
-}
-
-
-void
-f2leps_eps_with_tex_newpath(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[21], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_moveto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double x,
- double y
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[25], x, y);
-}
-
-
-
-void
-f2leps_eps_with_tex_lineto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double x,
- double y
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[26], x, y);
-}
-
-
-
-void
-f2leps_eps_with_tex_curveto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double xcs,
- double ycs,
- double xce,
- double yce,
- double xe,
- double ye
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[27], xcs, ycs, xce, yce, xe, ye);
-}
-
-
-
-void
-f2leps_eps_with_tex_closepath(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[28], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_fill(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[29], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_clip(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[30], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_stroke(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[31], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_gsave(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[15], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_grestore(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[16], job->of2);
-}
-
-
-
-void
-f2leps_eps_with_tex_setcolor(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double r,
- double g,
- double b
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[32], r, g, b);
-}
-
-
-
-void
-f2leps_eps_with_tex_set_line_width(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double lw
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[33], lw);
-}
-
-
-void
-f2leps_eps_with_tex_set_line_style(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int ls,
- double sv,
- double lw
-)
-{
- f2leps_set_line_style(job->of2, job, drw, obj, ls, sv, lw);
-}
-
-
-
-void
-f2leps_eps_with_tex_set_line_end(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- int le
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[34], le);
-}
-
-
-
-void
-f2leps_eps_with_tex_set_line_join(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- int lj
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of2, f2leps_c8_kw[35], lj);
-}
-
-
-
-void
-f2leps_eps_with_tex_set_color_1(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_rgb_color_t *rgb
-)
-{
- DK3_UNUSED_ARG(drw)
- fprintf(job->of2, f2leps_c8_kw[32], rgb->r, rgb->g, rgb->b);
-}
-
-
-
-void
-f2leps_eps_with_tex_set_color_2(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_rgb_color_t *rgb
-)
-{
- DK3_UNUSED_ARG(drw)
- fprintf(job->of2, f2leps_c8_kw[32], rgb->r, rgb->g, rgb->b);
-}
-
-
-
-void
-f2leps_eps_with_tex_debug(
- f2l_job_t *job,
- char const *msg
-)
-{
- f2leps_debug(job->of2, job, msg);
-}
-
-
-$*
-Driver: EPS standalone file
-$*
-
-
-int
-f2leps_eps_pure_initialize(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- f2leps_drawing_info_t *pdi;
- dk3_fig_obj_t *pobj;
- int back = 0;
- int fn;
- int i;
- int ff;
- drw->dsd = (void *)(pdi = f2leps_drawing_info_new(job, 0));
- if(drw->dsd) {
- back = 1;
- /* Inspect all elements.
- */
- dk3sto_it_reset(drw->iobj);
- while(NULL != (pobj = (dk3_fig_obj_t *)dk3sto_it_next(drw->iobj))) {
- switch(pobj->ot) {
- case DK3_FIG_OBJ_TEXT: {
- ff = (pobj->dt).txt.ff;
- if(!(ff & DK3_FIG_FONT_FLAG_HIDDEN)) {
- if(!(ff & DK3_FIG_FONT_FLAG_SPECIAL)) {
- pdi->havetext = 1;
- switch(pobj->st) {
- case 1: {
- pdi->alignedcenter = 1;
- } break;
- case 2: {
- pdi->alignedright = 1;
- } break;
- }
- fn = dk3fig_tool_ps_font_number(pobj);
- if(-1 < fn) {
- if(35 > fn) {
- (pdi->fonts)[fn] = 1;
- }
- }
- }
- }
- } break;
- case DK3_FIG_OBJ_ELLIPSE:
- case DK3_FIG_OBJ_POLYLINE:
- case DK3_FIG_OBJ_SPLINE:
- case DK3_FIG_OBJ_ARC: {
- } break;
- }
- }
- /* Calculate dictionary size.
- */
- for(i = 0; i < 35; i++) {
- if((pdi->fonts)[i]) { /* Fonts */
- pdi->dictsize += 1;
- }
- }
- if(pdi->havetext) { /* Font reencode procedure */
- pdi->dictsize += 1;
- }
- if(pdi->alignedcenter) { /* Procedure to show centered text. */
- pdi->dictsize += 1;
- }
- if(pdi->alignedright) { /* Procedure to show right-algigned. */
- pdi->dictsize += 1;
- }
- pdi->dictsize += 5; /* Reserve. */
- } else {
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- return back;
-}
-
-
-
-void
-f2leps_eps_pure_end(
- f2l_job_t * DK3_SILENCE_ARG_UNUSED(job),
- dk3_fig_drawing_t *drw
-)
-{
- DK3_UNUSED_ARG(job)
- if(drw->dsd) {
- f2leps_drawing_info_delete((f2leps_drawing_info_t *)(drw->dsd));
- }
-}
-
-
-
-int
-f2leps_eps_pure_open_output_files(f2l_job_t *job)
-{
- int back = 0;
- job->of1 = dk3sf_fopen_app(job->on1, dkT("wb"), job->app);
- if(job->of1) {
- back = 1;
- } else {
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYSTEM); $? ". exitcode"
- }
- return back;
-}
-
-
-
-void
-f2leps_eps_pure_close_output_files(f2l_job_t *job)
-{
- if(job->of1) {
- dk3sf_fclose_app(job->of1, job->app);
- } job->of1 = NULL;
-}
-
-
-
-int
-f2leps_eps_pure_start_processing(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- int back = 1;
- f2leps_file_header(job, drw, job->of1, 1);
- return back;
-}
-
-
-
-void
-f2leps_eps_pure_end_processing(f2l_job_t *job, dk3_fig_drawing_t *drw)
-{
- f2leps_file_footer(job, drw, job->of1, 1);
-}
-
-
-
-void
-f2leps_eps_pure_text_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- double x,
- double y
-)
-{
- dk3_rgb_color_t rgb;
- double fs;
- int ff;
- int fn;
- int muc;
- ff = (obj->dt).txt.ff;
- if(!(ff & DK3_FIG_FONT_FLAG_HIDDEN)) {
- if(!(ff & DK3_FIG_FONT_FLAG_SPECIAL)) {
- fn = dk3fig_tool_ps_font_number(obj);
- if(-1 < fn) {
- if((obj->dt).txt.st) {
- /* Set color */
- dk3fig_tool_find_color(&rgb, drw, (obj->pc), 20);
- muc = dk3fig_tool_must_set_color(
- (job->gs).hc1, (job->gs).c1.r, (job->gs).c1.g, (job->gs).c1.b,
- rgb.r, rgb.g, rgb.b
- );
- if(muc) {
- fprintf(job->of1, f2leps_c8_kw[32], rgb.r, rgb.g, rgb.b);
- (job->gs).c1.r = rgb.r;
- (job->gs).c1.g = rgb.g;
- (job->gs).c1.b = rgb.b;
- (job->gs).c2.r = rgb.r;
- (job->gs).c2.g = rgb.g;
- (job->gs).c2.b = rgb.b;
- (job->gs).hc1 = 1;
- (job->gs).hc2 = 1;
- }
- /* Set font */
- fs = (obj->dt).txt.fs;
- if(0.0 < job->nts) { fs = fs * job->nts; }
- muc = dk3fig_tool_must_set_font(
- (job->gs).hfn, (job->gs).fn, (job->gs).fs, fn, fs
- );
- if(muc) {
- fprintf(job->of1, f2leps_c8_kw[43], fn, fs);
- (job->gs).hfn = 1;
- (job->gs).fn = fn;
- (job->gs).fs = fs;
- }
- if(1.0e-6 < fabs((obj->dt).txt.an)) { /* rotated */
- /* gsave */
- fputs(f2leps_c8_kw[15], job->of1);
- /* translate */
- fprintf(job->of1, f2leps_c8_kw[47], x, y);
- /* rotate */
- fprintf(
- job->of1, f2leps_c8_kw[48],
- ((180.0 * (obj->dt).txt.an) / M_PI)
- );
-#if 0
- /* newpath */
- fputs(f2leps_c8_kw[21], job->of1);
- /* 0 0 moveto */
- fputs(f2leps_c8_kw[49], job->of1);
- /* string */
- f2leps_encode_string(job->of1, (obj->dt).txt.st);
- /* show/show aligned */
- switch(obj->st) {
- case 2: {
- fputs(f2leps_c8_kw[46], job->of1);
- } break;
- case 1: {
- fputs(f2leps_c8_kw[45], job->of1);
- } break;
- default: {
- fputs(f2leps_c8_kw[44], job->of1);
- } break;
- }
-#else
- fputs(f2leps_c8_kw[51], job->of1);
- /* string */
- f2leps_encode_string(job->of1, (obj->dt).txt.st);
- /* show/show aligned */
- switch(obj->st) {
- case 2: {
- fputs(f2leps_c8_kw[46], job->of1);
- } break;
- case 1: {
- fputs(f2leps_c8_kw[45], job->of1);
- } break;
- default: {
- fputs(f2leps_c8_kw[50], job->of1);
- } break;
- }
-#endif
- /* grestore */
- fputs(f2leps_c8_kw[16], job->of1);
- } else { /* not rotated */
-#if 0
- /* newpath */
- fputs(f2leps_c8_kw[21], job->of1);
- /* moveto */
- fprintf(job->of1, f2leps_c8_kw[25], x, y);
- /* string */
- f2leps_encode_string(job->of1, (obj->dt).txt.st);
- /* show/show aligned */
- switch(obj->st) {
- case 2: {
- fputs(f2leps_c8_kw[46], job->of1);
- } break;
- case 1: {
- fputs(f2leps_c8_kw[45], job->of1);
- } break;
- default: {
- fputs(f2leps_c8_kw[44], job->of1);
- } break;
- }
-#else
- fprintf(job->of1, "%g %g\n", x, y);
- /* string */
- f2leps_encode_string(job->of1, (obj->dt).txt.st);
- /* show/show aligned */
- switch(obj->st) {
- case 2: {
- fputs(f2leps_c8_kw[46], job->of1);
- } break;
- case 1: {
- fputs(f2leps_c8_kw[45], job->of1);
- } break;
- default: {
- fputs(f2leps_c8_kw[50], job->of1);
- } break;
- }
-#endif
- }
- } else {
- /* ##### BUG: No string */
- }
- } else {
- /* ##### BUG: No font number found! */
- }
- } else {
- /* Warning: Skipping special text! */
- dk3app_log_1(job->app, DK3_LL_WARNING, job->msg, 41);
- f2l_tool_set_exit_status(job, FIG2LAT_EXIT_ERROR_SYNTAX); $? ". exitcode"
- }
- }
-}
-
-
-
-void
-f2leps_eps_pure_image_object(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- dk3_bb_t *outbb,
- int drawdir,
- int *ec
-)
-{
- f2leps_image_object(job->of1, job, drw, obj, outbb, drawdir, ec);
-}
-
-
-void
-f2leps_eps_pure_newpath(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[21], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_moveto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double x,
- double y
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[25], x, y);
-}
-
-
-
-void
-f2leps_eps_pure_lineto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double x,
- double y
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[26], x, y);
-}
-
-
-
-void
-f2leps_eps_pure_curveto(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double xcs,
- double ycs,
- double xce,
- double yce,
- double xe,
- double ye
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[27], xcs, ycs, xce, yce, xe, ye);
-}
-
-
-
-void
-f2leps_eps_pure_closepath(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[28], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_fill(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[29], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_clip(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[30], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_stroke(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[31], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_gsave(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[15], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_grestore(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj)
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fputs(f2leps_c8_kw[16], job->of1);
-}
-
-
-
-void
-f2leps_eps_pure_setcolor(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double r,
- double g,
- double b
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[32], r, g, b);
-}
-
-
-
-void
-f2leps_eps_pure_set_line_width(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- double lw
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[33], lw);
-}
-
-
-
-void
-f2leps_eps_pure_set_line_style(
- f2l_job_t *job,
- dk3_fig_drawing_t *drw,
- dk3_fig_obj_t *obj,
- int ls,
- double sv,
- double lw
-)
-{
- f2leps_set_line_style(job->of1, job, drw, obj, ls, sv, lw);
-}
-
-
-
-void
-f2leps_eps_pure_set_line_end(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- int le
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[34], le);
-}
-
-
-
-void
-f2leps_eps_pure_set_line_join(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_fig_obj_t * DK3_SILENCE_ARG_UNUSED(obj),
- int lj
-)
-{
- DK3_UNUSED_ARG(drw)
- DK3_UNUSED_ARG(obj)
- fprintf(job->of1, f2leps_c8_kw[35], lj);
-}
-
-
-
-void
-f2leps_eps_pure_set_color_1(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_rgb_color_t *rgb
-)
-{
- DK3_UNUSED_ARG(drw)
- fprintf(job->of1, f2leps_c8_kw[32], rgb->r, rgb->g, rgb->b);
-}
-
-
-
-void
-f2leps_eps_pure_set_color_2(
- f2l_job_t *job,
- dk3_fig_drawing_t * DK3_SILENCE_ARG_UNUSED(drw),
- dk3_rgb_color_t *rgb
-)
-{
- DK3_UNUSED_ARG(drw)
- fprintf(job->of1, f2leps_c8_kw[32], rgb->r, rgb->g, rgb->b);
-}
-
-
-
-void
-f2leps_eps_pure_debug(
- f2l_job_t *job,
- char const *msg
-)
-{
- f2leps_debug(job->of1, job, msg);
-}
-