I didn't see the code as pastebin.com is not loading for some reason.
The offset seems to be the height of the top panel containing the hour, battery, light status... You get the idea.
Try calling
SetPanelType(0); to make sure the panel is disabled.
Edit:
In CR3 I'm doing this on EVT_INIT:
PHP Code:
case EVT_INIT:
SetPanelType(1);
pbCrFontSize = round(PanelHeight()*0.32);
pbCrFontAA = OpenFont(DEFAULTFONT, pbCrFontSize, 1);
pbCrFont = OpenFont(DEFAULTFONT, pbCrFontSize, 0);
SetPanelType(0);
need_save_cover = true;
I'm initially enabling the panel so PanelHeight() will return the correct value and then I'm disabling it so I can use the entire screen to draw.