Skip to contentSkip to conversation

Add braille support for vector images

PATCH Applied Samuel Thibault 2 participants 7 messages Sep 9, 2017 – Sep 17, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add braille support for vector images

Hello,

This adds support for embossing vector images as braille, by using ghostscript to rasterize without antialias.

Samuel

=== modified file 'Makefile.am'

Makefile.am +9 -0
@@ -533,6 +533,8 @@ nodist_pkgfilter_SCRIPTS = \
 	filter/braille/drivers/index/imageubrltoindexv4 \
 	filter/braille/drivers/index/textbrftoindexv3 \
 	filter/braille/filters/imagetobrf \
+	filter/braille/filters/vectortopdf \
+	filter/braille/filters/vectortobrf \
 	filter/braille/filters/texttobrf
 endif
 pkgfilter_PROGRAMS += \
@@ -994,6 +996,13 @@ if ENABLE_DRIVERLESS
 endif
 if ENABLE_BRAILLE
 	$(LN_S) -f imagetobrf $(DESTDIR)$(pkgfilterdir)/imagetoubrl
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/svgtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/xfigtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/wmftopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/emftopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/cgmtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/cmxtopdf
+	$(LN_S) -f vectortobrf $(DESTDIR)$(pkgfilterdir)/vectortoubrl
 	$(LN_S) -f textbrftoindexv3 $(DESTDIR)$(pkgfilterdir)/textbrftoindexv4
 endif
 

=== modified file 'README'

README +16 -0
@@ -1611,6 +1611,22 @@ lp file.rtf
 lp file.docx
 
 
+--------------------
+Vector Image support
+--------------------
+
+Vector images can be embossed by converting them to braille dots.
+
+This needs the inkscape package installed. Various input formats are then
+supported: .svg, .fig, .wmf, .emf, .cgm, .cmx
+
+The conversion assumes that the input is black-on-white. If it is
+white-on-black, the -o Negate option can be used.
+
+This image support is preferred over the generic image support described below,
+which has to reconstruct lines to be embossed.
+
+
 -------------
 Image support
 -------------

=== modified file 'configure.ac'

configure.ac +2 -0
@@ -850,6 +850,8 @@ AC_CONFIG_FILES([
 	filter/braille/filters/cups-braille.sh
 	filter/braille/filters/imagetobrf
 	filter/braille/filters/texttobrf
+	filter/braille/filters/vectortopdf
+	filter/braille/filters/vectortobrf
 	filter/braille/filters/liblouis1.defs.gen
 	mime/cupsfilters.convs
 ])

=== added file 'filter/braille/filters/vectortobrf.in'

braille/filters/vectortobrf.in +70 -0

70 lines not on this page · raw message

=== added file 'filter/braille/filters/vectortopdf.in'

braille/filters/vectortopdf.in +70 -0

70 lines not on this page · raw message

=== modified file 'mime/braille.convs'

braille.convs +15 -5
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015 Samuel Thibault <[email protected]>
+# Copyright (c) 2015, 2017 Samuel Thibault <[email protected]>
 # 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -43,7 +43,6 @@ image/gif		image/vnd.cups-brf	70	imageto
 image/jpeg		image/vnd.cups-brf	70	imagetobrf
 image/pcx		image/vnd.cups-brf	70	imagetobrf
 image/png		image/vnd.cups-brf	70	imagetobrf
-image/svg		image/vnd.cups-brf	70	imagetobrf
 image/tiff		image/vnd.cups-brf	70	imagetobrf
 image/vnd.microsoft.icon	image/vnd.cups-brf	70	imagetobrf
 image/x-ms-bmp		image/vnd.cups-brf	70	imagetobrf
@@ -59,7 +58,6 @@ image/gif		image/vnd.cups-ubrl	70	imaget
 image/jpeg		image/vnd.cups-ubrl	70	imagetoubrl
 image/pcx		image/vnd.cups-ubrl	70	imagetoubrl
 image/png		image/vnd.cups-ubrl	70	imagetoubrl
-image/svg		image/vnd.cups-ubrl	70	imagetoubrl
 image/tiff		image/vnd.cups-ubrl	70	imagetoubrl
 image/vnd.microsoft.icon	image/vnd.cups-ubrl	70	imagetoubrl
 image/x-ms-bmp		image/vnd.cups-ubrl	70	imagetoubrl
@@ -71,5 +69,17 @@ image/x-xbitmap		image/vnd.cups-ubrl	70
 image/x-xpixmap		image/vnd.cups-ubrl	70	imagetoubrl
 image/x-xwindowdump	image/vnd.cups-ubrl	70	imagetoubrl
 
-# TODO: 
-#image/svg		image/vnd.cups-brf	30	vectortobrf
+image/svg		image/vnd.cups-pdf	30	svgtopdf
+image/svg+xml		image/vnd.cups-pdf	30	svgtopdf
+application/x-xfig	image/vnd.cups-pdf	30	xfigtopdf
+image/wmf		image/vnd.cups-pdf	30	wmftopdf
+image/x-wmf		image/vnd.cups-pdf	30	wmftopdf
+windows/metafile	image/vnd.cups-pdf	30	wmftopdf
+application/x-msmetafile	image/vnd.cups-pdf	30	wmftopdf
+image/emf		image/vnd.cups-pdf	30	emftopdf
+image/x-emf		image/vnd.cups-pdf	30	emftopdf
+image/cgm		image/vnd.cups-pdf	30	cgmtopdf
+image/x-cmx		image/vnd.cups-pdf	30	cmxtopdf
+
+image/vnd.cups-pdf	image/vnd.cups-brf	30	vectortobrf
+image/vnd.cups-pdf	image/vnd.cups-ubrl	30	vectortoubrl

=== modified file 'mime/braille.types'

braille.types +9 -1
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015 Samuel Thibault <[email protected]>
+# Copyright (c) 2015, 2017 Samuel Thibault <[email protected]>
 # 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -26,5 +26,13 @@ text/vnd.cups-brf	brf
 text/vnd.cups-ubrl
 image/vnd.cups-brf
 image/vnd.cups-ubrl
+image/vnd.cups-pdf
 
 application/msword	doc string(0,<D0CF11E0A1B11AE1>)
+
+image/svg+xml		svg svgz
+application/x-xfig	fig
+image/wmf		wmf
+image/emf		emf
+image/cgm		cgm
+image/x-cmx		cmx
#1 lore raw
Quoted 6 lines · Samuel Thibault

Hello,

This adds support for embossing vector images as braille, by using ghostscript to rasterize without antialias.

Samuel

Thank you very much for your two patches. I have applied them now.

Till

#2 lore raw

Hello,

Quoted 5 lines · Till Kamppeter, on lun. 11 sept. 2017 11:59:01 -0300, wrote:
Quoted 2 lines · Samuel Thibault

This adds support for embossing vector images as braille, by using ghostscript to rasterize without antialias.

Thank you very much for your two patches. I have applied them now.

It seems you forgot to add the vectortopdf and vectortobrf files?

Samuel

#3 lore raw
Quoted 4 lines · Samuel Thibault

Hello,

Quoted 1 line · Till Kamppeter, on lun. 11 sept. 2017 11:59:01 -0300, wrote:

On 09/09/2017 04:02 PM, Samuel Thibault wrote:

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

This adds support for embossing vector images as braille, by using ghostscript to rasterize without antialias.

Thank you very much for your two patches. I have applied them now.

It seems you forgot to add the vectortopdf and vectortobrf files?

Samuel

Sorry, I have completely overlooked that the patch contained new files. I have added them now. Please check.

Till

#4 lore raw
Quoted 1 line · Till Kamppeter, on lun. 11 sept. 2017 17:09:49 -0300, wrote:

I have added them now. Please check.

Thanks!

I however realize that trap handling do not pile up and the file name was incorrect, so the attached patch is needed to avoid leaking temporary files.

Samuel

=== modified file 'filter/braille/filters/vectortopdf.in'

braille/filters/vectortopdf.in +1 -2
@@ -43,8 +43,7 @@ case $0 in
   *cmxtopdf*) INPUT_FORMAT=cmx ;;
 esac
 
-trap -- 'rm -f "$FILE_FORMAT"' EXIT
-trap -- 'rm -f "$FILE_FORMAT_PDF"' EXIT
+trap -- 'rm -f "$FILE_FORMAT" "$FILE_PDF"' EXIT
 FILE_FORMAT=$(mktemp "${TMPDIR:-/tmp}/vectortopdf.XXXXXX.${INPUT_FORMAT}")
 FILE_PDF=$(mktemp "${TMPDIR:-/tmp}/vectortopdf.XXXXXX.pdf")
 
#5 lore raw
Quoted 11 lines · Samuel Thibault
Quoted 1 line · Till Kamppeter, on lun. 11 sept. 2017 17:09:49 -0300, wrote:

I have added them now. Please check.

Thanks!

I however realize that trap handling do not pile up and the file name was incorrect, so the attached patch is needed to avoid leaking temporary files.

Samuel

Applied. Thanks.

Till

#6 lore raw
In reply to Samuel Thibault

Hello,

Quoted 6 lines · Samuel Thibault, on sam. 09 sept. 2017 21:02:07 +0200, wrote:
(quoted diff) +2 -0
+	filter/braille/filters/vectortopdf \
+	filter/braille/filters/vectortobrf \
 	filter/braille/filters/texttobrf
 endif
 pkgfilter_PROGRAMS += \

Review if ENABLE_DRIVERLESS · line 1005

Quoted 10 lines
(quoted diff) +7 -0
@@ -994,6 +996,13 @@ if ENABLE_DRIVERLESS
 endif
 if ENABLE_BRAILLE
 	$(LN_S) -f imagetobrf $(DESTDIR)$(pkgfilterdir)/imagetoubrl
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/svgtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/xfigtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/wmftopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/emftopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/cgmtopdf
+	$(LN_S) -f vectortopdf $(DESTDIR)$(pkgfilterdir)/cmxtopdf
+	$(LN_S) -f vectortobrf $(DESTDIR)$(pkgfilterdir)/vectortoubrl

BTW, these need to be installed in the Debian package too, see attached patch.

Samuel

cups-filters.install +10 -0
diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur /tmp/cups-filters-1.17.5/debian/cups-filters.install debian/cups-filters.install
@@ -28,6 +28,16 @@
 usr/lib/cups/filter/textbrftoindexv3
 usr/lib/cups/filter/textbrftoindexv4
 usr/lib/cups/filter/texttobrf
+usr/lib/cups/filter/vectortopdf
+usr/lib/cups/filter/svgtopdf
+usr/lib/cups/filter/xfigtopdf
+usr/lib/cups/filter/wmftopdf
+usr/lib/cups/filter/emftopdf
+usr/lib/cups/filter/cgmtopdf
+usr/lib/cups/filter/cmxtopdf
+usr/lib/cups/filter/cgmtopdf
+usr/lib/cups/filter/vectortobrf
+usr/lib/cups/filter/vectortoubrl
 usr/share/cups/banners/*
 usr/share/cups/braille/*
 usr/share/cups/drv/*