| 2831 | } |
| 2832 | |
| 2833 | static void PushTextMetrics(lua_State* L, Scene* scene, dmhash_t font_id_hash, const char* text, float width, bool line_break, float leading, float tracking) |
| 2834 | { |
| 2835 | dmGui::TextMetrics metrics; |
| 2836 | dmGui::Result r = dmGui::GetTextMetrics(scene, text, font_id_hash, width, line_break, leading, tracking, &metrics); |
| 2837 | if (r != RESULT_OK) { |
| 2838 | luaL_error(L, "Font '%s' is not specified in scene", dmHashReverseSafe64(font_id_hash)); |
| 2839 | } |
| 2840 | |
| 2841 | lua_createtable(L, 0, 4); |
| 2842 | lua_pushliteral(L, "width"); |
| 2843 | lua_pushnumber(L, metrics.m_Width); |
| 2844 | lua_rawset(L, -3); |
| 2845 | lua_pushliteral(L, "height"); |
| 2846 | lua_pushnumber(L, metrics.m_Height); |
| 2847 | lua_rawset(L, -3); |
| 2848 | lua_pushliteral(L, "max_ascent"); |
| 2849 | lua_pushnumber(L, metrics.m_MaxAscent); |
| 2850 | lua_rawset(L, -3); |
| 2851 | lua_pushliteral(L, "max_descent"); |
| 2852 | lua_pushnumber(L, metrics.m_MaxDescent); |
| 2853 | lua_rawset(L, -3); |
| 2854 | } |
| 2855 | |
| 2856 | static inline float LuaUtilGetDefaultFloat(lua_State* L, int index, float defaultvalue) |
| 2857 | { |
nothing calls this directly
no test coverage detected