GDS-Render v1.2.1
LaTeX / TikZ Renderer
Collaboration diagram for LaTeX / TikZ Renderer:

Data Structures

struct  _LatexRenderer
 Struct representing the LaTeX-Renderer object. More...
 

Macros

#define GDS_RENDER_TYPE_LATEX_RENDERER   (latex_renderer_get_type())
 
#define LATEX_LINE_BUFFER_KB   (10)
 Buffer for LaTeX Code line in KiB. More...
 
#define WRITEOUT_BUFFER(buff)   fwrite((buff)->str, sizeof(char), (buff)->len, tex_file)
 Writes a GString buffer to the fixed file tex_file. More...
 

Enumerations

enum  { PROP_STANDALONE = 1 , PROP_PDF_LAYERS , N_PROPERTIES }
 

Functions

LatexRenderer * latex_renderer_new ()
 Create new LatexRenderer object. More...
 
LatexRenderer * latex_renderer_new_with_options (gboolean pdf_layers, gboolean standalone)
 Create new LatexRenderer object. More...
 
static void write_layer_definitions (FILE *tex_file, GList *layer_infos, GString *buffer)
 Write the layer declarration to TeX file. More...
 
static gboolean write_layer_env (FILE *tex_file, GdkRGBA *color, int layer, GList *linfo, GString *buffer)
 Write layer Envirmonment. More...
 
static void generate_graphics (FILE *tex_file, GList *graphics, GList *linfo, GString *buffer, double scale)
 Writes a graphics object to the specified tex_file. More...
 
static void render_cell (struct gds_cell *cell, GList *layer_infos, FILE *tex_file, GString *buffer, double scale, GdsOutputRenderer *renderer)
 Render cell to file. More...
 
static int latex_render_cell_to_code (struct gds_cell *cell, GList *layer_infos, FILE *tex_file, double scale, gboolean create_pdf_layers, gboolean standalone_document, GdsOutputRenderer *renderer)
 
static int latex_renderer_render_output (GdsOutputRenderer *renderer, struct gds_cell *cell, double scale)
 
static void latex_renderer_init (LatexRenderer *self)
 
static void latex_renderer_get_property (GObject *obj, guint property_id, GValue *value, GParamSpec *pspec)
 
static void latex_renderer_set_property (GObject *obj, guint property_id, const GValue *value, GParamSpec *pspec)
 
static void latex_renderer_class_init (LatexRendererClass *klass)
 

Variables

static GParamSpec * latex_renderer_properties [N_PROPERTIES] = {NULL}
 

Detailed Description

This is the class implementing the \(\mbox{\LaTeX}\) / TikZ output rendering

Properties

This class inherits all properties from its parent GDS Output Renderer base class. In addition to that, it implements the following properties:

Property Name Description
standalone Configure output LaTeX document to be standalone compilable (requires standalone documentclass)
pdf-layers Create OCG layers in LaTeX output

Macro Definition Documentation

◆ GDS_RENDER_TYPE_LATEX_RENDERER

#define GDS_RENDER_TYPE_LATEX_RENDERER   (latex_renderer_get_type())

Definition at line 41 of file latex-renderer.h.

◆ LATEX_LINE_BUFFER_KB

#define LATEX_LINE_BUFFER_KB   (10)

Buffer for LaTeX Code line in KiB.

Definition at line 46 of file latex-renderer.h.

◆ WRITEOUT_BUFFER

#define WRITEOUT_BUFFER (   buff)    fwrite((buff)->str, sizeof(char), (buff)->len, tex_file)

Writes a GString buffer to the fixed file tex_file.

Note
This is a convinience macro. Do not use this anywhere else. It might change behavior in futurtre releases

Definition at line 60 of file latex-renderer.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_STANDALONE 
PROP_PDF_LAYERS 
N_PROPERTIES 

Definition at line 50 of file latex-renderer.c.

Function Documentation

◆ generate_graphics()

static void generate_graphics ( FILE *  tex_file,
GList *  graphics,
GList *  linfo,
GString *  buffer,
double  scale 
)
static

Writes a graphics object to the specified tex_file.

This function opens the layer, writes a graphics object and closes the layer

Parameters
tex_fileFile to write to
graphicsObject to render
linfoLayer information
bufferWorking buffer
scaleScale abject down by this value

Definition at line 166 of file latex-renderer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ latex_render_cell_to_code()

static int latex_render_cell_to_code ( struct gds_cell cell,
GList *  layer_infos,
FILE *  tex_file,
double  scale,
gboolean  create_pdf_layers,
gboolean  standalone_document,
GdsOutputRenderer *  renderer 
)
static

Definition at line 295 of file latex-renderer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ latex_renderer_class_init()

static void latex_renderer_class_init ( LatexRendererClass *  klass)
static

Definition at line 424 of file latex-renderer.c.

Here is the call graph for this function:

◆ latex_renderer_get_property()

static void latex_renderer_get_property ( GObject *  obj,
guint  property_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 388 of file latex-renderer.c.

Here is the caller graph for this function:

◆ latex_renderer_init()

static void latex_renderer_init ( LatexRenderer *  self)
static

Definition at line 382 of file latex-renderer.c.

◆ latex_renderer_new()

LatexRenderer * latex_renderer_new ( )

Create new LatexRenderer object.

Returns
New object

Definition at line 452 of file latex-renderer.c.

◆ latex_renderer_new_with_options()

LatexRenderer * latex_renderer_new_with_options ( gboolean  pdf_layers,
gboolean  standalone 
)

Create new LatexRenderer object.

This function sets the 'pdf-layers' and 'standalone' properties for the newly created object.

They can later be changes by modifying the properties again. On top of that, The options can be changed in the resulting LaTeX output file if needed.

Parameters
pdf_layersIf PDF OCR layers should be enabled
standaloneIf output TeX file should be standalone compilable
Returns
New object

Definition at line 457 of file latex-renderer.c.

Here is the caller graph for this function:

◆ latex_renderer_render_output()

static int latex_renderer_render_output ( GdsOutputRenderer *  renderer,
struct gds_cell cell,
double  scale 
)
static

Definition at line 349 of file latex-renderer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ latex_renderer_set_property()

static void latex_renderer_set_property ( GObject *  obj,
guint  property_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 405 of file latex-renderer.c.

Here is the caller graph for this function:

◆ render_cell()

static void render_cell ( struct gds_cell cell,
GList *  layer_infos,
FILE *  tex_file,
GString *  buffer,
double  scale,
GdsOutputRenderer *  renderer 
)
static

Render cell to file.

Parameters
cellCell to render
layer_infosLayer information
tex_fileFile to write to
bufferWorking buffer
scaleScale output down by this value
rendererThe current renderer as GdsOutputRenderer. This is used to emit the status updates to the GUI

Definition at line 245 of file latex-renderer.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_layer_definitions()

static void write_layer_definitions ( FILE *  tex_file,
GList *  layer_infos,
GString *  buffer 
)
static

Write the layer declarration to TeX file.

This writes the declaration of the layers and the mapping in which order the layers shall be rendered by TikZ. Layers are written in the order they are positioned inside the layer_infos list.

Parameters
tex_fileTeX-File to write to
layer_infosList containing layer_info structs.
buffer
Note
The field layer_info::stacked_position is ignored. Stack depends on list order.

Definition at line 74 of file latex-renderer.c.

Here is the caller graph for this function:

◆ write_layer_env()

static gboolean write_layer_env ( FILE *  tex_file,
GdkRGBA *  color,
int  layer,
GList *  linfo,
GString *  buffer 
)
static

Write layer Envirmonment.

If the requested layer shall be rendered, this code writes the necessary code to open the layer. It also returns the color the layer shall be rendered in.

The followingenvironments are generated:

\begin{pgfonlayer}{<layer>}
% If pdf layers shall be used also this is enabled:
\begin{scope}[ocg={ref=<layer>, status=visible,name={<Layer Name>}}]

If the layer shall not be rendered, FALSE is returned and the color is not filled in and the cod eis not written to the file.

Parameters
tex_fileTeX file to write to
colorReturn of the layer's color
layerRequested layer number
linfoLayer information list containing layer_info structs
bufferSome working buffer
Returns
TRUE, if the layer shall be rendered.
Note
The opened environments have to be closed afterwards

Definition at line 133 of file latex-renderer.c.

Here is the caller graph for this function:

Variable Documentation

◆ latex_renderer_properties

GParamSpec* latex_renderer_properties[N_PROPERTIES] = {NULL}
static

Definition at line 422 of file latex-renderer.c.