Previous section.

Portable Layout Services: Context-dependent and Directional Text

Portable Layout Services:
Context-dependent and Directional Text
Copyright © 1997 The Open Group

Interface Overview

This chapter outlines the purpose of the m_*_layout() functions, which facilitate the transformation of the caller's data from one form to the other.

A set of APIs to handle these transformations is defined in Layout APIs . To perform their operations these APIs need descriptive information related to the layouts (layout values of text attributes) and the peculiarities of the characters of the text (the character classifications and mapping).

Opaque Data

The information needed to perform the transformations is encapsulated in an opaque data type called LayoutObject. All locales supported by the setlocale() function may be associated with a LayoutObject. Applications that use the LayoutObject functions must first initialise a LayoutObject.

Layout values are part of the type LayoutObject. A layout value consists of a descriptor and a data type.

The layout values are text attributes and processing indicators needed by the layout transformation functions to relate properly to the text being transformed. The layout values with the data type LayoutTextDescriptor have two values: one for input text and one for the transformed text.


The m_create_layout() function initialises a LayoutObject. When the function m_create_layout() is called the locale name is passed to it by an argument of type AttrObject. A null argument implies using the locale name of the current locale as set by setlocale().

The main m_*_layout() function is m_transform_layout(), which performs layout transformations, such as reordering and shaping, on a string of text encoded in a character encoding scheme. A similar function, m_wtransform_layout() is provided for text encoded in a wide-character encoding scheme. It also provides information to the application so that it can perform editing, shaping and character composition operations as required.

Other functions associated with the LayoutObject type are:

Descriptors and Data Types

Standard Layout Values lists the standard layout values used by the m_*_layout() functions associated with a type LayoutObject. Each layout value is specified in terms of its descriptor, data type and whether it may be set (S) or got (G) using m_setvalues_layout() or m_getvalues_layout() respectively. For some particular national languages or regional groups and for specific implementations, additional layout values, beyond those listed here, may be added.

Defaults have been assigned to the layout values for the C locale, because these locales (in the C library) are the only locales with a consistent behaviour across implementations.

Descriptor Type SG
Orientation LayoutTextDescriptor SG
Context LayoutTextDescriptor SG
TypeOfText LayoutTextDescriptor SG
ImplicitAlg LayoutTextDescriptor SG
Swapping LayoutTextDescriptor SG
Numerals LayoutTextDescriptor SG
TextShaping LayoutTextDescriptor SG
ActiveDirectional BooleanValue G
ActiveShapeEditing BooleanValue G
ShapeCharset char * SG
ShapeCharsetSize int G
ShapeContextSize LayoutEditSize G
InOutTextDescrMask unsigned long SG
InOnlyTextDescr unsigned long SG
OutOnlyTextDescr unsigned long SG
CheckMode LayoutDesc SG
QueryValueSize int G

Table: Standard Layout Values

Header File <sys/layout.h> includes descriptions of the layout values needed by the transformation functions, and the special data structures and types used.

Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index