// Lua: height = ucg.getFontDescent( self ) static int lucg_getFontDescent( lua_State *L ) { lucg_userdata_t *lud; if ((lud = get_lud( L )) == NULL) return 0; lua_pushinteger( L, ucg_GetFontDescent( LUCG ) ); return 1; }
void draw_text_ascent_descent(ucg_t *ucg) { prepare_picture(ucg); ucg_SetFont(ucg, ucg_font_ncenB24_tf); ucg_SetFontPosBaseline(ucg); ucg_SetColor(ucg, 0, 0, 0, 255); /* draw blue "baseline" */ ucg_DrawHLine(ucg, 42+ox, 30, ucg_GetStrWidth(ucg, "Ucg")); ucg_SetColor(ucg, 0, 255, 255, 255); /* draw white "Ucg" */ ucg_DrawString(ucg, 42+ox, 30, 0, "Ucg"); pos(ucg, 42+ox, 30, 0); ucg_SetFont(ucg, ucg_font_ncenB24_tf); vrule(ucg, 42+ox+ucg_GetStrWidth(ucg, "Ucg"), 30-ucg_GetFontAscent(ucg), ucg_GetFontAscent(ucg), 1); ucg_SetFont(ucg, ucg_font_ncenB24_tf); vrule(ucg, 42+ox+ucg_GetStrWidth(ucg, "Ucg"), 30, -ucg_GetFontDescent(ucg), 1); save_picture(ucg, "draw_text_ascent_descent"); }