- Exported GetDisplayTopOffset for font characters to ZScript

This commit is contained in:
Player701 2022-09-30 10:44:27 +03:00 committed by Christoph Oelckers
parent 1b762474f0
commit 78360c1888
2 changed files with 14 additions and 0 deletions

View file

@ -719,6 +719,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDefaultKerning, GetDefaultKerning)
ACTION_RETURN_INT(self->GetDefaultKerning());
}
static double GetDisplayTopOffset(FFont* font, int c)
{
auto texc = font->GetChar(c, CR_UNDEFINED, nullptr);
return texc ? texc->GetDisplayTopOffset() : 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDisplayTopOffset, GetDisplayTopOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_INT(code);
ACTION_RETURN_FLOAT(GetDisplayTopOffset(self, code));
}
//==========================================================================
//
// file system

View file

@ -649,6 +649,7 @@ struct Font native
native static int FindFontColor(Name color);
native double GetBottomAlignOffset(int code);
native double GetDisplayTopOffset(int code);
native static Font FindFont(Name fontname);
native static Font GetFont(Name fontname);
native BrokenLines BreakLines(String text, int maxlen);