dkle.h File Reference

Encoding changes for use with LaTeX This module converts 32-bit characters into the appropriate LaTeX sequences to show the glyphs. More...

#include <dk.h>
#include <dktypes.h>

Go to the source code of this file.

Functions

dk_le_tdkle_open (char *d)
 Create encoding structure.
int dkle_load (dk_le_t *l, dk_udword c)
 Attempt to load table for character c from file (if not yet loaded).
char * dkle_get_encoding (dk_le_t *l, dk_udword c, int m)
 Get encoding for character (LaTeX sequence).
int dkle_get_error_code (dk_le_t *l, int r)
 Retrieve (and optionally reset) the error code for the last error occured in the encoding structure.
char * dkle_get_filename (dk_le_t *l)
 Retrieve file name in which the last error occured.
unsigned long dkle_get_error_lineno (dk_le_t *l)
 Retrieve line number in which the last error occured.
size_t dkle_length_plain_to_latex (dk_le_t *l, char *s)
 Find necessary result buffer length to convert plain text string into LaTeX sequence.
int dkle_put_plain_to_latex (dk_le_t *l, char *d, size_t s, char *p)
 Convert plain text string into LaTeX sequence.
size_t dkle_length_utf8_to_latex (dk_le_t *l, char *u)
 Find necessary result buffer length to convert UTF-8 encoded text string into LaTeX sequence.
int dkle_put_utf8_to_latex (dk_le_t *l, char *d, size_t s, char *u)
 Convert UTF-8 encoded text string into LaTeX sequence.
void dkle_close (dk_le_t *l)
 Destroy encoding structure obtained from dkle_open() and release the memory.


Detailed Description

Encoding changes for use with LaTeX This module converts 32-bit characters into the appropriate LaTeX sequences to show the glyphs.

A dk_le_t structure is needed for the conversions, this structure can be created using dkle_open(). After usage release the memory by calling dkle_close(). Conversion tables can be loaded using the dkle_load() function. The dkle_get_encoding() function can be used to get a string containing the LaTeX sequence for a character.

Unless otherwise stated, int functions in this module return a positive number to indicate success or a true condition, 0 to indicate an error or an unfullfilled condition. Pointer functions return valid pointers on success, NULL on error.

See ``Data tables for the dkle module''.

See Encoding tables for the dkle module for details about encoding table files.


Function Documentation

void dkle_close ( dk_le_t l  ) 

Destroy encoding structure obtained from dkle_open() and release the memory.

Parameters:
l Pointer to encoding structure.

char* dkle_get_encoding ( dk_le_t l,
dk_udword  c,
int  m 
)

Get encoding for character (LaTeX sequence).

Parameters:
l Pointer to encoding structure.
c 32 bit character to convert.
m Flag to indicate math mode (1) or text mode (0).
Returns:
Pointer to LaTex sequence string on success, NULL on error.

int dkle_get_error_code ( dk_le_t l,
int  r 
)

Retrieve (and optionally reset) the error code for the last error occured in the encoding structure.

Parameters:
l Pointer to encoding structure.
r Flag to reset error code.
Returns:
Key to indicate type of last error.

unsigned long dkle_get_error_lineno ( dk_le_t l  ) 

Retrieve line number in which the last error occured.

Parameters:
l Pointer to encoding structure.
Returns:
Line number.

char* dkle_get_filename ( dk_le_t l  ) 

Retrieve file name in which the last error occured.

Parameters:
l Pointer to encoding structure.
Returns:
File name of last error or NULL.

size_t dkle_length_plain_to_latex ( dk_le_t l,
char *  s 
)

Find necessary result buffer length to convert plain text string into LaTeX sequence.

Parameters:
l Pointer to encoding structure.
s Plain text string.
Returns:
The length needed for the result buffer (you must add 1 for the final 0x00 byte). A result of 0 indicates an error.

size_t dkle_length_utf8_to_latex ( dk_le_t l,
char *  u 
)

Find necessary result buffer length to convert UTF-8 encoded text string into LaTeX sequence.

Parameters:
l Pointer to encoding structure.
u UTF-8 encoded text string.
Returns:
The length needed for the result buffer (you must add 1 for the final 0x00 byte). A result of 0 indicates an error.

int dkle_load ( dk_le_t l,
dk_udword  c 
)

Attempt to load table for character c from file (if not yet loaded).

Parameters:
l Pointer to encoding structure.
c The 32 bit character to convert.
Returns:
Flag to indicate the table is loaded.

dk_le_t* dkle_open ( char *  d  ) 

Create encoding structure.

The encoding structure is created in dynamically allocated memory. Use dkle_open() to destory the structure and release the memory when the structure is no longer needed.

Parameters:
d A base directory containing the data files.
Returns:
Pointer to encoding structure on success, NULL on error.

int dkle_put_plain_to_latex ( dk_le_t l,
char *  d,
size_t  s,
char *  p 
)

Convert plain text string into LaTeX sequence.

Parameters:
l Pointer to encoding structure.
d Destination buffer to store result.
s Length of d in bytes.
p Plaint text string.
Returns:
Flag to indicate success.

int dkle_put_utf8_to_latex ( dk_le_t l,
char *  d,
size_t  s,
char *  u 
)

Convert UTF-8 encoded text string into LaTeX sequence.

Parameters:
l Pointer to encoding structure.
d Destination buffer to store result.
s Length of d in bytes.
u UTF-8 encoded text string.
Returns:
Flag to indicate success.


Generated on Mon Feb 16 17:12:04 2009 for dklibs by  doxygen 1.5.6