static void draw_string(void* _context, const char* string, size_t length, float deltaSpace, float deltaNonSpace) { DrawingContext* context = reinterpret_cast<DrawingContext *>(_context); // NOTE: the picture data was recorded with a "set pen location" // command inserted before the "draw string" command, so we can // use PenLocation() BPoint location = context->CurrentState()->PenLocation(); escapement_delta delta = { deltaSpace, deltaNonSpace }; context->ConvertToScreenForDrawing(&location); location = context->GetDrawingEngine()->DrawString(string, length, location, &delta); context->ConvertFromScreenForDrawing(&location); context->CurrentState()->SetPenLocation(location); // the DrawingEngine/Painter does not need to be updated, since this // effects only the view->screen coord conversion, which is handled // by the view only }