(font=None, size=None)
return tex, matrix, get_map
Load a font and return the texture and map getter function.
    
    Arguments:
      * font: the font name
      * size: the size (if the size does not exist in the font files, a close
        size will be used)
        
    Returns:
      * tex: the texture as a NxMx4 image
      * get_map: a function that takes a string and returns the text map, i.e.
        a matrix where line i contains the position and size of character i in
        that string.
Load a font and return the texture and map getter function.
    
    Arguments:
      * font: the font name
      * size: the size (if the size does not exist in the font files, a close
        size will be used)
        
    Returns:
      * tex: the texture as a NxMx4 image
      * get_map: a function that takes a string and returns the text map, i.e.
        a matrix where line i contains the position and size of character i in
        that string.
Load a font and return the texture and map getter function . Arguments : * font : the font name * size : the size ( if the size does not exist in the font files a close size will be used ) Returns : * tex : the texture as a NxMx4 image * get_map : a function that takes a string and returns the text map i . e . a matrix where line i contains the position and size of character i in that string .
def load_font(font=None, size=None):
    """Load a font and return the texture and map getter function.
    
    Arguments:
      * font: the font name
      * size: the size (if the size does not exist in the font files, a close
        size will be used)
        
    Returns:
      * tex: the texture as a NxMx4 image
      * get_map: a function that takes a string and returns the text map, i.e.
        a matrix where line i contains the position and size of character i in
        that string.
        
    """
    png, fnt = get_font_filenames(font, size)
    matrix = load_fnt(fnt)
    tex = load_png(png)
    texsize = tex.shape[:2]
    get_map = lambda text: get_text_map(text, matrix=matrix)
    # normalize the matrix so that coordinates are in [0,1]
    size = np.array(np.tile(texsize, (1, 2)), dtype=np.float32)
    matrix = np.array(matrix, dtype=np.float32)
    matrix[:,1:] /= size
    return tex, matrix, get_map
def load_font ( font = None , size = None ) : png , fnt = get_font_filenames ( font , size ) matrix = load_fnt ( fnt ) tex = load_png ( png ) texsize = tex . shape [ : 2 ] get_map = lambda text : get_text_map ( text , matrix = matrix ) # normalize the matrix so that coordinates are in [0,1] size = np . array ( np . tile ( texsize , ( 1 , 2 ) ) , dtype = np . float32 ) matrix = np . array ( matrix , dtype = np . float32 ) matrix [ : , 1 : ] /= size return tex , matrix , get_map