(filename)
return M
Load a bitmap font file.
    
    Returns:
      * M: an array where each line contains:
            charid, x, y, w, h
        x and y are the top-left coordinates
        w and h are the width and height of the character
Load a bitmap font file.
    
    Returns:
      * M: an array where each line contains:
            charid, x, y, w, h
        x and y are the top-left coordinates
        w and h are the width and height of the character
Load a bitmap font file . Returns : * M : an array where each line contains : charid x y w h x and y are the top - left coordinates w and h are the width and height of the character
def load_fnt(filename):
    """Load a bitmap font file.
    
    Returns:
      * M: an array where each line contains:
            charid, x, y, w, h
        x and y are the top-left coordinates
        w and h are the width and height of the character
    
    """
    pattern = "char id=([0-9]+)[ ]+x=([0-9]+)[ ]+y=([0-9]+)[ ]+width=([0-9]+)[ ]+height=([0-9]+)"

    f = open(filename, "r")

    # look for coordinates and sizes of all characters, along with the 
    # character ASCII indices
    values = []
    for line in f:
        if line.startswith("char "):
            m = re.search(pattern, line)
            if m:
                values.append(m.group(*xrange(1,6)))
    f.close()
    M0 = np.array(values, dtype=np.int32)
    M = np.zeros((M0[:,0].max() + 1, M0.shape[1]), dtype=np.int32)
    M[M0[:,0],:] = M0
    return M
def load_fnt ( filename ) : pattern = "char id=([0-9]+)[ ]+x=([0-9]+)[ ]+y=([0-9]+)[ ]+width=([0-9]+)[ ]+height=([0-9]+)" f = open ( filename , "r" ) # look for coordinates and sizes of all characters, along with the  # character ASCII indices values = [ ] for line in f : if line . startswith ( "char " ) : m = re . search ( pattern , line ) if m : values . append ( m . group ( * xrange ( 1 , 6 ) ) ) f . close ( ) M0 = np . array ( values , dtype = np . int32 ) M = np . zeros ( ( M0 [ : , 0 ] . max ( ) + 1 , M0 . shape [ 1 ] ) , dtype = np . int32 ) M [ M0 [ : , 0 ] , : ] = M0 return M