Text this: Generation of shape functions by optimization