Wimp_TextOp
In order to address certain issues with fonts which 'overhang' their right hand edge (such as oblique or italic fonts), a new flag bit has been added to Wimp_TextOp 1 (read size of string). This allows applications (such as the Filer) to calculate icon bounding boxes more reliably where such fonts are in use.
Since RISC OS 4 a number of additional flags have been available for Wimp_TextOp 2 (plot string). These allow the text strings to be rendered within the current window and make the font appear vertically centred at the position specified.
Two additional reason code have been added to centralise the splitting of system font text and its truncation.
Wimp_TextOp
On entry
R0 = Operation + flags
bits 0-7 operation :
0 : Set colours to use
1 : Read string size
2 : Plot font
3 : Find split point in string
4 : Truncate string with ellipsis
bits 8-31 dependent on operation
Other registers dependent on operation
This SWI is used to perform text string operations using the desktop font.
Wimp_TextOp 0
On entry
R0 = 0 (set font colours)
R1 = foreground colour (&BBGGRR00)
R2 = background colour (&BBGGRR00)
This SWI sets the colours to use for subsequent desktop font operations.
Wimp_TextOp 1
On entry
R0 = 1 (read string size) + flags :
bit 31: Return size covered by string
R1 = pointer to string
R2 = number of characters to process, or 0 for the entire string
On exit
R0 = width of string in desktop font in OS units
This SWI is used to read the width of a string when rendered on the screen. Bit 31 controls whether the space covered by the string is returned rather than the baseline offset at which the string ends. This distinction must be made because certain fonts (italic fonts, for example) will end at a baseline position before the end of the rendered font. With the bit set the whole area covered will be returned. Thus, if this call is required for locating the end of a string such that another may be added (for example, in another colour) then bit 31 should be clear. If, however, this call is being used to calculate the size required for the font such that it is entirely rendered (for example, in calculating the size of an icon's bounding box), bit 31 should be set.
Wimp_TextOp 2
On entry
R0 = 2 (plot text string) + flags
bit 8-26 = reserved, must be 0
bit 27 = reserved for future expansion
bit 28 = centre text vertically
bit 29 = x/y offsets are offsets within the current redraw window
rather than screen offsets
bit 30 = vertically justify to make the baseline the same as system font
bit 31 = right justify string
R1 = pointer to string
R2 = reserved (must be -1)
R3 = reserved (must be -1)
R4 = x co-ordinate, in OS units
R5 = y co-ordinate, in OS units
This SWI is used to plot a text string in the desktop font.
Wimp_TextOp 3
On entry
R0 = 3 (get split point)
R1 = pointer to string
R2 = width to split at in OS units
R3 = split character, or -1 for none
On exit
R0 = pointer to split point in supplied string
This SWI is used to read a split point by limiting to a given length. It is similar in function to the Font_ScanString SWI.
Wimp_TextOp 4
On entry
R0 = 4 (truncate string with ellipsis)
R1 = pointer to string
R2 = pointer to output buffer
R3 = size of output buffer, or 0 to request size required
R4 = maximum width in OS units
On exit
R0 = size of buffer required
This SWI is used to truncate a string by using an ellipsis character for the currently selected alphabet, or three full stops. If the string fits within the size specified, no ellipsis will be added.
|