rasterizer

class RasterGlyph(sourceGlyph)[source]

An object to scan glyphs and rasterize them into element components.

lib_key_coordenates = 'coordenates.rasterizer.com.hipertipo'
lib_key_margins = 'margins.rasterizer.com.hipertipo'
print_bits(black='#', white='-', res=(125, 125))[source]

Print glyph bits as ASCII text.

rasterize(destGlyph=None, res=(125, 125))[source]

Render scanned bits into destination glyph using components.

read_bits_from_lib()[source]

Read bit coordenates and margins from the glyph lib into attributes.

save_bits_to_lib()[source]

Save bit coordenates and margins from attributes into the glyph lib.

scan(res)[source]

Scan glyph and store bits into glyph lib.

Parameters:res (int) – The grid resolution to use when scanning the glyph, as a tuple of values for x and y.
Returns:A boolean indicating sucess or failure of the scan operation.
get_esize(font, element_src='_element')[source]

Get a font’s element size from its bounding box.

Parameters:
  • font (RFont) – The font to which the element glyph belongs.
  • element_src (str) – The name of the element glyph.
randomize_elements(glyph, esize, rand_size)[source]

Randomize the size of element shapes in the current glyph.

Parameters:
  • glyph (RGlyph) – The glyph in which the element shapes will be transformed.
  • esize (int) – The current base size of the element shape.
  • rand_size (tuple) – The scale factors for minimum and maximum random element sizes.
set_element(font, size, type='rect', magic=None, element_src='_element')[source]

Set the shape of the element glyph in the font.

Parameters:
  • font (RFont) – A font in which to create the element glyph.
  • size (int) – The size of the element shape.
  • type (str) – The type of the element shape: rect, oval or element.
  • magic (float) – A number indicating the roundness of shapes of type element.
  • element_src (str) – The glyph in which the element shape will be drawn.

Previous topic

pens

Next topic

sysutils

This Page