Font Renderer
Principle
The Font Renderer is included in the MicroUI module (see MicroUI) for the application side; and is included in the Display module (see Display) for the C side.
Functional Description
The Graphics Engine redirects all MicroUI font drawings to the internal software algorithms. There is no indirection to a set of Low Level API.
![digraph {
graph [
overlap=false
splines=true
nodesep=0.5
ranksep=0.5
bgcolor="transparent"
center=1
];
node [
fixedsize=true,
fontname="Ubuntu"
fontsize=14
fontcolor=dimgray
height=0.5
width=2.5
shape=box
fillcolor=aliceblue
color="lightblue"
style="filled,setlinewidth(3)",
];
edge [
arrowsize=0.8
];
app [label="Painter API"]
stack [label="Graphics Engine"]
algo [label="Software Algorithms"]
hard [label="hardware"]
app -> stack -> algo -> hard
}](../_images/graphviz-6baf21a497ab9e0043cef2bf3d691fc132794bb5.png)
External Resources
The Font Renderer is able to load some fonts located outside the CPU addresses’ space range. It uses the External Resource Loader.
When a font is located in such memory, the Font Renderer copies a very short part of the resource (the font file) into a RAM memory (into CPU addresses space range): the font header. This header stays located in RAM until MicroEJ Application is using the font. As soon as the MicroEJ Application uses another external font, new font replaces the old one. Then, on MicroEJ Application demand, the Font Renderer loads some extra information from the font into the RAM memory (the font meta data, the font pixels, etc.). This extra information is automatically unloaded from RAM when the Font Renderer no longer needs them.
This extra information is stored into a RAM section called .bss.microui.display.externalFontsHeap
. Its size is automatically calculated according to the external fonts used by the firmware. However it is possible to change this value by setting the MicroEJ application property ej.microui.memory.externalfontsheap.size
. This option is very useful when building a kernel: the kernel may anticipate the section size required by the features.
Warning
When this size is smaller than the size required by an external font, some characters may be not drawn.
Installation
The Font Renderer is part of the MicroUI module and Display module. You must install them in order to be able to use some fonts.
Use
The MicroUI font APIs are available in the class ej.microui.display.Font.