From: JucaBlues Date: Tue, 4 Mar 2008 07:48:35 +0000 (+0000) Subject: New extension to convert text to braille X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dd1d8fcaeb1aa8e9ede9cc83d7d72c1160a4c61b;p=inkscape.git New extension to convert text to braille --- diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 100b906fc..6ad2f17f3 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -98,6 +98,7 @@ extensions = \ text_flipcase.py \ text_randomcase.py \ text_replace.py \ + text_braille.py \ txt2svg.pl \ webbrowser_askaquestion.py \ webbrowser_commandline.py \ @@ -206,6 +207,7 @@ modules = \ text_flipcase.inx \ text_randomcase.inx \ text_replace.inx \ + text_braille.inx \ txt2svg.inx \ whirl.inx \ wmf_input.inx \ diff --git a/share/extensions/text_braille.inx b/share/extensions/text_braille.inx new file mode 100644 index 000000000..1bd0357be --- /dev/null +++ b/share/extensions/text_braille.inx @@ -0,0 +1,15 @@ + + <_name>Convert to Braille + org.inkscape.text.braille + chardataeffect.py + text_braille.py + + all + + + + + + diff --git a/share/extensions/text_braille.py b/share/extensions/text_braille.py new file mode 100644 index 000000000..5de353827 --- /dev/null +++ b/share/extensions/text_braille.py @@ -0,0 +1,45 @@ +#encoding: utf-8 +import chardataeffect, inkex, string + +convert_table = {\ +'a': unicode("⠁", "utf-8"),\ +'b': unicode("⠃", "utf-8"),\ +'c': unicode("⠉", "utf-8"),\ +'d': unicode("⠙", "utf-8"),\ +'e': unicode("⠑", "utf-8"),\ +'f': unicode("⠋", "utf-8"),\ +'g': unicode("⠛", "utf-8"),\ +'h': unicode("⠓", "utf-8"),\ +'i': unicode("⠊", "utf-8"),\ +'j': unicode("⠚", "utf-8"),\ +'k': unicode("⠅", "utf-8"),\ +'l': unicode("⠇", "utf-8"),\ +'m': unicode("⠍", "utf-8"),\ +'n': unicode("⠝", "utf-8"),\ +'o': unicode("⠕", "utf-8"),\ +'p': unicode("⠏", "utf-8"),\ +'q': unicode("⠟", "utf-8"),\ +'r': unicode("⠗", "utf-8"),\ +'s': unicode("⠎", "utf-8"),\ +'t': unicode("⠞", "utf-8"),\ +'u': unicode("⠥", "utf-8"),\ +'v': unicode("⠧", "utf-8"),\ +'w': unicode("⠺", "utf-8"),\ +'x': unicode("⠭", "utf-8"),\ +'y': unicode("⠽", "utf-8"),\ +'z': unicode("⠵", "utf-8"),\ +} + +class C(chardataeffect.CharDataEffect): + + def process_chardata(self,text, line, par): + r = "" + for c in text: + if convert_table.has_key(c.lower()): + r = r + convert_table[c.lower()] + else: + r = r + c + return r + +c = C() +c.affect()