EMF support

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@115 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-07-22 09:31:21 +00:00
parent 2483bd1bba
commit 81d548ec11
5 changed files with 21 additions and 13 deletions

View file

@ -2,6 +2,8 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.8 ---------- ---------- version 1.1.8 ----------
[all] Added support for images in EMF format (Enhanced Windows Meta Files)
[w2l] Bugfix: No longer decodes URLs in links (hyperref.sty has no problem with sequences like %E4) [w2l] Bugfix: No longer decodes URLs in links (hyperref.sty has no problem with sequences like %E4)
[w2x] EPUB bugfix: The meta data editor now shows the correct default creator (not the original creator) [w2x] EPUB bugfix: The meta data editor now shows the correct default creator (not the original creator)

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2010 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2010-10-27) * Version 1.2 (2011-07-22)
*/ */
@ -77,7 +77,8 @@ public class GraphicConverterImpl1 implements GraphicConverter {
if (bCrop || bResize) { return false; } if (bCrop || bResize) { return false; }
// We can convert vector formats to eps: // We can convert vector formats to eps:
if (MIMETypes.EPS.equals(sTargetMime) && (MIMETypes.WMF.equals(sSourceMime) || MIMETypes.SVM.equals(sSourceMime))) { if (MIMETypes.EPS.equals(sTargetMime) &&
(MIMETypes.EMF.equals(sSourceMime) || MIMETypes.WMF.equals(sSourceMime) || MIMETypes.SVM.equals(sSourceMime))) {
return true; return true;
} }
@ -85,8 +86,8 @@ public class GraphicConverterImpl1 implements GraphicConverter {
boolean bSupportsSource = boolean bSupportsSource =
MIMETypes.PNG.equals(sSourceMime) || MIMETypes.JPEG.equals(sSourceMime) || MIMETypes.PNG.equals(sSourceMime) || MIMETypes.JPEG.equals(sSourceMime) ||
MIMETypes.GIF.equals(sSourceMime) || MIMETypes.TIFF.equals(sSourceMime) || MIMETypes.GIF.equals(sSourceMime) || MIMETypes.TIFF.equals(sSourceMime) ||
MIMETypes.BMP.equals(sSourceMime) || MIMETypes.WMF.equals(sSourceMime) || MIMETypes.BMP.equals(sSourceMime) || MIMETypes.EMF.equals(sSourceMime) ||
MIMETypes.SVM.equals(sSourceMime); MIMETypes.WMF.equals(sSourceMime) || MIMETypes.SVM.equals(sSourceMime);
boolean bSupportsTarget = boolean bSupportsTarget =
MIMETypes.PNG.equals(sTargetMime) || MIMETypes.JPEG.equals(sTargetMime) || MIMETypes.PNG.equals(sTargetMime) || MIMETypes.JPEG.equals(sTargetMime) ||
MIMETypes.GIF.equals(sTargetMime) || MIMETypes.TIFF.equals(sTargetMime) || MIMETypes.GIF.equals(sTargetMime) || MIMETypes.TIFF.equals(sTargetMime) ||
@ -99,7 +100,7 @@ public class GraphicConverterImpl1 implements GraphicConverter {
// It seems that the GraphicProvider can only create proper eps if // It seems that the GraphicProvider can only create proper eps if
// the source is a vector format, hence // the source is a vector format, hence
if (MIMETypes.EPS.equals(sTargetMime)) { if (MIMETypes.EPS.equals(sTargetMime)) {
if (!MIMETypes.WMF.equals(sSourceMime) && !MIMETypes.SVM.equals(sSourceMime)) { if (!MIMETypes.EMF.equals(sSourceMime) && !MIMETypes.WMF.equals(sSourceMime) && !MIMETypes.SVM.equals(sSourceMime)) {
return null; return null;
} }
} }

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-07-20) * Version 1.2 (2011-07-22)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.8"; private static final String VERSION = "1.1.8";
private static final String DATE = "2011-07-20"; private static final String DATE = "2011-07-22";
/** Return the Writer2LaTeX version in the form /** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/> * (major version).(minor version).(patch level)<br/>

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2010 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2010-03-29) * Version 1.2 (2011-07-22)
* *
*/ */
@ -37,6 +37,7 @@ public class MIMETypes {
public static final String GIF="image/gif"; public static final String GIF="image/gif";
public static final String TIFF="image/tiff"; public static final String TIFF="image/tiff";
public static final String BMP="image/bmp"; public static final String BMP="image/bmp";
public static final String EMF="image/x-emf";
public static final String WMF="image/x-wmf"; public static final String WMF="image/x-wmf";
public static final String EPS="image/x-eps"; public static final String EPS="image/x-eps";
// MIME type for SVM has changed // MIME type for SVM has changed

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2008 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.0 (2008-11-24) * Version 1.2 (2011-07-22)
* *
*/ */
@ -54,6 +54,7 @@ public final class MIMETypes extends writer2latex.api.MIMETypes {
public static final byte[] GIF89_SIG = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // GIF89a public static final byte[] GIF89_SIG = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // GIF89a
public static final byte[] TIFF_SIG = { 0x49, 0x49, 0x2A }; // II* public static final byte[] TIFF_SIG = { 0x49, 0x49, 0x2A }; // II*
public static final byte[] BMP_SIG = { 0x42, 0x4d }; // BM public static final byte[] BMP_SIG = { 0x42, 0x4d }; // BM
public static final byte[] EMF_SIG = { 1, 0, 0, 0 };
public static final byte[] WMF_SIG = { (byte) 0xd7, (byte) 0xcd, (byte) 0xc6, (byte) 0x9a }; public static final byte[] WMF_SIG = { (byte) 0xd7, (byte) 0xcd, (byte) 0xc6, (byte) 0x9a };
public static final byte[] WMF30_SIG = { 1, 0, 9, 0 }; // Old WMF format, not reliable - see below public static final byte[] WMF30_SIG = { 1, 0, 9, 0 }; // Old WMF format, not reliable - see below
public static final byte[] EPS_SIG = { 0x25, 0x21 }; // %! public static final byte[] EPS_SIG = { 0x25, 0x21 }; // %!
@ -72,6 +73,7 @@ public final class MIMETypes extends writer2latex.api.MIMETypes {
public static final String GIF_EXT = ".gif"; public static final String GIF_EXT = ".gif";
public static final String TIFF_EXT = ".tif"; public static final String TIFF_EXT = ".tif";
public static final String BMP_EXT = ".bmp"; public static final String BMP_EXT = ".bmp";
public static final String EMF_EXT = ".emf";
public static final String WMF_EXT = ".wmf"; public static final String WMF_EXT = ".wmf";
public static final String EPS_EXT = ".eps"; public static final String EPS_EXT = ".eps";
public static final String SVM_EXT = ".svm"; public static final String SVM_EXT = ".svm";
@ -92,6 +94,7 @@ public final class MIMETypes extends writer2latex.api.MIMETypes {
if (isType(blob,GIF89_SIG)) { return GIF; } if (isType(blob,GIF89_SIG)) { return GIF; }
if (isType(blob,TIFF_SIG)) { return TIFF; } if (isType(blob,TIFF_SIG)) { return TIFF; }
if (isType(blob,BMP_SIG)) { return BMP; } if (isType(blob,BMP_SIG)) { return BMP; }
if (isType(blob,EMF_SIG)) { return EMF; }
if (isType(blob,WMF_SIG)) { return WMF; } if (isType(blob,WMF_SIG)) { return WMF; }
if (isType(blob,WMF30_SIG)) { return WMF; } // do not trust this.. if (isType(blob,WMF30_SIG)) { return WMF; } // do not trust this..
if (isType(blob,EPS_SIG)) { return EPS; } if (isType(blob,EPS_SIG)) { return EPS; }
@ -106,6 +109,7 @@ public final class MIMETypes extends writer2latex.api.MIMETypes {
if (GIF.equals(sMIME)) { return GIF_EXT; } if (GIF.equals(sMIME)) { return GIF_EXT; }
if (TIFF.equals(sMIME)) { return TIFF_EXT; } if (TIFF.equals(sMIME)) { return TIFF_EXT; }
if (BMP.equals(sMIME)) { return BMP_EXT; } if (BMP.equals(sMIME)) { return BMP_EXT; }
if (EMF.equals(sMIME)) { return EMF_EXT; }
if (WMF.equals(sMIME)) { return WMF_EXT; } if (WMF.equals(sMIME)) { return WMF_EXT; }
if (EPS.equals(sMIME)) { return EPS_EXT; } if (EPS.equals(sMIME)) { return EPS_EXT; }
if (SVM.equals(sMIME)) { return SVM_EXT; } if (SVM.equals(sMIME)) { return SVM_EXT; }
@ -119,7 +123,7 @@ public final class MIMETypes extends writer2latex.api.MIMETypes {
} }
public static boolean isVectorFormat(String sMIME) { public static boolean isVectorFormat(String sMIME) {
return WMF.equals(sMIME) || EPS.equals(sMIME) || SVM.equals(sMIME) || PDF.equals(sMIME); return EMF.equals(sMIME) || WMF.equals(sMIME) || EPS.equals(sMIME) || SVM.equals(sMIME) || PDF.equals(sMIME);
} }