FONTLIB utilizes the FreeType library for the purpose of low-level rendering and bounding box computation. When we omit the technical details of FreeType usage, the rendering is straightforward: a font is loaded, scaled, a transformation is applied and the glyph is rendered into a bitmap based on the bounding box size. The same applies to the bounding box computation.
The only exception is string rendering. Here, the rendering routine has two passes. In the first one, the exact bitmap size is computed, and in the second one all the string glyphs are actually rendered.
Rendering routines are located in the font/render.c source file.