The TrueType instruction compiler takes a .tti file with code that specify the instructions. The language is based on C. I will here presume basic knowledge of C, C++, Java, or something similar.
Functions are defined like this:
void calculateDistance(uint p1, uint p2) {
<Any code>
}
Variables are defined like this:
int i;
uint a = 7u;
Constants are defined like this:
const int i = 5;
const uint a = 7u;
TTIComp uses only 5 types:
Type | Explanation | Example |
void |
An empty type used for function returns | |
int |
A 32-bits signed integer | 2563 , -4783 |
uint |
A 32-bits unsigned integer | 2563u |
fixed |
A 32-bits fixed point number (26.6). Used to specify point positions in TrueType. | 25.63 , -47.83 |
bool |
A 32-bits fixed point number (26.6). Used to specify point positions in TrueType. | 25.63 |
Conversion between types is not done automatically:
uint a = 7;
will generate a compile error. A u
is
needed to signify that this number is unsigned.
This could also be done using a type cast, which takes the C++ style:
uint a = uint(7);
.
Within a function, then, you can use normal statements like:
int a=5;
int b=6;
if (b) {
a = b+5*a;
}
moveDistance(1u,2u, 1u,3u, 3.0);
fixed distance = getDistance(1u,2u, 1u,3u);
Here, moveDistance
and getDistance
are predefined
functions (see the next page for those).
Calculations may require type casts because some things can't be
done automatically. When using type casts, please watch out:
fixed(5)
is the same as .08
, and not 5.0
.