Inter-segment Characters
On character-based displays, an inter-segment character is an additional element that can be turned on or off to represent certain information. The inter-segment character is not part of the "main" character. For example, a clock might have a separator element such as ':' or '/', and some displays have an extra dot ('.') after every character, in case it needs to show decimal numbers.
Display inter-segment characters
A developer can target inter-segment characters in their APL-T documents in a natural way, provided that the developer knows where those characters are and what they can display. For example, consider a device with an 8-character clock that can show date in format MM/DD/YYYY (8 characters being MMDDYYYY and with two inter-segment characters that can show '/').
If the developer knows the capabilities of the device, they can create an APL-T document containing a Text
component with the text
property set to "02/07/2016". The runtime will use the inter-segments to render the '/' characters.
However, note that if an inter-segment character occurs in a document at a location (as specified by the layout) where there is no inter-segment character present on the display, it will be omitted by the runtime.
Algorithm
The algorithm for handling inter-segment characters is described below. The descriptions below use the following terms:
- A "document character" is a character from an APL-T document.
- A "display character slot" is a location on the actual hardware. It can be "real slot" or "inter-segment slot" as described above.
- A "real character set" is what can be shown by "real slots".
- An "inter-segment character set" is what can be shown by "inter-segment slots".
Step 1
The runtime keeps track of the display character slot that will be written to next. At the very beginning, this is the top left slot on the display. The runtime advances from left to right in one row, then goes to the leftmost position in the next row.
Step 2
Runtime decides which document character to render next. This is decided according to layout rules specified for each particular Component
.
Step 3
Decide whether to show, skip or omit the document character. The runtime knows the capabilities of the device and knows the positions of real and inter-segment slots, as well as what they can display. It uses following decision matrix:
Document Character | Real Display Slot | Inter-segment Display Slot |
---|---|---|
In real character set | Show | Advance to the next slot and repeat step 3 |
Not in real set but is in inter-segment set | Omit | Show |
In neither of the sets | Show space | Advance slot and repeat step 3 |
If the runtime reaches the position after the last slot, the rendering of the entire document stops.
Examples
Consider a device that supports showing numerical clock data such as "NN:NN" where N is 0-9, and document contains "1:24". Using such content with left alignment (the default) results in "124" because ':' is omitted and nothing is shown in its place.
On the other hand, positioning the same content with right alignment will show " 1:24".
Last updated: May 10, 2024