]> git.lyx.org Git - features.git/commitdiff
Use pnmcrop to crop the previews
authorAngus Leeming <leeming@lyx.org>
Fri, 18 Oct 2002 12:17:38 +0000 (12:17 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 18 Oct 2002 12:17:38 +0000 (12:17 +0000)
Use pnmcrop to crop the previews and be done with all this nonsense.
Should fix the drawing problems in tables too.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5440 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/scripts/lyxpreview2bitmap.sh

index 4c6e8b097e2a707f500883d4e99958fe29aa88e8..14607b25aa11ce81d963f6e4d5f7f4cf330e5f4a 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-18  Angus Leeming  <leeming@lyx.org>
+
+       * scripts/lyxpreview2bitmap.sh: Use pnmcrop to crop the images
+       if so desired.
+
 2002-10-16  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * configure.m4: add mozilla as default previewer for html
index 6e338fe33d1ea89b942a7f3e33945c903dd0392a..9744f168772f866b40896eb6c2d617c9e3e4c788 100644 (file)
@@ -196,3 +196,28 @@ fi
 FILES=`ls ${BASE}* | sed -e "/${BASE}.metrics/d" \
                         -e "/${BASE}\([0-9]*\).${GSSUFFIX}/d"`
 rm -f ${FILES} texput.log
+
+# The bitmap files can have large amounts of whitespace to the left and
+# right. This can be cropped if so desired.
+CROP=1
+
+which pnmcrop > /dev/null
+if [ $? -ne 0 ]; then
+       CROP=0
+fi
+
+# There's no point cropping the image if using PNG images. If you want to
+# crop, use PPM.
+# Apparently dvipng will support cropping at some stage in the future...
+if [ ${CROP} -eq 1 -a "${GSDEVICE}" = "pnmraw" ]; then
+       for FILE in ${BASE}*.${GSSUFFIX}
+       do
+               pnmcrop -left ${FILE} | pnmcrop -right ${FILE} > ${BASE}.tmp
+               if [ $? -eq 0 ]; then
+                       mv ${BASE}.tmp ${FILE}
+               else
+                       rm -f ${BASE}.tmp
+               fi
+       done
+       rm -f ${BASE}.tmp
+fi