Content

General

libTextSuite is a library to render text with OpenGl or OpenGLES. The rendered text can be arranged in single lines or text blocks.

All api functions use the stdcall calling convention!

Data Types

Simple

pointer pointer with no data type
boolean 8bit value (zero is FALSE, all other values are TRUE)
int8 8bit signed integer
int16 16bit signed integer
int32 32bit signed integer
int64 64bit signed integer
uint8 8bit unsigned integer
uint16 16bit unsigned integer
uint32 32bit unsigned integer
uint64 64bit unsigned integer
float 32bit floating point
double 64bit floating point
AnsiChar uint8
AnsiString pointer to null terminated AnsiChar string
WideChar uint16
WideString pointer to null terminated WideChar string

Structures

RendererCustomData Stream FontMetric Position Rect Color ImageModes GlyphMetric PostProcessorCustomData ImageLoadFunc ImageBlendFunc

Constants

RenderType Format TextBlockFlags FontStyleFlags FontCreatorType FontAntiAliasing VertAlignment HorzAlignment TextBlockClipping ImageFormat ColorChannels CharRangeUsage

Functions

General

Function that are used to initialize or control the library.

ltsInitialize

description

initializes the internal library variables. must be called once before using any other function

returns

uint32error code

ltsGetLastErrorCode

description

returns the last error code of the last raised error. the error code will not be reseted after the call.

returns

uint32error code

ltsGetLastErrorMsg

description

returns the error message of the last raised error

returns

AnsiStringerror message

ltsFinalize

description

cleans up internal library variables. should be called once before program exits

returns

uint32error code

Context

The context is a wrapper object that owns all created objects. When you delete the context, all assigned objects will destroyed also.

ltsContextCreate

description

creates a new context handle

returns

pointercontext handle or NULL on failure

ltsContextGetCodePage

description

get the current code page of a context

parameters

pointercontext handle

pointer to uint32value to fill with current code page

returns

uint32error code

ltsContextGetDefaultChar

description

get the current default char of a context

parameters

pointercontext handle

WideCharvalue to fill with current default char

returns

uint32error code

ltsContextSetCodePage

description

set the code page of a context

parameters

pointercontext handle

uint32new code page value

return

uint32error code

ltsContextSetDefaultChar

description

set the default char of a context

parameters

pointercontext handle

WideCharnew default char value

returns

uint32error code

ltsContextAnsiToWide

description

convert an AnsiString to a WideString

parameters

pointercontext handle

AnsiStringstring to convert

returns

WideStringconverted string or NULL on failure

ltsContextDestroy

description

destroy a context handle

parameters

pointercontext handle

returns

uint32error code

Renderer

Renderers are objects to display text on the screen. You are able to decide which API you want to use for rendering. Out of the box OpenGL and OpenGLES is supported, but you are free to create your own renderer.

ltsRendererCreate

description

create a new renderer

parameters

pointercontext handle

uint32type of renderer (see RenderType constants)

uint32texture format (see Format constants)

returns

pointerrenderer handle or NULL on failure

ltsRendererCustomCreate

description

create a new custom renderer that can be controlled by the user

parameters

pointercontext handle

uint32texture format (see Format constants)

pointer to RendererCustomDatadata of custom renderer (RendererCustomData data type)

returns

pointerrenderer handle or NULL on failure

ltsRendererBeginBlock

description

begin a new text block

parameters

pointerrenderer handle

int32top of text block

int32left of text block

int32width of text block

int32height of text block

uint32text block flags (see TextBlockFlags constants)

returns

pointertext block handle

ltsRendererEndBlock

description

finish a text block and draw the assigned text

parameters

pointerrenderer handle

pointertext block handle

returns

uint32error code

ltsRendererAbortBlock

description

finish a text block but does not draw the assigned text

parameters

pointerrenderer handle

pointertext block handle

returns

uint32error code

ltsRendererGetTextWidthA

description

calculate the size of a certain string

parameters

pointerrenderer handle

pointerfont handle to use for rendering text

AnsiStringstring to calculate width for

returns

int32width of the given text or -1 on failure

ltsRendererGetTextWidthW

description

calculate the size of a certain string

parameters

pointerrenderer handle

pointerfont handle to use for rendering text

WideStringstring to calculate width for

returns

int32width of the given text or -1 on failure

ltsRendererDestroy

description

destroy a renderer handle

parameters

pointerrenderer handle to destroy

returns

uint32error code

Font Creator

Font creators are objects that will load glyphs for a certain char. Out of the box a GDI and a FreeType font creator are supported, but you are free to write your own one.

ltsFontCreatorCreate

description

creates a new font creator handle

parameters

pointercontext handle

uint32type of font creator to create (see FontCreatorType constants)

returns

pointerhandle to new font creator or NULL on failure

ltsFontCreatorGetFontByName

description

create a font handle using the name of the font

parameters

pointerfont creator handle

AnsiStringname of the font

int32font size

uint32font style flags (see FontStyleFlag constants)

uint32font anti aliasing (see FontAntiAliasing constants)

returns

pointerfont handle or NULL on failure

ltsFontCreatorGetFontByFile

description

create a font handle using a font file

parameters

pointerfont creator handle

AnsiStringfile name of the font file

int32font size

uint32font style flags (see FontStyleFlag constants)

uint32font anti aliasing (see FontAntiAliasing constants)

returns

pointerfont handle or NULL on failure

ltsFontCreatorGetFontByStream

description

create a font handle using a data stream

parameters

pointerfont creator handle

pointer to Streamstream to load font from (see Stream data type)

int32font size

uint32font style flags (see FontStyleFlag constants)

uint32font anti aliasing (see FontAntiAliasing constants)

returns

pointerfont handle or NULL on failure

ltsFontCreatorDestroy

description

destroy a font creator

parameters

pointerfont creator handle to destroy

returns

uint32error code

Font

Font objects are used to define the appearance (size, style, ...) of text. They are created using a font creator.

ltsFontGetPostProcessor

description

get the current post processor of a font

parameters

pointerfont handle

returns

pointercurrent assigned post processor

ltsFontGetTabWidth

description

get the current tab with of a font

parameters

pointerfont handle

pointer to int32value to write current tab width to

returns

uint32error code

ltsFontGetCharSpacing

description

get the current char spacing of a font

parameters

pointerfont handle

pointer to int32value to write current char spacing to

returns

uint32error code

ltsFontGetLineSpacing

description

get the current line spacing of a font

parameters

pointerfont handle

pointer to floatvalue to write current line spacing to

returns

uint32error code

ltsFontGetMetric

description

get the metric of a font

parameters

pointerfont handle

pointer to FontMetricvalue to write font metric to (see FontMetric data type)

returns

uint32error code

ltsFontGetFontname

description

get name of a font

parameters

pointerfont handle

returns

AnsiStringfont name or NULL on failure

ltsFontGetFacename

description

get face name of a font

parameters

pointerfont handle

returns

AnsiStringface name or NULL on failure

ltsFontGetStylename

description

get style name of a font

parameters

pointerfont handle

returns

AnsiStringstyle name or NULL on failure

ltsFontGetFullname

description

get full name of a font

parameters

pointerfont handle

returns

AnsiStringfull name or NULL on failure

ltsFontGetCopyright

description

get copyright of a font

parameters

pointerfont handle

returns

AnsiStringcopyright or NULL on failure

ltsFontSetPostProcessor

description

set post processor of a font

parameters

pointerfont handle

pointerpost processor handle

returns

uint32error code

ltsFontSetTabWidth

description

set tab with of a font

parameters

pointerfont handle

int32new tab with value

returns

uint32error code

ltsFontSetCharSpacing

description

set char spacing of a font

parameters

pointerfont handle

int32new char spacing value

returns

uint32error code

ltsFontSetLineSpacing

description

set line spacing of a font

parameters

pointerfont handle

floatnew line spacing value

returns

uint32error code

ltsFontDestroy

description

destroy a font handle

parameters

pointerfont handle to destroy

returns

uint32error code

Text Block

Text block objects are used to arrange text in a block: automatic line break, alignment, text color, text font, ...

ltsTextBlockGetRect

description

get text block rectangle

parameters

pointertext block handle

pointer to Rectvalue to store text block rectangle in

returns

uint32error code

ltsTextBlockGetWidth

description

get the width of a text block

parameters

pointertext block handle

pointer to int32value to write text block width to

returns

uint32error code

ltsTextBlockGetHeight

description

get the height of a text block

parameters

pointertext block handle

pointer to int32value to write text block height to

returns

uint32error code

ltsTextBlockGetFlags

description

get text block flags

parameters

pointertext block handle

pointer to int32value to write text block flags to (see TextBlockFlags constants)

returns

uint32error code

ltsTextBlockGetTop

description

get the top position of a text block

parameters

pointertext block handle

pointer to int32value to write text block top position to

returns

uint32error code

ltsTextBlockGetLeft

description

get the left position of a text block

parameters

pointertext block handle

pointer to int32value to write text block left position to

returns

uint32error code

ltsTextBlockGetVertAlign

description

get the vertical alignment of a text block

parameters

pointertext block handle

pointer to int32value to write vertical alignment to (see VertAlignment constants)

returns

uint32error code

ltsTextBlockGetHorzAlign

description

get the horizontal alignment of a text block

parameters

pointertext block handle

pointer to int32value to write horizontal alignment to (see HorzAlignment constants)

returns

uint32error code

ltsTextBlockGetClipping

description

get the clipping value of a text block

parameters

pointertext block handle

pointer to int32value to write clipping to (see TextBlockClipping constants)

returns

uint32error code

ltsTextBlockGetColor

description

get the current color of a text block

parameters

pointertext block handle

pointer to Colorvalue to write color to (see Color data type)

returns

uint32error code

ltsTextBlockGetFont

description

get the current font handle of a text block

parameters

pointertext block handle

pointer to pointervalue to write font handle to

returns

uint32error code

ltsTextBlockSetTop

description

set the top position of a text block

parameters

pointertext block handle

int32new value for top position

returns

uint32error code

ltsTextBlockSetLeft

description

set the left position of a text block

parameters

pointertext block handle

int32new value for left position

returns

uint32error code

ltsTextBlockSetVertAlign

description

set the vertical alignment of a text block

parameters

pointertext block handle

int32new value for vertical alignment (see VertAlignment constants)

returns

uint32error code

ltsTextBlockSetHorzAlign

description

set the horizontal alignment of a text block

parameters

pointertext block handle

int32new value for horizontal alignment (see HorzAlignment constants)

returns

uint32error code

ltsTextBlockSetClipping

description

set the a text block clipping

parameters

pointertext block handle

int32new value for text block clipping (see TextBlockClipping constants)

returns

uint32error code

ltsTextBlockSetColor

description

set color to render text with

parameters

pointertext block handle

int32new value for text color (see Color data type)

returns

uint32error code

ltsTextBlockSetFont

description

set font to render text with

parameters

pointertext block handle

pointerfont handle

returns

uint32error code

ltsTextBlockGetActualHeight

description

get the used size of a text block

parameters

pointertext block handle

returns

int32actual used size of the text block or -1 on error

ltsTextBlockGetTextWidthA

description

get the width of a certain text

parameters

pointertext block handle

AnsiStringstring to calculate width for

returns

int32width of the passed text or -1 on error

ltsTextBlockGetTextWidthW

description

get the width of a certain text

parameters

pointertext block handle

WideStringstring to calculate width for

returns

int32width of the passed text or -1 on error

ltsTextBlockTextOutA

description

write text to the text block using the current font and color

parameters

pointertext block handle

AnsiStringtext to write to text block

returns

uint32error code

ltsTextBlockTextOutW

description

write text to the text block using the current font and color

parameters

pointertext block handle

WideStringtext to write to text block

returns

uint32error code

ltsTextBlockDestroy

description

destroy a text block

parameters

pointertext block handle

returns

uint32error code

Image

Image objects are used to store glyph data. You can manipulate the stored data through a post processor before the glyph is rendered.

ltsImageCreate

description

create a new image

parameters

pointercontext handle

returns

pointerimage handle or NULL on error

ltsImageIsEmpty

description

check if an image is empty

parameters

pointerimage handle

pointer to booleanvalue to write result to

returns

uint32error code

ltsImageGetWidth

description

get the width of an image

parameters

pointerimage handle

returns

int32image width or -1 on error

ltsImageGetHeight

description

get the height of an image

parameters

pointerimage handle

returns

int32image height or -1 on error

ltsImageGetLineSize

description

get the data size of a single line (in bytes)

parameters

pointerimage handle

returns

int32line size or -1 on error

ltsImageGetDataSize

description

get the data size of the complete image (in bytes)

parameters

pointerimage handle

returns

int32data size or -1 on error

ltsImageGetFormat

description

get the format of an image

parameters

pointerimage handle

pointer to int32value to write image format to (see ImageFormat constants)

returns

uint32error code

ltsImageGetData

description

get a pointer to the image data

parameters

pointerimage handle

returns

pointerpointer to the image data or NULL on failure

ltsImageGetScanline

description

get a pointer to a certain image line

parameters

pointerimage handle

int32line index

returns

pointerpointer to the image line or NULL on failure

ltsImageGetPixelAt

description

get the color of a single pixel

parameters

pointerimage handle

int32x position

int32y position

pointer to Colorvalue to write color to (see Color data type)

returns

uint32error code

ltsImageAssign

description

assign the source image to another image (duplicate the image object)

parameters

pointerimage handle

pointerimage handle of source image

returns

uint32error code

ltsImageCreateEmpty

description

initialize image with a certain size and format

parameters

pointerimage handle

ImageFormatdata format of the image (see ImageFormat constants)

int32width of the image (in pixel)

int32height of the image (in pixel)

returns

uint32error code

ltsImageLoadFromFunc

description

load image data from callback function

parameters

pointerimage handle

ImageLoadFunccallback function (see ImageLoadFunc data type)

pointeruser defined arguments (will passed to callback function)

returns

uint32error code

ltsImageResize

description

change the size of an image

parameters

pointerimage handle

int32new image width

int32new image height

int32x position of the old image inside the new one

int32y position of the old image inside the new one

returns

uint32error code

ltsImageFillColor

description

fill the complete image with a color

parameters

pointerimage handle

Colorcolor to fill image with (see Color data type)

uint32flags of color channel to fill (see ColorChannels constants)

ImageModesimage mode to use for color fill (see ImageModes data type)

returns

uint32error code

ltsImageFillPattern

description

fill the complete image with a image pattern

parameters

pointerimage handle to fill with pattern

pointerpattern image handle

int32x position of pattern inside the image

int32y position of pattern inside the image

uint32flags of color channel to fill (see ColorChannels constants)

ImageModesimage mode to use (see ImageModes data type)

returns

uint32error code

ltsImageBlend

description

blend one image inside of another image

parameters

pointerhandle to destination image

pointerhandle to source image

int32x position of source image inside the destination image

int32y position of source image inside the destination image

ImageBlendFunccallback function to use for blending (see ImageBlendFunc data type)

pointeruser defined arguments (will be passed to callback function)

returns

uint32error code

ltsImageBlur

description

use blur filter on an image

parameters

pointerimage handle

floathorizontal blur radius

floathorizontal blur strength

floatvertical blur radius

floatvertical blur strength

uint32flags of color channel to blur (see ColorChannels constants)

returns

uint32error code

ltsImageDestroy

description

destroy an image

parameters

pointerimage handle

returns

uint32error code

Post Processor

Post processor objects are used to manipulate glyph data before it is rendered. You are able to add shadows, borders or something like that.

ltsPostProcessorAddRange

description

add char range to use post processor at

parameters

pointerpost processor handle

int32usage of the char range (see CharRangeUsage constants)

WideCharfirst char of the range

WideCharlast char of the range

returns

uint32error code

ltsPostProcessorAddChars

description

add chars to use post processor at

parameters

pointerpost processor handle

int32usage of the char range (see CharRangeUsage constants)

WideStringchars to use post processor at

returns

uint32error code

ltsPostProcessorClearRanges

description

clear all defined char ranges and chars

parameters

pointerpost processor handle

returns

uint32error code

ltsPostProcessorClearRanges

description

execute the post processor

parameters

pointerpost processor handle

pointerchar handle to execute post processor at

pointerimage handle to execute post processor at

returns

uint32error code

ltsPostProcessorFillColorCreate

description

creates a new post processor that will fill a char with a given color

parameters

pointercontext handle

Colorcolor to fill char with (see Color data type)

ImageModesimage modes to use (see ImageModes data type)

uint32flags of color channels to fill (see ColorChannels constants)

returns

pointerpost processor handle or NULL on failure

ltsPostProcessorFillPatterCreate

description

creates a new post processor that will fill a char with a given pattern

parameters

pointercontext handle

pointerimage handle to use as pattern

booleanTRUE: image handle is destroyed with post processor; FALSE: user must destroy image handle when finished

Positionposition to place pattern at

ImageModesimage modes to use (see ImageModes data type)

uint32flags of color channels to fill (see ColorChannels constants)

returns

pointerpost processor handle or NULL on failure

ltsPostProcessorBorderCreate

description

creates a new post processor that will create a border around a char

parameters

pointercontext handle

floatborder width

floatborder strength

Colorborder color (see Color data type)

booleanTRUE: do not change the char size; FALSE: add border to char size;

returns

pointerpost processor handle or NULL on failure

ltsPostProcessorShadowCreate

description

creates a new post processor that will create a shadow under a char

parameters

pointercontext handle

floatshadow radius

floatshadow strength

Positionshadow offset (see Position data type)

Colorshadow color (see Color data type)

returns

pointerpost processor handle or NULL on failure

ltsPostProcessorCustomCreate

description

creates a new post processor that will execute custom code

parameters

pointercontext handle

pointer to PostProcessorCustomDataall needed data for custom code (see PostProcessorCustomData data type)

returns

pointerpost processor handle or NULL on failure

ltsPostProcessorDestroy

description

destroy post processor

parameters

pointerpost processor handle

returns

uint32error code

Char

Char objects are used to store the size of a glyph. The data can be manipulated using a post processor.

ltsCharGetCharCode

description

get the char code of a char object

parameters

pointerchar handle

pointer to WideCharvalue to store char code in

returns

uint32error code

ltsCharGetGlyphMetric

description

get glyph metric of a char

parameters

pointerchar handle

pointer to GlyphMetricvalue to store glyph metric in (see GlyphMetric data type)

returns

uint32error code

ltsCharSetGlyphMetric

description

set glyph metric of a char

parameters

pointerchar handle

pointer to GlyphMetricnew glyph metric value (see GlyphMetric data type)

returns

uint32error code