From: Angus Leeming Date: Fri, 18 Oct 2002 12:17:38 +0000 (+0000) Subject: Use pnmcrop to crop the previews X-Git-Tag: 1.6.10~18149 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=279ea68a2adc2934f939aa854edb17809aa59df6;p=features.git Use pnmcrop to crop the previews 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 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 4c6e8b097e..14607b25aa 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2002-10-18 Angus Leeming + + * scripts/lyxpreview2bitmap.sh: Use pnmcrop to crop the images + if so desired. + 2002-10-16 Jean-Marc Lasgouttes * configure.m4: add mozilla as default previewer for html diff --git a/lib/scripts/lyxpreview2bitmap.sh b/lib/scripts/lyxpreview2bitmap.sh index 6e338fe33d..9744f16877 100644 --- a/lib/scripts/lyxpreview2bitmap.sh +++ b/lib/scripts/lyxpreview2bitmap.sh @@ -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