Date: Wed, 1 Mar 2006 02:06:07 GMT From: Intron <intron@intron.ac> To: freebsd-gnats-submit@FreeBSD.org Subject: docs/93965: Generate PNG image embedded RTF with the new port chinese/docproj Message-ID: <200603010206.k21267wH064951@www.freebsd.org> Resent-Message-ID: <200603010210.k212A3FA011560@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 93965 >Category: docs >Synopsis: Generate PNG image embedded RTF with the new port chinese/docproj >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Wed Mar 01 02:10:02 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Intron >Release: 7.0-CURRENT >Organization: China >Environment: FreeBSD 7.0-CURRENT >Description: I have tested my patch and the new tool "fixrtf" for Chinese, English, French and German "FreeBSD Handbook", and they are all right in OpenOffice 2.0. What's in my patch for doc/share/mk/doc.docbook.mk: 1. Let Jade/OpenJade find all PNG images("SGMLFLAGS+= -D ...") so that Jade/OpenJade can generate correct links to PNG images in RTF. This is a key premise to generate PNG embedded RTF. 2. Let the format "rtf.tar" retire. See comments of revision 1.115 on http://www.freebsd.org/cgi/cvsweb.cgi/doc/share/mk/doc.docbook.mk 3. Induct a new tool "fixrtf" from the port chinese/docproj, setting its parameters. 4. Rename RTF directly generated by Jade/OpenJade as ${DOC}.rtf-nopng. Add ${DOC}.rtf-nopng into ${CLEANFILE}, execute "fixrtf" to convert no PNG embedded RTF generated by Jade/OpenJade (${DOC}.rtf-nopng) into PNG embedded RTF (${DOC}.rtf). Additional fixes: 1. A more precise expression than my previous ("GEN_INDEX_SGML_CMD?= ...") 2. The third pass of PDFJadeTeX for oriental languages probably returns with exit code 1, but the product is already somewhat acceptable. ("-${PDFJADETEX_CMD} ...") >How-To-Repeat: >Fix: --- doc.docbook.mk.orig Wed Mar 1 06:32:52 2006 +++ doc.docbook.mk Wed Mar 1 09:04:06 2006 @@ -180,12 +180,12 @@ CATALOGS+= -c ${c} .endif .endfor -SGMLFLAGS+= -D ${CANONICALOBJDIR} +SGMLFLAGS+= -D ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} -D ${CANONICALOBJDIR} JADEOPTS= ${JADEFLAGS} ${SGMLFLAGS} ${CATALOGS} XSLTPROCOPTS= ${XSLTPROCFLAGS} KNOWN_FORMATS= html html.tar html-split html-split.tar \ - txt rtf rtf.tar ps pdf tex dvi tar pdb + txt rtf ps pdf tex dvi tar pdb CSS_SHEET?= ${DOC_PREFIX}/share/misc/docbook.css PDFTEX_DEF?= ${DOC_PREFIX}/share/web2c/pdftex.def @@ -265,6 +265,25 @@ .endif DVIPSOPTS+= ${DVIPSFLAGS} +# FixRTF is now available from the Ports Collection (chinese/docproj), it +# is able to fix RTF: +# +# 1. Embed PNGs into RTF. (Option: -p) +# 2. Embed FreeBSD-specific information into RTF, such as organization name, +# building time. But unfortunately, so far only Microsoft Word can read +# them. In contrast, Microsoft Word Viewer and OpenOffice even cannot read +# this kind of information from RTF created by Microsoft Word and +# OpenOffice. (Option: -i) +# 3. Do some locale-specific fixing. (Option: -e <encoding>) +# +# This is a transitional solution before Jade/OpenJade provides these features. +# +FIXRTF?= ${PREFIX}/bin/fixrtf +FIXRTFOPTS?= -i -p +.if defined(SP_ENCODING) +FIXRTFOPTS+= -e ${SP_ENCODING} +.endif + GZIP?= -9 GZIP_CMD?= gzip -qf ${GZIP} BZIP2?= -9 @@ -354,6 +373,9 @@ .elif ${_cf} == "dvi" CLEANFILES+= ${DOC}.aux ${DOC}.log ${DOC}.out ${DOC}.tex +.elif ${_cf} == "rtf" +CLEANFILES+= ${DOC}.rtf-nopng + .elif ${_cf} == "tex" CLEANFILES+= ${DOC}.aux ${DOC}.log @@ -442,7 +464,7 @@ INIT_INDEX_SGML_CMD?= ${PERL} ${COLLATEINDEX} -i doc-index -N -o ${INDEX_SGML} GEN_INDEX_SGML_CMD?= ${PERL} ${COLLATEINDEX} -i doc-index -g -o ${INDEX_SGML} ${.ALLSRC:M*.index} .else -GEN_INDEX_SGML_CMD?= @${ECHO} "No index to generate." +GEN_INDEX_SGML_CMD?= @${ECHO} "Index is disabled or no index to generate." .endif .MAIN: all @@ -572,14 +594,8 @@ ${LOCAL_IMAGES_TXT} ${LOCAL_IMAGES_PNG} ${GEN_INDEX_SGML_CMD} ${JADE_CMD} -V rtf-backend ${PRINTOPTS} -ioutput.rtf.images \ - ${JADEOPTS} -t rtf -o ${.TARGET} ${MASTERDOC} - -${DOC}.rtf.tar: ${DOC}.rtf ${LOCAL_IMAGES_PNG} - ${TAR} cf ${.TARGET} ${DOC}.rtf ${IMAGES_PNG:N*share*} -.for _curimage in ${IMAGES_PNG:M*share*} - ${TAR} rf ${.TARGET} -C ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T} \ - ${_curimage:S|${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T}/||} -.endfor + ${JADEOPTS} -t rtf -o ${.TARGET}-nopng ${MASTERDOC} + ${FIXRTF} ${FIXRTFOPTS} < ${.TARGET}-nopng > ${.TARGET} # # This sucks, but there's no way round it. The PS and PDF formats need @@ -630,13 +646,14 @@ @${ECHO} "==> PDFTeX pass 2/3" -${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}' @${ECHO} "==> PDFTeX pass 3/3" - ${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}' + -${PDFJADETEX_CMD} '${TEX_CMDSEQ} \nonstopmode\input{${DOC}.tex-pdf}' .endif ${DOC}.ps: ${DOC}.dvi ${DVIPS} ${DVIPSOPTS} -o ${.TARGET} ${.ALLSRC} .else -${DOC}.rtf ${DOC}.rtf.tar ${DOC}.tex \ +# NO_TEX +${DOC}.rtf ${DOC}.tex \ ${DOC}.tex-ps ${DOC}.dvi ${DOC}.ps: ${TOUCH} ${.TARGET} .if !target(${DOC}.pdf) @@ -895,19 +912,6 @@ .endfor .elif ${_cf} == "pdb" ${LN} -f ${DESTDIR}/${.ALLSRC} ${DESTDIR}/${.CURDIR:T}.${_curformat} - -.elif ${_cf} == "rtf" -.for _curimage in ${IMAGES_PNG:M*/*:M*share*} - ${MKDIR} -p ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||} - ${INSTALL_DOCS} ${_curimage} ${DESTDIR:H:H}/${_curimage:H:S|${IMAGES_EN_DIR}/||:S|${.CURDIR}||} -.endfor -.for _curimage in ${IMAGES_PNG:M*/*:N*share*} - ${MKDIR} -p ${DESTDIR}/${_curimage:H} - ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage:H} -.endfor -.for _curimage in ${IMAGES_PNG:N*/*} - ${INSTALL_DOCS} ${_curimage} ${DESTDIR}/${_curimage} -.endfor .endif .if ${_cf} == "html-split" >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603010206.k21267wH064951>