libDXF 0.0.1
A library with DXF related functions written in C.
Functions

style.c File Reference

Functions for a DXF style entity (STYLE). More...

#include "style.h"
Include dependency graph for style.c:

Go to the source code of this file.

Functions

DxfStyledxf_style_new ()
 Allocate memory for a DXF STYLE.
DxfStyledxf_style_init (DxfStyle *style)
 Allocate memory and initialize data fields in a DXF STYLE entity.
DxfStyledxf_style_read (DxfFile *fp, DxfStyle *style)
 Read data from a DXF file into a DXF STYLE entity.
int dxf_style_write (DxfFile *fp, DxfStyle *style)
 Write DXF output for a DXF STYLE entity.
int dxf_style_free (DxfStyle *style)
 Free the allocated memory for a DXF STYLE and all it's data fields.
void dxf_style_free_chain (DxfStyle *styles)
 Free the allocated memory for a chain of DXF STYLE symbol table entries and all their data fields.
int dxf_style_is_shape_file (DxfStyle *style)
 Test if a shape file should be loaded.
int dxf_style_is_text_vertical (DxfStyle *style)
 Test if a shape text is vertically oriented.
int dxf_style_is_xreferenced (DxfStyle *style)
 Test if style is externally dependent on an xref.
int dxf_style_is_xresolved (DxfStyle *style)
 Test if style is externally dependent on a xref and has been successfully resolved.
int dxf_style_is_referenced (DxfStyle *style)
 Test if style is internally referenced by an entity.

Detailed Description

Functions for a DXF style entity (STYLE).

Author:
Copyright (C) 2014, 2015, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.

Copyright Notices.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330,
Boston,
MA 02111 USA.

Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.


Definition in file style.c.


Function Documentation

DxfStyle* dxf_style_new ( )

Allocate memory for a DXF STYLE.

Fill the memory contents with zeros.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.

Definition at line 53 of file style.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_style_init(), and dxf_style_read().

DxfStyle* dxf_style_init ( DxfStyle style)

Allocate memory and initialize data fields in a DXF STYLE entity.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 97 of file style.c.

References _, dxf_style::big_font_filename, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_style_new(), dxf_style::flag, dxf_style::height, dxf_style::id_code, dxf_style::last_height, dxf_style::next, dxf_style::oblique_angle, dxf_style::primary_font_filename, dxf_style::style_name, dxf_style::text_generation_flag, and dxf_style::width.

Referenced by dxf_style_read().

Here is the call graph for this function:

DxfStyle* dxf_style_read ( DxfFile fp,
DxfStyle style 
)

Read data from a DXF file into a DXF STYLE entity.

The last line read from file contained the string "STYLE".
Now follows some data for the STYLE, to be terminated with a " 0" string announcing the following entity, or the end of the TABLES section marker ENDTAB.
While parsing the DXF file store data in style.

Returns:
a pointer to style.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
fpDXF file pointer to an input file (or device).
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 157 of file style.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, dxf_style::big_font_filename, dxf_style::dictionary_owner_hard, dxf_style::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_style_init(), dxf_style_new(), dxf_file_struct::filename, dxf_style::flag, dxf_file_struct::fp, dxf_style::height, dxf_style::id_code, dxf_style::last_height, dxf_file_struct::line_number, dxf_style::oblique_angle, dxf_style::primary_font_filename, dxf_style::style_name, dxf_style::text_generation_flag, and dxf_style::width.

Here is the call graph for this function:

int dxf_style_write ( DxfFile fp,
DxfStyle style 
)

Write DXF output for a DXF STYLE entity.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.

Todo:
for version R14.
Implementing the start of application-defined group "{application_name", with Group code 102.
For example: "{ACAD_REACTORS" indicates the start of the AutoCAD persistent reactors group.

application-defined codes: Group codes and values within the 102 groups are application defined (optional).

End of group, "}" (optional), with Group code 102.

Parameters:
fpDXF file pointer to an output file (or device).
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 352 of file style.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_style::big_font_filename, dxf_style::dictionary_owner_hard, dxf_style::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_style::flag, dxf_file_struct::fp, dxf_style::height, dxf_style::id_code, dxf_style::last_height, dxf_style::oblique_angle, dxf_style::primary_font_filename, dxf_style::style_name, dxf_style::text_generation_flag, and dxf_style::width.

int dxf_style_free ( DxfStyle style)

Free the allocated memory for a DXF STYLE and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the memory occupied by the DXF STYLE symbol table entry.

Definition at line 451 of file style.c.

References _, dxf_style::big_font_filename, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_style::next, dxf_style::primary_font_filename, and dxf_style::style_name.

Referenced by dxf_style_free_chain().

void dxf_style_free_chain ( DxfStyle styles)

Free the allocated memory for a chain of DXF STYLE symbol table entries and all their data fields.

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylesa pointer to the chain of DXF STYLE symbol table entries.

Definition at line 499 of file style.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_style_free(), and dxf_style::next.

Here is the call graph for this function:

int dxf_style_is_shape_file ( DxfStyle style)

Test if a shape file should be loaded.

Returns:
TRUE when a shape file should be loaded, or FALSE when not, or (-1) when an error occured.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 540 of file style.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, FALSE, and dxf_style::flag.

int dxf_style_is_text_vertical ( DxfStyle style)

Test if a shape text is vertically oriented.

Returns:
TRUE when vertical oriented, or FALSE when not vertically oriented, or (-1) when an error occured.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 581 of file style.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, FALSE, and dxf_style::flag.

int dxf_style_is_xreferenced ( DxfStyle style)

Test if style is externally dependent on an xref.

Returns:
TRUE when style is externally dependent on an xref, or FALSE when style is not externally dependent on an xref, or (-1) when an error occured.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 622 of file style.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, FALSE, and dxf_style::flag.

int dxf_style_is_xresolved ( DxfStyle style)

Test if style is externally dependent on a xref and has been successfully resolved.

Returns:
TRUE when style is externally dependent on a xref and has been successfully resolved, or FALSE when style is not externally dependent on a xref and has not been successfully resolved, or (-1) when an error occured.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 665 of file style.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, FALSE, and dxf_style::flag.

int dxf_style_is_referenced ( DxfStyle style)

Test if style is internally referenced by an entity.

Returns:
TRUE when style is internally referenced by an entity, or FALSE when style is not internally referenced by an entity, or (-1) when an error occured.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
stylea pointer to the DXF STYLE symbol table entry.

Definition at line 707 of file style.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, FALSE, and dxf_style::flag.