texlive[59084] Build/source/texk/dvipdfm-x: dvipdfmx: Support
commits+kakuto at tug.org
commits+kakuto at tug.org
Wed May 5 03:11:33 CEST 2021
Revision: 59084
http://tug.org/svn/texlive?view=revision&revision=59084
Author: kakuto
Date: 2021-05-05 03:11:33 +0200 (Wed, 05 May 2021)
Log Message:
-----------
dvipdfmx: Support non-ascii TMP and TEMP to call Ghostscript (w32 only)
Modified Paths:
--------------
trunk/Build/source/texk/dvipdfm-x/ChangeLog
trunk/Build/source/texk/dvipdfm-x/pdfximage.c
Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog 2021-05-04 23:49:25 UTC (rev 59083)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog 2021-05-05 01:11:33 UTC (rev 59084)
@@ -1,3 +1,8 @@
+2021-05-05 Akira Kakuto <kakuto at w32tex.org>
+
+ * pdfximage.c: Support non-ascii TMP and TEMP to call
+ Ghostscript.
+
2021-04-17 Akira Kakuto <kakuto at w32tex.org>
* pkfont.c: Remove all changes in 2020-12-14 and recover the
Modified: trunk/Build/source/texk/dvipdfm-x/pdfximage.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfximage.c 2021-05-04 23:49:25 UTC (rev 59083)
+++ trunk/Build/source/texk/dvipdfm-x/pdfximage.c 2021-05-05 01:11:33 UTC (rev 59084)
@@ -1092,7 +1092,11 @@
FILE *fp;
int error = 0;
struct stat stat_o, stat_t;
-
+#if defined(_WIN32)
+ char *utf8temp;
+ wchar_t *wtemp;
+ char *ftest;
+#endif
if (!distiller_template) {
WARN("No image converter available for converting file \"%s\" to PDF format.", filename);
WARN(">> Please check if you have 'D' option in config file.");
@@ -1118,8 +1122,8 @@
#endif
#if defined(_WIN32)
-/* temp is always ASCII only. So fsyscp_stat() is not necessary for
- * temp. However, filename can be non-ASCII UTF-8.
+/* temp is always win32_codepage only. So fsyscp_stat() is not
+ * necessary for temp. However, filename can be non-ASCII UTF-8.
*/
if (dpx_conf.file.keep_cache != -1 &&
stat(temp, &stat_t)==0 &&
@@ -1142,8 +1146,27 @@
MESG("pdf_image>> %s\n", distiller_template);
MESG("pdf_image>> ...");
}
+
+/* Support non-ascii TEMP and TMP on Windows to call Ghostscript */
+#if defined(_WIN32)
+ ftest = dpx_find_file(filename, "_pic_", "");
+ if (ftest) {
+ wtemp = get_wstring_from_mbstring(win32_codepage,
+ temp, wtemp = NULL);
+ utf8temp = get_mbstring_from_wstring(file_system_codepage,
+ wtemp, utf8temp = NULL);
+ error = dpx_file_apply_filter(distiller_template, filename,
+ utf8temp, pdf_get_version());
+ } else {
+ utf8name_failed = 1;
+ error = dpx_file_apply_filter(distiller_template, filename,
+ temp, pdf_get_version());
+ utf8name_failed = 0;
+ }
+#else
error = dpx_file_apply_filter(distiller_template, filename, temp,
pdf_get_version());
+#endif
if (error) {
WARN("Image format conversion for \"%s\" failed...", filename);
dpx_delete_temp_file(temp, true);
@@ -1150,8 +1173,12 @@
return error;
}
}
-
+#if defined(_WIN32)
+/* Use a simple fopen() since temp is in win32_codepage */
+ fp = fopen(temp, FOPEN_RBIN_MODE);
+#else
fp = MFOPEN(temp, FOPEN_RBIN_MODE);
+#endif
if (!fp) {
WARN("Could not open conversion result \"%s\" for image \"%s\". Why?", temp, filename);
dpx_delete_temp_file(temp, true);
@@ -1162,7 +1189,13 @@
MFCLOSE(fp);
/* See pdf_close_images for why we cannot delete temporary files here. */
-
+#if defined(_WIN32)
+ if (ftest) {
+ RELEASE(utf8temp);
+ RELEASE(wtemp);
+ RELEASE(ftest);
+ }
+#endif
RELEASE(temp);
if (error) {
More information about the tex-live-commits
mailing list.