docu.md 89 KB

Content

  1. Content
  2. General
  3. Data Types
    1. Simple
    2. Enumerations
    3. Flags
    4. Structures
    5. Callbacks
  4. Constants
  5. Functions
    1. General
    2. Context
    3. Renderer
    4. Font Creator
    5. Font
    6. Text Block
    7. Image
    8. Post Processor
    9. Char

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!
  • All enumerations are 32bit values!

Data Types

Simple

Type Description
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
Vector4f array with 4 elements of float
Matrix4f array with 4 elements of Vector4f
Handle pointer
ContextHandle pointer
RendererHandle pointer
RenderRefHandle pointer
TextBlockHandle pointer
FontCreatorHandle pointer
FontHandle pointer
PostProcessorHandle pointer
ImageHandle pointer
CharHandle pointer
ImageModes array with 4 elements of ImageMode

Pointers to a type are defined as follows: uint16* or WideChar*

Enumerations

All enumerations are 32bit values!

ErrorCode

Name Value
ErrUnknown -1
ErrNone 0
ErrNotInitialized 1
ErrInvalidEnum 2
ErrInvalidValue 3
ErrInvalidOperation 4
ErrInvalidType 5
ErrInvalidContextHandle 100
ErrInvalidRendererHandle 101
ErrInvalidTextBlockHandle 102
ErrInvalidFontHandle 103
ErrInvalidFontCreatorHandle 104
ErrInvalidImageHandle 105
ErrInvalidPostProcHandle 106

CodePage

Name Value
UTF8 0
ISO_8859_1 1
ISO_8859_2 2
ISO_8859_3 3
ISO_8859_4 4
ISO_8859_5 5
ISO_8859_6 6
ISO_8859_7 7
ISO_8859_8 8
ISO_8859_9 9
ISO_8859_10 10
ISO_8859_11 11
ISO_8859_13 12
ISO_8859_14 13
ISO_8859_15 14
ISO_8859_16 15
ISO_037 16
ISO_437 17
ISO_500 18
ISO_737 19
ISO_775 20
ISO_850 21
ISO_852 22
ISO_855 23
ISO_857 24
ISO_860 25
ISO_861 26
ISO_862 27
ISO_863 28
ISO_864 29
ISO_865 30
ISO_866 31
ISO_869 32
ISO_874 33
ISO_875 34
ISO_1026 35
ISO_1250 36
ISO_1251 37
ISO_1252 38
ISO_1253 39
ISO_1254 40
ISO_1255 41
ISO_1256 42
ISO_1257 43
ISO_1258 44

ObjectType

Name Value
ObjTypeUnknown 0
ObjTypeContext 1
ObjTypeRenderer 2
ObjTypeFontCreator 3
ObjTypeFont 4
ObjTypeTextBlock 5
ObjTypeImage 6
ObjTypePostProcessor 7
ObjTypeChar 8

Format

Name Value
FormatEmpty 0
FormatRGBA8 1
FormatLumAlpha8 2
FormatAlpha8 3
FormatLum8 4

RendererType

Name Value
RendererUnknown 0
RendererOpenGL 1
RendererOpenGLES 2

FontCreatorType

Name Value
FontCreatorUnknown 0
FontCreatorFreeType 1
FontCreatorGDI 2
FontCreatorCustom 3

VerticalAlign

Name Value
VertAlignTop 0
VertAlignCenter 1
VertAlignBottom 2

HorizontalAlign

Name Value
HorzAlignLeft 0
HorzAlignCenter 1
HorzAlignRight 2
HorzAlignJustify 3

Clipping

Name Value
ClipNone 0
ClipWordBorder 1
ClipCharBorder 2
ClipWordComplete 3
ClipCharComplete 4

AntiAliasing

Name Value
None 0
Normal 1

RangeUsage

Name Value
UsageInclude 0
UsageExclude 1

StreamOrigin

Name Value
StreamOriginBegin 0
StreamOriginCurrent 1
StreamOriginEnd 2

ImageMode

Name Value
ModeIgnore 0
ModeReplace 1
ModeModulate 2

Flags

TextBlockFlag

Name Bit
BlockFlagWordWrap 0

FontStyle

Name Bit
FontStyleBold 0
FontStyleItalic 1
FontStyleUnderline 2
FontStyleStrikeout 3

ColorChannels

Name Bit
ColorChannelRed 0
ColorChannelGreen 1
ColorChannelBlue 2
ColorChannelAlpha 3

Structures

Position

Value Type
X int32
Y int32

Rect

Value Type
TopLeft Position
BottomRight Position

OR

Value Type
Left int32
Top int32
Right int32
Bottom int32

Color

Value Type
R float
G float
B float
A float

GlyphMetric

Value Type
GlyphOrigin Position
GlyphRect Rect
Advance int32

TextMetric

Value Type
Ascent int32
Descent int32
ExternalLeading int32
BaseLineOffset int32
CharSpacing int32
LineHeight int32
LineSpacing int32

FontMetric

Value Type
Size int32
Style FontStyle
AntiAliasing AntiAliasing
DefaultChar WideChar
__reserved uint16
Ascent int32
Descent int32
ExternalLeading int32
BaseLineOffset int32
UnderlinePos int32
UnderlineSize int32
StrikeoutPos int32
StrikeoutSize int32

StreamData

Value Type
StreamRead StreamReadCallback
StreamSeek StreamSeekCallback

CustomPostProcessorData

Value Type
UserArgs pointer
Execute PostProcessorExecuteCallback

CustomRendererData

Value Type
UserArgs pointer
BeginRender RendererBeginRenderCallback
EndRender RendererEndRenderCallback
GetDrawPos RendererGetDrawPosCallback
SetDrawPos RendererSetDrawPosCallback
MoveDrawPos RendererMoveDrawPosCallback
SetColor RendererSetColorCallback
Render RendererRenderCallback
CreateRef RendererCreateRefCallback
FreeRef RendererFreeRefCallback

Callbacks

All callbacks use the stdcall calling convention!

StreamReadCallback

Read data from stream.

Name Type Description
Parameters UserArgs pointer user arguments
Buffer pointer buffer to store read data in
Size int32 number of bytes stored in buffer
Returns int32 number of read bytes

StreamSeekCallback

Seek position in stream.

Name Type Description
Parameters UserArgs pointer user arguments
Origin StreamOrigin origin to apply offset at
Offset int32 number of bytes to move
Returns int32 stream position after seek

PostProcessorExecuteCallback

Execute the post processor.

Name Type Description
Parameters CharHandle CharHandle Handle of char to apply post processor at
ImageHandle ImageHandle Handle of image to apply post processor at

RendererBeginRenderCallback

Begin rendering.

Name Type Description
Parameters UserArgs pointer User defined arguments

RendererEndRenderCallback

End rendering.

Name Type Description
Parameters UserArgs pointer User defined arguments

RendererGetDrawPosCallback

Get the current draw position.

Name Type Description
Parameters UserArgs pointer User defined arguments
Returns Position Current draw position

RendererSetDrawPosCallback

Set the current draw position.

Name Type Description
Parameters Position Position New draw positionments
UserArgs pointer User defined arguments

RendererMoveDrawPosCallback

Move the draw position relative to the current position.

Name Type Description
Parameters Offset Position Offset to current position
UserArgs pointer User defined arguments

RendererSetColorCallback

Set the current color.

Name Type Description
Parameters Color Color New color
UserArgs pointer User defined arguments

RendererRenderCallback

Render the given reference. If ForcedWidth is not eqal zero, then render the reference with the given width. This is used for rendereing spaces when the text block uses justify as horizontal alignment.

Name Type Description
Parameters Reference RenderRefHandle Handle of reference to render
ForcedWidth int32 Forced width of rendered reference. Use default width if zero.
UserArgs pointer User defined arguments

RendererCreateRefCallback

Create a new render reference for the given char and image.

Name Type Description
Parameters CharHandle CharHandle Handle of char to create reference for
ImageHandle ImageHandle Handle of image to create reference for
UserArgs pointer User defined arguments
Returns RenderRefHandle Current draw position

RendererFreeRefCallback

Destroy the given render reference.

Name Type Description
Parameters RenderRef RenderRefHandle Handle of render reference to destroy
UserArgs pointer User defined arguments

ImageLoadCallback

Fill the given image pixel with a color.

Name Type Description
Parameters Image ImageHandle Handle of image to fill with data
x int32 Horizontal pixel position
y int32 Vertical pixel position
Pixel Color New color of pixel at (x,y)
UserArgs pointer User defined arguments

ImageBlendCallback

Merge the to given colors to a new color.

Name Type Description
Parameters Image ImageHandle Handle of image to merge to
Source Color Color of soure image
Dest Color Color of destination image
Result Color New color of destination image
UserArgs pointer User defined arguments

Constants

ImageModes

ImageModesReplaceAll

Index Value
0 ModeReplace
1 ModeReplace
2 ModeReplace
3 ModeReplace

ImageModesModulateAlpha

Index Value
0 ModeReplace
1 ModeReplace
2 ModeReplace
3 ModeModulate

ImageModesModulateAll

Index Value
0 ModeModulate
1 ModeModulate
2 ModeModulate
3 ModeModulate

ColorChannels

ColorChannelsRGB

Bit Is set?
ColorChannelRed yes
ColorChannelGreen yes
ColorChannelBlue yes
ColorChannelAlpha no

ColorChannelsRGBA

Bit Is set?
ColorChannelRed yes
ColorChannelGreen yes
ColorChannelBlue yes
ColorChannelAlpha yes

Functions

All callbacks use the stdcall calling convention!

General

Function that are used to initialize or control the library.

ltsInitialize

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

Name Type Description
Returns ErrorCode Error code

ltsGetVersion

Get the version of the library as string.

Name Type Description
Returns AnsiString Version of the library as string.

ltsGetLastErrorCode

Get the last error code that was raised.

Name Type Description
Returns ErrorCode Error code of last failed action.

ltsGetLastErrorMsg

Get the last error message as string.

Name Type Description
Returns AnsiString Last error message as string

ltsFinalize

Cleans up internal library variables. Should be called once before program exits!

Name Type Description
Returns ErrorCode Error code

Context

The context is a wrapper object that owns all created objects. When you delete the context, all assigned objects will destroyed too. You should create only one context in your application.

ltsContextCreate

Create a new context object.

Name Type Description
Returns ContextHandle Handle of created context or NULL on failure (check ltsGetLastErrorCode for details).

ltsContextGetCodePage

Get the current code page.

Name Type Description
Parameters Context ContextHandle Handle of the context to get the code page for.
Value CodePage* Current code page
Returns ErrorCode Error code

ltsContextGetDefaultChar

Get the default char of a context. The default char is used when ever a char could not be displayed correctly. The default value is '?'.

Name Type Description
Parameters Context ContextHandle Handle of the context to get the default char for
Value WideChar* Current default char
Returns ErrorCode Error code

ltsContextSetCodePage

Set the code page of a context.

Name Type Description
Parameters Context ContextHandle Handle of context to set the code page for
Value CodePage New code page
Returns ErrorCode Error code

ltsContextSetDefaultChar

Set the default char of a context.

Name Type Description
Parameters Context ContextHandle Handle of context to set default char for
Value WideChar New default char
Returns ErrorCode Error code

ltsContextAnsiToWide

Convert a AnsiString to a WideString using the contexts code page and default char.

Name Type Description
Parameters Context ContextHandle Handle of context to use for convertion
Text AnsiString Text to convert to WideString
Returns WideString Converted string or NULL on Error (Check ltsGetLastErrorCode for details)

ltsContextDestroy

Destroy a context object.

Name Type Description
Parameters Context ContextHandle Handle of context to destroy
Returns ErrorCode Error 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

Create a new renderer.

Name Type Description
Parameters Context ContextHandle Handle of context to create renderer for
Type RendererType Type of renderer to create
Format Format Format to use for renderer
Returns RendererHandle Handle of created renderer or NULL in failure (check ltsGetLastErrorCode for details)

ltsRendererCustomCreate

Create a custom renderer.

Name Type Description
Parameters Context ContextHandle Handle of context to create renderer for
Format Format Format of the renderer
Data CustomRendererData Needed data for the custom render context
Returns RendererHandle Handle of the created renderer or NULL in failure (Check ltsGetLastErrorCode for details)

ltsRendererBeginBlock

Begin a new text block.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer to create text block for
Top int32 Horizontal position of the text block
Left int32 Vertical position of the text block
Width int32 Width of the text block
Height int32 Height of the text block
Flags TextBlockFlags Text block flags
Returns TextBlockHandle Handle of the created text bolc or NULL on failure (Check ltsGetLastErrorCode for details)

ltsRendererEndBlock

Close text block and render it's content. The text block object will be destroyed.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer
TextBlock TextBlockHandle Handle of text block to close
Returns ErrorCode Error code

ltsRendererAbortBlock

Close text block and do not render it's content. The text block object will be destroyed.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer
TextBlock TextBlockHandle Handle of text block to close
Returns ErrorCode Error code

ltsRendererGetTextWidthA

Get width of a given text.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer
Font FontHandle Handle of font to use for the text
Text AnsiString Text to get width for
Returns int32 Width of text of -1 on failure (Check ltsGetLastErrorCode for details)

ltsRendererGetTextWidthW

Get width of a given text.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer
Font FontHandle Handle of font to use for the text
Text WideString Text to get width for
Returns int32 Width of text of -1 on failure (Check ltsGetLastErrorCode for details)

ltsRendererDestroy

Destroy a renderer object.

Name Type Description
Parameters Renderer RendererHandle Handle of renderer to destroy.
Returns ErrorCode Error code

Font Creator

Font creators are objects that are used 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

Create a new font creator object.

Name Type Description
Parameters Context ContextHandle Handle of context to create font creator for
Type FontCreatorType Type of font creator to create
Returns FontCreatorHandle Handle of created font creator or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontCreatorGetFontByName

Load a font by its name.

Name Type Description
Parameters FontCreator FontCreatorHandle Handle of font creator to create font with
Fontname AnsiString Name of the font to create
Size int32 Size of the font to create
Style FontStyle Style of the font to create
AnsiAliasing AntiAliasing Anti aliasing of the font to create
Returns FontHandle Handle of created font or NULL on failue (Check ltsGetLastErrorCode for details)

ltsFontCreatorGetFontByFile

Load a font from a file.

Name Type Description
Parameters FontCreator FontCreatorHandle Handle of font creator to create font with
Filename AnsiString Filename to load font from
Size int32 Size of the font to create
Style FontStyle Style of the font to create
AnsiAliasing AntiAliasing Anti aliasing of the font to create
Returns FontHandle Handle of created font or NULL on failue (Check ltsGetLastErrorCode for details)

ltsFontCreatorGetFontByStream

Load a font from a stream.

Name Type Description
Parameters FontCreator FontCreatorHandle Handle of font creator to create font with
Stream StreamData* libTextSuite stream interface
Size int32 Size of the font to create
Style FontStyle Style of the font to create
AnsiAliasing AntiAliasing Anti aliasing of the font to create
Returns FontHandle Handle of created font or NULL on failue (Check ltsGetLastErrorCode for details)

ltsFontCreatorDestroy

Destroy a font creator object.

Name Type Description
Parameters FontCreator FontCreatorHandle Handle of font creator to destroy
Returns ErrorCode Error code

Font

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

ltsFontGetPostProcessor

Get the current post processor object assigned to a font.

Name Type Description
Parameters Font FontHandle Handle of font to get the post processor for
Returns PostProcessorHandle Handle of post processor assigned to this font.

ltsFontGetTabWidth

Get the current tab width of a font.

Name Type Description
Parameters Font FontHandle Handle of font to get tab width for
Value int32* Tab width of font
Returns ErrorCode Error code

ltsFontGetCharSpacing

Get the current char spacing of a font.

Name Type Description
Parameters Font FontHandle Handle of font to get char spacing for
Value int32* Char spacing of the font
Returns ErrorCode Error code

ltsFontGetLineSpacing

Get the current line spacing of a font.

Name Type Description
Parameters Font FontHandle Handle of font to get line spacing for
Value int32* Line spacing of the font
Returns ErrorCode Error code

ltsFontGetMetric

Get the metric of a font.

Name Type Description
Parameters Font FontHandle Handle of font to get metric for
Value FontMetric* Metric of the font
Returns ErrorCode Error code

ltsFontGetFontname

Get the name of a font

Name Type Description
Parameters Font FontHandle Handle of font to get the name for
Returns AnsiString Font name or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontGetFacename

Get the face name of a font

Name Type Description
Parameters Font FontHandle Handle of font to get the face name for
Returns AnsiString Face name or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontGetStylename

Get the style name of a font

Name Type Description
Parameters Font FontHandle Handle of font to get the style name for
Returns AnsiString Style name or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontGetFullname

Get the full name of a font

Name Type Description
Parameters Font FontHandle Handle of font to get the full name for
Returns AnsiString Full name or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontGetCopyright

Get the copyright of a font

Name Type Description
Parameters Font FontHandle Handle of font to get the copyright for
Returns AnsiString Copyright or NULL on failure (Check ltsGetLastErrorCode for details)

ltsFontSetPostProcessor

Set the post processor of a font

Name Type Description
Parameters Font FontHandle Handle of font to set the post processor for
PostProcessor PostProcessorHandle Handle of post processor to assign to the font
Returns ErrorCode Error code

ltsFontSetTabWidth

Set the tab width of a font

Name Type Description
Parameters Font FontHandle Handle of font to set the tab width for
Value int32* New tab width of the font
Returns ErrorCode Error code

ltsFontSetCharSpacing

Set the char spacing of a font

Name Type Description
Parameters Font FontHandle Handle of font to set the char spacing for
Value int32* New char spacing of the font
Returns ErrorCode Error code

ltsFontSetLineSpacing

Set the line spacing of a font

Name Type Description
Parameters Font FontHandle Handle of font to set the line spacing for
Value int32* New line spacing of the font
Returns ErrorCode Error code

ltsFontDestroy

Destroy a font object

Name Type Description
Parameters Font FontHandle Handle of font to destroy
Returns ErrorCode Error code

Text Block

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

ltsTextBlockGetRect

Get the rect of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the rect for
Value Rect* Rect of the text block
Returns ErrorCode Error code

ltsTextBlockGetWidth

Get the width of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the width for
Value int32* Width of the text block
Returns ErrorCode Error code

ltsTextBlockGetHeight

Get the height of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the height for
Value int32* Height of the text block
Returns ErrorCode Error code

ltsTextBlockGetFlags

Get the flags of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the flags for
Value TextBlockFlags* Flags of the text block
Returns ErrorCode Error code

ltsTextBlockGetTop

Get the vertical position of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get vertical position for
Value int32* Vertical position of the text block
Returns ErrorCode Error code

ltsTextBlockGetLeft

Get the horizontal position of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get horizontal position for
Value int32* Horizontal position of the text block
Returns ErrorCode Error code

ltsTextBlockGetVertAlign

Get the vertical alignment of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get vertical alignment for
Value VerticalAlign* Vertical alignment of the text block
Returns ErrorCode Error code

ltsTextBlockGetHorzAlign

Get the horizontal alignment of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get horizontal alignment for
Value HorizontalAlign* Horizontal alignment of the text block
Returns ErrorCode Error code

ltsTextBlockGetClipping

Get the clipping of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the clipping for
Value Clipping* Clipping of the text block
Returns ErrorCode Error code

ltsTextBlockGetColor

Get the current color of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the color for
Value Color* Current color of the text block
Returns ErrorCode Error code

ltsTextBlockGetFont

Get the current font of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the font for
Value FontHandle* Current font of the text block
Returns ErrorCode Error code

ltsTextBlockSetTop

Set the vertical position of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the vertical position for
Value int32 New vertical position
Returns ErrorCode Error code

ltsTextBlockSetLeft

Set the horizontal position of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the horizontal position for
Value int32 New horizontal position
Returns ErrorCode Error code

ltsTextBlockSetVertAlign

Set the vertical alignment of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the vertical alignment for
Value VerticalAlign New vertical alignment
Returns ErrorCode Error code

ltsTextBlockSetHorzAlign

Set the horizontal alignment of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the horizontal alignment for
Value HorizontalAlign New horizontal alignment
Returns ErrorCode Error code

ltsTextBlockSetClipping

Set the clipping of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the clipping for
Value Clipping New clipping
Returns ErrorCode Error code

ltsTextBlockSetColor

Set the color of a text block. This will not affect already written Text!

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the color for
Value Color New color
Returns ErrorCode Error code

ltsTextBlockSetFont

Set the font of a text block. This will not affect already written text!

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to set the font for
Value FontHandle New font
Returns ErrorCode Error code

ltsTextBlockGetActualHeight

Get the actual used height of a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the actual height for
Returns int32 Actual height of the text block or -1 on failure (Chec ltsGetLastErrorCode for more details)

ltsTextBlockGetTextWidthA

Get the width of a text.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the text width for
Text AnsiText Text to get the width for
Returns int32 Text width or -1 on failure (Chec ltsGetLastErrorCode for more details)

ltsTextBlockGetTextWidthW

Get the width of a text.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the text width for
Text WideText Text to get the width for
Returns int32 Text width or -1 on failure (Chec ltsGetLastErrorCode for more details)

ltsTextBlockTextOutA

Write text to the text block. This will use the current color and the current font of the text block. A change of the color or the font will not take effect on already written text.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the text width for
Text AnsiText Text to get the width for
Returns ErrorCode Error code

ltsTextBlockTextOutW

Write text to the text block. This will use the current color and the current font of the text block. A change of the color or the font will not take effect on already written text.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to get the text width for
Text WideText Text to get the width for
Returns ErrorCode Error code

ltsTextBlockDestroy

Destroy a text block.

Name Type Description
Parameters TextBlock TextBlockHandle Handle of text block to destroy
Returns ErrorCode Error 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

Create a new image object.

Name Type Description
Parameters Context ContextHandle Handle of context to create the image for
Returns ImageHandle Handle of created image or NULL on failure (Check ltsGetLastErrorCode for details)

ltsImageIsEmpty

Check is an image is empty.

Name Type Description
Parameters Image ImageHandle Handle of image to check
Value boolean TRUE if the image is empty, FALSE otherwise
Returns ErrorCode Error code

ltsImageGetWidth

Get the width of an image.

Name Type Description
Parameters Image ImageHandle Handle of image to get width for
Returns int32 Width of image or -1 on failure (Check ltsGetLastErrorCode for details)

ltsImageGetHeight

Get the height of an image.

Name Type Description
Parameters Image ImageHandle Handle of image to get height for
Returns int32 Height of image or -1 on failure (Check ltsGetLastErrorCode for details)

ltsImageGetLineSize

Get the number of bytes used in each line of an image.

Name Type Description
Parameters Image ImageHandle Handle of image to get line size for
Returns int32 Line size of image or -1 on failure (Check ltsGetLastErrorCode for details)

ltsImageGetDataSize

Get the number of bytes used to store the images data.

Name Type Description
Parameters Image ImageHandle Handle of image to get data size for
Returns int32 Data size of image or -1 on failure (Check ltsGetLastErrorCode for details)

ltsImageGetFormat

Get the format of an image.

Name Type Description
Parameters Image ImageHandle Handle of image to get the format for
Format Format* Format of the image
Returns ErrorCode Error code

ltsImageGetData

Get the raw data of an image.

Name Type Description
Parameters Image ImageHandle Handle of image to get the data for
Returns pointer Pointer to image data or NULL on failure (Check ltsGetLastErrorCode for more details)

ltsImageGetScanline

Get the raw data of a line inside of the image.

Name Type Description
Parameters Image ImageHandle Handle of image to get the scanline for
Index int32 Index of the scanline
Returns pointer Pointer to scanline data or NULL on failure (Check ltsGetLastErrorCode for more details)

ltsImageGetPixelAt

Get the color of a pixel inside the image.

Name Type Description
Parameters Image ImageHandle Handle of image to get pixel color for
X int32 Horizontal pixel position
Y int32 Vertical pixel position
Color Color* Pixel color
Returns ErrorCode Error code

ltsImageAssign

Copy one image to another.

Name Type Description
Parameters Image ImageHandle Handle of image to assign Source to
Source ImageHandle Handle of image to copy to Image
Color Color* Pixel color
Returns ErrorCode Error code

ltsImageCreateEmpty

Clear image.

Name Type Description
Parameters Image ImageHandle Handle of image to clear
Format Format Format of image data
Width int32 Width of image
Height int32 Height of image
Returns ErrorCode Error code

ltsImageLoadFromFunc

Load image data using a callback function.

Name Type Description
Parameters Image ImageHandle Handle of image to load data for
Callback ImageLoadCallback Callback to load image data
UserArgs pointer User defined arguments the will passed to the callback
Returns ErrorCode Error code

ltsImageResize

Resize an image.

Name Type Description
Parameters Image ImageHandle Handle of image to resize
Width int32 New width of the image
Height int32 New height of the image
X int32 Horizontal position of the old image inside the new one
Y int32 Vertical position of the old image inside the new one
Returns ErrorCode Error code

ltsImageFillColor

Fill image with given color.

Name Type Description
Parameters Image ImageHandle Handle of image to fill with color
Color Color Color to fill image with
Mask ColorChannels Color channels the action will take effect on
Modes ImageModes Modes how the action will take effect on
Returns ErrorCode Error code

ltsImageFillPattern

Fill image with given pattern.

Name Type Description
Parameters Image ImageHandle Handle of image to fill with pattern
Pattern ImageHandle Handle of image to use as pattern
X int32 Horizontal position the pattern will be placed at
Y int32 Vertical position the pattern will be placed at
Mask ColorChannels Color channels the action will take effect on
Modes ImageModes Modes how the action will take effect on
Returns ErrorCode Error code

ltsImageBlend

Blend an image into another image.

Name Type Description
Parameters Image ImageHandle Handle of image to blend other image in
Source ImageHandle Handle of image to blend into Image
X int32 Horizontal position the source image will be placed at
Y int32 Vertical position the source image will be placed at
BlendFunc ImageBlendCallback Callback to handle blending
UserArgs pointer User defined argument that will be passed to callback
Returns ErrorCode Error code

ltsImageBlur

Blur an image.

Name Type Description
Parameters Image ImageHandle Handle of image to blur
HorzRadius float Horizontal blur radius
HorzStrength float Horizontal blur strength
VertRadius float Vertical blur radius
VertStrength float Vertical blur strength
Mask ColorChannels Color channels this action will take effect on
Returns ErrorCode Error code

ltsImageDestroy

Destroy an image object.

Name Type Description
Parameters Image ImageHandle Handle of image to destroy
Returns ErrorCode Error 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.

ltsPostProcessorFillColorCreate

Create a fill color post processor

Name Type Description
Parameters Context ContextHandle Handle of context to create post processor for
Color Color Color to use for fill
Modes ImageModes Modes how the action will take effect on
Channels ColorChannels Color channels the action will take effect on
Returns PostProcessorHandle Handle of created post processor or NULL on failure (Check ltsGetLastErrorCode for more detail)

ltsPostProcessorFillPatternCreate

Create a fill pattern post processor

Name Type Description
Parameters Context ContextHandle Handle of context to create post processor for
Pattern ImageHandle Handle to image to use as pattern
OwnsPattern boolean TRUE: Pattern image will be destroyed with post processor; FALSE: Pattern image will not be destroyed
Position Position Position the pattern will be placed
Modes ImageModes Modes how the action will take effect on
Channels ColorChannels Color channels the action will take effect on
Returns PostProcessorHandle Handle of created post processor or NULL on failure (Check ltsGetLastErrorCode for more detail)

ltsPostProcessorBorderCreate

Create a border post processor

Name Type Description
Parameters Context ContextHandle Handle of context to create post processor for
Width float Width of the created border
Strength float Strength of the created border
Color Color Color of the created border
KeepSize boolean TRUE: do not resize the glyph image; FALSE: resize the glyph image
Returns PostProcessorHandle Handle of created post processor or NULL on failure (Check ltsGetLastErrorCode for more detail)

ltsPostProcessorShadowCreate

Create a shadow post processor

Name Type Description
Parameters Context ContextHandle Handle of context to create post processor for
Width float Width of the created shadow
Strength float Strength of the created shadow
Offset Position Offset of the created shadow
Color Color Color of the created shadow
Returns PostProcessorHandle Handle of created post processor or NULL on failure (Check ltsGetLastErrorCode for more detail)

ltsPostProcessorCustomCreate

Create a custom post processor

Name Type Description
Parameters Context ContextHandle Handle of context to create post processor for
Data CustomPostProcessorData* libTextSuite custom post processor interface
Returns PostProcessorHandle Handle of created post processor or NULL on failure (Check ltsGetLastErrorCode for more detail)

ltsPostProcessorAddRange

Add range of characters the post processor will take effect on.

Name Type Description
Parameters PostProcessor PostProcessorHandle Handle of post processor to add char range to
Usage RangeUsage Usage of the passed char range
Start WideChar First char of range
Stop WideChar Last char of range
Returns ErrorCode Error code

ltsPostProcessorAddChars

Add characters the post processor will take effect on.

Name Type Description
Parameters PostProcessor PostProcessorHandle Handle of post processor to add chars to
Usage RangeUsage Usage of the passed char range
Chars WideString Characters to add
Returns ErrorCode Error code

ltsPostProcessorClearRanges

Clear all character defines of a post processor.

Name Type Description
Parameters PostProcessor PostProcessorHandle Handle of post processor to clear
Returns ErrorCode Error code

ltsPostProcessorExecute

Execute the post processor.

Name Type Description
Parameters PostProcessor PostProcessorHandle Handle of post processor to execute
Char CharHandle Handle of char to execute the post processor on
Image ImageHandle Handle of image to execute the post processor on
Returns ErrorCode Error code

ltsPostProcessorDestroy

Destroy a post processor object.

Name Type Description
Parameters PostProcessor PostProcessorHandle Handle of post processor to destroy
Returns ErrorCode Error code

Char

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

ltsCharGetCharCode

Get the char code the char object is assigned to.

Name Type Description
Parameters Char CharHandle Handle to char to get char code for
Value WideChar* Char code of the char object is assigned to
Returns ErrorCode Error code

ltsCharGetGlyphMetric

Get the glyph metric of a char.

Name Type Description
Parameters Char CharHandle Handle to char to get glyph metric for
Value GlyphMetric* Glyph metric of the char object
Returns ErrorCode Error code

ltsCharSetGlyphMetric

Set the glyph metric of a char.

Name Type Description
Parameters Char CharHandle Handle to char to get glyph metric for
Value GlyphMetric* New glyph metric
Returns ErrorCode Error code