(self, text)
return d
Compound variable for the text string. It changes the text map,
        the character position, and the text width.
Compound variable for the text string. It changes the text map,
        the character position, and the text width.
Compound variable for the text string . It changes the text map the character position and the text width .
def text_compound(self, text):
        """Compound variable for the text string. It changes the text map,
        the character position, and the text width."""
        
        coordinates = self.coordinates
        
        if "\n" in text:
            text = text.split("\n")
            
        if type(text) == list:
            self.textsizes = [len(t) for t in text]
            text = "".join(text)
            if type(coordinates) != list:
                coordinates = [coordinates] * len(self.textsizes)
            index = np.repeat(np.arange(len(self.textsizes)), self.textsizes)
            text_map = self.get_map(text)
            
            # offset for all characters in the merging of all texts
            offset = np.hstack((0., np.cumsum(text_map[:, 2])[:-1]))
            
            # for each text, the cumsum of the length of all texts strictly
            # before
            d = np.hstack(([0], np.cumsum(self.textsizes)[:-1]))
            
            # compensate the offsets for the length of each text
            offset -= np.repeat(offset[d], self.textsizes)
            
            text_width = 0.
                
        else:
            self.textsizes = len(text)
            text_map = self.get_map(text)
            offset = np.hstack((0., np.cumsum(text_map[:, 2])[:-1]))    
            text_width = offset[-1]
            index = np.zeros(len(text))
            
        self.size = len(text)
        
        d = dict(text_map=text_map, offset=offset, text_width=text_width,
            index=index)
        d.update(self.position_compound(coordinates))
        
        return d
def text_compound ( self , text ) : coordinates = self . coordinates if "\n" in text : text = text . split ( "\n" ) if type ( text ) == list : self . textsizes = [ len ( t ) for t in text ] text = "" . join ( text ) if type ( coordinates ) != list : coordinates = [ coordinates ] * len ( self . textsizes ) index = np . repeat ( np . arange ( len ( self . textsizes ) ) , self . textsizes ) text_map = self . get_map ( text ) # offset for all characters in the merging of all texts offset = np . hstack ( ( 0. , np . cumsum ( text_map [ : , 2 ] ) [ : - 1 ] ) ) # for each text, the cumsum of the length of all texts strictly # before d = np . hstack ( ( [ 0 ] , np . cumsum ( self . textsizes ) [ : - 1 ] ) ) # compensate the offsets for the length of each text offset -= np . repeat ( offset [ d ] , self . textsizes ) text_width = 0. else : self . textsizes = len ( text ) text_map = self . get_map ( text ) offset = np . hstack ( ( 0. , np . cumsum ( text_map [ : , 2 ] ) [ : - 1 ] ) ) text_width = offset [ - 1 ] index = np . zeros ( len ( text ) ) self . size = len ( text ) d = dict ( text_map = text_map , offset = offset , text_width = text_width , index = index ) d . update ( self . position_compound ( coordinates ) ) return d