How to define curvature on the boundary

Hello,
I have the following code in FreeFEM to compute the curvature on the boundary:
Vh H = curvature(Th, 2);
I know that H = div(n) where n is the normal of the boundary. However, I would like to better understand how this curvature is being computed and how exactly the normal vector n is defined in this context.
Could someone please explain how the curvature is calculated and how the normal is determined in FreeFEM?