angle = pango.GravityToRotation(gravity)
Note that pmatrix:Rotate() takes angle in degrees, not radians.
So, to call pmatrix:Rotate() with the output of this function
you should multiply it by (180. / #PI).
This function returns the rotation value corresponding to gravity.
See pcontext:SetBaseGravity() for a list of gravity constants.
#PANGO_GRAVITY_AUTOgravity