float GiGraphics::drawTextAt(GiTextWidthCallback* c, int argb, const char* text, const Point2d& pnt, float h, int align, float angle) { float ret = 0; if (m_impl->canvas && text && h > 0 && !m_impl->stopping && !pnt.isDegenerate()) { Point2d ptd(pnt * xf().modelToDisplay()); float w2d = xf().getWorldToDisplayY(h < 0); h = fabsf(h) * w2d; if (!mgIsZero(angle)) { angle = (Vector2d::angledVector(angle, 1) * xf().modelToWorld()).angle2(); } GiContext ctx; ctx.setFillARGB(argb ? argb : 0xFF000000); if (setBrush(&ctx)) { TextWidthCallback1 *cw = c ? new TextWidthCallback1(c, w2d) : (TextWidthCallback1 *)0; ret = m_impl->canvas->drawTextAt(cw, text, ptd.x, ptd.y, h, align, angle) / w2d; } } return ret; }