The following layout values are associated with a layout object when the locale used with LayoutObjectCreate is Locale_Arabic or Locale_Hebrew.
Value Name Value Type Set/Get ___________ ___________ _____ ActiveBidirection BOOL G ActiveShapeEditing BOOL G ShapeContextSize LAYOUT_EDIT_SIZE G Cellsize ULONG SG InputMode BOOL SG CallerAllocMem BOOL SG QueryValueSize ULONG SG InOutTextDescrMask ULONG SG InOnlyTextDescr ULONG SG OutOnlyTextDescr ULONG SG Orientation LAYOUT_TEXT_DESCRIPTOR SG TypeOfText LAYOUT_TEXT_DESCRIPTOR SG Swapping LAYOUT_TEXT_DESCRIPTOR SG Numerals LAYOUT_TEXT_DESCRIPTOR SG TextShaping LAYOUT_TEXT_DESCRIPTOR SG WordBreak LAYOUT_TEXT_DESCRIPTOR SG
ActiveBidirection (BOOL)
If ActiveBidirection is set to True then the layout object includes knowledge of directional code elements and proper rendering of text will require reordering of directional code elements. Otherwise the layout object does not require any reordering of directional code elements and all code elements will be classified as left_to_right.
The ActiveBidirection value is guaranteed not to change for the life of the layout object.
For Locale_Arabic and Locale_Hebrew, ActiveBidirection is always True.
If ActiveShapeEditing is set to True, then the layout object includes knowledge of context dependent code elements (i.e. an Automatic Shape Determination algorithm) that requires shaping for presentation. If True, the user of a layout object is required to perform some transformation and/or edit shaping prior to rendering the text.
Otherwise, the layout object does no shaping and all code elements may be presented independent of the surrounding characters.
The ActiveShapeEditing value is guaranteed not to change for the life of the layout object.
For Locale_Arabic, ActiveShapeEditing is always True.
For Locale_Hebrew, ActiveShapeEditing is always False.
The ShapeContextSize specifies the size of the context (surrounding code elements) that needs to be accounted for when performing ActiveShapeEditing. The ShapeContextSize is defined as a structure of type LAYOUT_EDIT_SIZE, which defines the number of surrounding code elements that need to be considered when performing edit shaping, i.e., calling the LayoutEditShape function.
When a substring is inserted into a string, the front and back elements define the number of code elements after the substring and the number of code elements before the substring, respectively, that need to be considered when performing edit shaping.
If both front and back elements are set to zero, then no additional context needs to be considered for edit shaping. When ActiveShapeEditing is not set (False), the front and back are guaranteed to be zero (0).
The ShapeContextSize value is guaranteed not to change for the life of the layout object.
For Locale_Arabic, ShapeContextSize.front = ShapeContextSize.back = 3.
For Locale_Hebrew, ShapeContextSize is not relevant.
The size of each character cell (is > 1 when each character is followed by one or more attributes; 'CellSize' is 1 when characters occupy consecutive positions in memory).
The default value of CellSize is 1.
This value defines whether the implicit algorithm should produce text in its final form (InputMode=FALSE), or if the text should be considered incomplete, as if it is still being input from the keyboard (InputMode=TRUE).
The default value of InputMode is FALSE.
The following values are related to the memory allocation convention used when calling LayoutQueryValues.
CallerAllocMem (BOOL)
If the descriptor CallerAllocMem is set to TRUE, when calling LayoutQueryValues function, it is the responsibility of the caller to allocate storage to store the actual data and freeing this data.
If the descriptor CallerAllocMem is set to FALSE, then LayoutQueryValues allocates storage to store the actual data and the caller is responsible for freeing this data.
For example, if the value of the Orientation text descriptor is being queried, LayoutQueryValues will allocate the memory for the LAYOUT_TEXT_DESCRIPTOR structure and the caller must free the pointer returned using DosFreeMem.
The default value for CallerAllocMem is FALSE;
This name is used to query the size of any of the layout values by ORing it with the name of the layout value. In this case the value field will be a pointer to allocation where the size of the layout value will be stored.
Currently, all structures used in OS/2 are of known size, so applications will not need to use this option.
The remaining layout values are all related to describing the format of the input and output buffers. These values define the behaviour of the LayoutTransformText APIs. Two functionally equivalent methods are provided for setting these attributes/descriptors.
InOutTextDescrMask, InOnlyTextDescr and OutOnlyTextDescr
These are three values that allow the caller to use the same bidi attribute masks and bidi attributes that are used in the WinSetLangInfo APIs.
InOutTextDescrMask (ULONG)
This is a bit value that is used to mask the InOnlyTextDescr and OutOnlyTextDescr values. Only the bits that are set in InOutTextDescrMask are enabled for Set/Query of the InOnlyTextDescr and OutOnlyTextDescr values.
InOnlyTextDescr can have one or more of the following values:
This is the data that is to be used (masked using the InOutTextDescrMask value) to describe the format of the input text.
Possible values are:
BDA_TEXTTYPE_IMPLICIT | BDA_TEXT_ORIENT_LTR | BDA_NUMERALS_NOMINAL |BDA_SYM_SWAP_OFF | BDA_WORDBREAK_OFF | BDA_TEXT_NOMINAL
For Locale_Hebrew, the default value of InOnlyTextDescr is :
BDA_TEXTTYPE_IMPLICIT | BDA_TEXT_ORIENT_CONTEXT | BDA_NUMERALS_NOMINAL | BDA_SYM_SWAP_OFF | BDA_WORDBREAK_OFF | BDA_TEXT_SAVE_SHAPED
This is the data that is to be used (masked using the InOutTextDescrMask value) to describe the format of the output text.
Possible values are the same as for InOnlyTextDescr described above.
For Locale_Arabic and Locale_Hebrew, the default value of OutOnlyTextDescr is :
BDA_TEXTTYPE_VISUAL | BDA_TEXT_ORIENT_LTR | BDA_NUMERALS_NOMINAL | BDA_SYM_SWAP_OFF | BDA_WORDBREAK_OFF | BDA_TEXT_DISPLAY_SHAPED
The following code fragment shows how an application would set the orientation and type of text using this method:
LAYOUT_VALUES layout[4];ULONG ulMask,ulInAttr,ulOutAttr; . . . /* Set mask */ ulData = BDAM_TEXTTYPE | BDAM_TEXT_ORIENTATION; layout[0].name = InOutTextDescrMask; layout[0].value = &ulData; /* Set input descriptor */ ulInAttr = BDA_TEXTTYPE_IMPLICIT | BDA_TEXT_ORIENT_RTL; layout[1].name = InOnlyTextDescr; layout[1].value = &ulInAttr; /* Set output descriptor */ ulOutAttr = BDA_TEXTTYPE_VISUAL | BDA_TEXT_ORIENT_LTR; layout[2].name = OutOnlyTextDescr; layout[2].value = &ulOutAttr; /* Last value in array */ layout[3].name = 0; /* Set the values in the layout object */ RC = LayoutSetValues(hlo,layout,&index);
Using LayoutTextDescriptors
Using the following values, which are of type LAYOUT_TEXT_DESCRIPTOR, the caller can set the input and output values of one or more descriptors. This has exactly the same effect as using the previous method : the choice of which method to use is a matter of style.
Orientation (LAYOUT_TEXT_DESCRIPTOR)
The descriptor Orientation specifies the global directional text orientation:
ORIENTATION-LTR-left-to-right global orientation
ORIENTATION-RTL-right-to-left global orientation
ORIENTATION-CONTEXTUAL-contextual global orientation
The TypeOfText descriptor specifies the directional ordering of the directional text in the buffer:
TEXT-VISUAL-code elements are stored in visually ordered segments which can be rendered as is. Bidirectional code elements will have to be previously reordered for a specific orientation.
TEXT-IMPLICIT-code elements are stored in logically ordered segments.
The Swapping descriptor specifies whether symmetric swapping is applied to the text:
SWAPPING- The text conforms to symmetric swapping
NO_SWAPPING- The text does not conform to symmetric swapping
The Numerals descriptor specifies the shaping of numerals recognized by the layout object:
NUMERALS_NOMINAL - Nominal shaping of numerals using the portable character set (i.e. Arabic numerals).
NUMERALS_NATIONAL - National shaping of numeral based on the script of the locale associated with the layout object (i.e. for Arabic, Hindi numerals are used).
NUMERALS_CONTEXTUAL - Contextual shaping of numeral, depending on the context (script) of surrounding text (e.g. Hindi numbers in Arabic text and Arabic numbers otherwise). Contextual shaping of numerals can only be done if TypeOfText is TEXT_IMPLICIT.
TextShaping: specifies the characteristics of the in/out text
TEXT_SHAPED - The text contains presentation form shapes as defined by the locale
TEXT_NOMINAL - The text has no presentation form shapes as defined by the locale.
TEXT_INITIAL - The visual text has only initial shapes.
TEXT_MIDDLE - The visual text has only middle shapes.
TEXT_FINAL - The visual text has only final shapes.
TEXT_ISOLATED - The visual text has only isolated shapes.
The WordBreak descriptor specifies whether bidirectional should factor word recognition or not.
BREAK _ WordBreak on, word by word reordering (i.e. the text reordering is dependent on the level (per the bidirectional algorithm) of word separators).
NO_BREAK _ word break off, segment reordering.
The following code fragment shows how an application would set the orientation and type of text using this method. This has exactly the same effect as the previous example :
LAYOUT_VALUES layout[2];LAYOUT_TEXT_DESCRIPTOR descr; . . . /* Put the descr record in the layout array */ layout[0].name = TypeOfText | Orientation; layout[0].value = &descr; /* Last value in array */ layout[1].name = 0; /* Initialize the input value */ descr.in = TEXT_IMPLICIT | ORIENTATION_RTL; /* Initialize the output value */ descr.out = TEXT_VISUAL | ORIENTATION_LTR; /* Set the values in the layout object */ RC = LayoutSetValues(hlo,layout,&index);