@@ -685,7 +685,7 @@ def __init__(self, text: str, **config):
685
685
self .scale (TEXT_MOB_SCALE_FACTOR )
686
686
687
687
def remove_last_M (self , file_name : str ):
688
- """Internally used function . Use to format the rendered SVG files."""
688
+ """Internally used. Use to format the rendered SVG files."""
689
689
with open (file_name , "r" ) as fpr :
690
690
content = fpr .read ()
691
691
content = re .sub (r'Z M [^A-Za-z]*? "\/>' , 'Z "/>' , content )
@@ -717,7 +717,7 @@ def full2short(self, config):
717
717
text2weight -> t2w
718
718
"""
719
719
for kwargs in [config , self .CONFIG ]:
720
- if kwargs . __contains__ ( "text2color" ) :
720
+ if "text2color" in kwargs :
721
721
kwargs ["t2c" ] = kwargs .pop ("text2color" )
722
722
if kwargs .__contains__ ("text2font" ):
723
723
kwargs ["t2f" ] = kwargs .pop ("text2font" )
@@ -736,14 +736,14 @@ def set_color_by_t2c(self, t2c=None):
736
736
self .chars [start :end ].set_color (color )
737
737
738
738
def set_color_by_t2g (self , t2g = None ):
739
- """Internally used function. Sets gradient colours for specified strings. Same as ``set_color_by_t2c``."""
739
+ """Internally used. Sets gradient colors for specified strings. Behaves similarly to ``set_color_by_t2c``."""
740
740
t2g = t2g if t2g else self .t2g
741
741
for word , gradient in list (t2g .items ()):
742
742
for start , end in self .find_indexes (word , self .original_text ):
743
743
self .chars [start :end ].set_color_by_gradient (* gradient )
744
744
745
745
def str2style (self , string ):
746
- """Internally used function. Converts text to Pango Understandable Styles/ """
746
+ """Internally used function. Converts text to Pango Understandable Styles. """
747
747
if string == NORMAL :
748
748
return pangocffi .Style .NORMAL
749
749
elif string == ITALIC :
@@ -795,9 +795,7 @@ def text2hash(self):
795
795
return hasher .hexdigest ()[:16 ]
796
796
797
797
def text2settings (self ):
798
- """Internally used function.
799
- Convets the texts and styles to a setting for parsing
800
- """
798
+ """Internally used function. Converts the texts and styles to a setting for parsing."""
801
799
settings = []
802
800
t2x = [self .t2f , self .t2s , self .t2w ]
803
801
for i in range (len (t2x )):
@@ -807,7 +805,7 @@ def text2settings(self):
807
805
for start , end in self .find_indexes (word , self .text ):
808
806
fsw [i ] = x
809
807
settings .append (TextSetting (start , end , * fsw ))
810
- # Set All text settings(default font slant weight)
808
+ # Set all text settings (default font, slant, weight)
811
809
fsw = [self .font , self .slant , self .weight ]
812
810
settings .sort (key = lambda setting : setting .start )
813
811
temp_settings = settings .copy ()
0 commit comments