MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / GetStringWidth

Method GetStringWidth

src/bzflag/HubLua.cpp:830–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828//============================================================================//
829
830int HubLink::GetStringWidth(lua_State* L) {
831 if (!controlPanel) {
832 return 0;
833 }
834 const char* text = luaL_checkstring(L, 1);
835 FontManager& fm = FontManager::instance();
836 const int faceID = controlPanel->getFontFace()->getFMFace();
837 const float fontSize = controlPanel->getFontSize();
838 lua_pushfloat(L, fm.getStringWidth(faceID, fontSize, text));
839 return 1;
840}
841
842
843int HubLink::GetConsoleWidth(lua_State* L) {

Callers

nothing calls this directly

Calls 5

lua_pushfloatFunction · 0.85
getFMFaceMethod · 0.80
getStringWidthMethod · 0.80
getFontFaceMethod · 0.45
getFontSizeMethod · 0.45

Tested by

no test coverage detected