diff options
| author | Felipe Corr??a da Silva Sanches <juca@members.fsf.org> | 2008-03-04 07:48:35 +0000 |
|---|---|---|
| committer | JucaBlues <JucaBlues@users.sourceforge.net> | 2008-03-04 07:48:35 +0000 |
| commit | c02c784dbd48853c7ba7175d930f8304a2d4e8cf (patch) | |
| tree | 1804d34635bea76d80cd049c405e415f5ef978f8 | |
| parent | r18294@shi: ted | 2008-03-03 15:11:22 -0800 (diff) | |
| download | inkscape-c02c784dbd48853c7ba7175d930f8304a2d4e8cf.tar.gz inkscape-c02c784dbd48853c7ba7175d930f8304a2d4e8cf.zip | |
New extension to convert text to braille
(bzr r4947)
| -rw-r--r-- | share/extensions/Makefile.am | 2 | ||||
| -rw-r--r-- | share/extensions/text_braille.inx | 15 | ||||
| -rw-r--r-- | share/extensions/text_braille.py | 45 |
3 files changed, 62 insertions, 0 deletions
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 @@ +<inkscape-extension>
+ <_name>Convert to Braille</_name>
+ <id>org.inkscape.text.braille</id>
+ <dependency type="executable" location="extensions">chardataeffect.py</dependency>
+ <dependency type="executable" location="extensions">text_braille.py</dependency>
+ <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Text"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">text_braille.py</command>
+ </script>
+</inkscape-extension>
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()
|
