def __call__(self, word, font_size, font_path, position, orientation, **kwargs):
<EOL>font = ImageFont.truetype(font_path, font_size)<EOL>transposed_font = ImageFont.TransposedFont(font,<EOL>orientation=orientation)<EOL>box_size = transposed_font.getsize(word)<EOL>x = position[<NUM_LIT:0>]<EOL>y = position[<NUM_LIT:1>]<EOL>patch = self.image[x:x + box_size[<NUM_LIT:0>], y:y + box_size[<NUM_LIT:1>]]<EOL>if patch.ndim == <NUM_LIT:3>:<EOL><INDENT>patch = patch[:, :, :<NUM_LIT:3>]<EOL><DEDENT>if patch.ndim == <NUM_LIT:2>:<EOL><INDENT>raise NotImplementedError("<STR_LIT>")<EOL><DEDENT>reshape = patch.reshape(-<NUM_LIT:1>, <NUM_LIT:3>)<EOL>if not np.all(reshape.shape):<EOL><INDENT>if self.default_color is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return "<STR_LIT>" % tuple(self.default_color)<EOL><DEDENT>color = np.mean(reshape, axis=<NUM_LIT:0>)<EOL>return "<STR_LIT>" % tuple(color)<EOL>
Generate a color for a given word using a fixed image.