texture_text#

k3d.factory.texture_text(text, position=(0, 0, 0), color=255, font_weight=400, font_face='Courier New', font_size=68, size=1.0, name=None, group=None, custom_data=None, compression_level=0, **kwargs)[source]#

Create a TextureText drawable.

Compared to Text and Text2d this drawable has less features (no KaTeX support), but the labels are located in the GPU memory, and not the browser’s DOM tree. This has performance consequences, and may be preferable when many simple labels need to be displayed.

Parameters
  • text (str or list of str) – Content of the text.

  • position (list) – (x, y, z) coordinates of text position, by default (0, 0, 0). If n text is pass position should contain 3*n elements .

  • color (int, optional) – Hex color of the text, by default _default_color.

  • font_weight (int, optional) – Characters thickness in HTML-like units [100, 900], by default 400.

  • font_face (str, optional) – Font name used to render text, by default “Courier New”.

  • font_size (int, optional) – Font size inside the sprite texture in px units, by default 68. This does not affect the size of the text in the scene, only the accuracy and raster size of the texture.

  • size (float, optional) – Size of the texture sprite containing the text, by default 1.0.

  • name (str, optional) – Object name, by default None.

  • group (str, optional) – Name of a group, by default None.

  • custom_data (dict) – A object with custom data attached to object.

  • compression_level (int, optional) – Level of data compression [-1, 9], by default 0.

  • **kwargs – For other keyword-only arguments, see process_transform_arguments.

Returns

TextureText Drawable.

Return type

TextureText

See also

Examples#

import k3d

plt_texture_text = k3d.texture_text('Texture',
                                    position=[0, 0, 0],
                                    font_face='Calibri',
                                    font_weight=600,
                                    color=0xa2ffc8)

plot = k3d.plot()
plot += plt_texture_text
plot.display()