From f7e9226902156d79459ad63b1a9a393a3b5da829 Mon Sep 17 00:00:00 2001 From: LiuHanCheng <2463765697@qq.com> Date: Mon, 4 Jun 2018 22:46:30 +0800 Subject: [PATCH] Try to fix chinese pdf problem (#587) --- CMakeLists.txt | 7 +------ CMakeModules/AsciidocHelpers.cmake | 9 +++++++++ CMakeModules/KiCadDocumentation.cmake | 8 ++++++++ xsl/dblatex-pdf-zh.xsl | 11 +++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 xsl/dblatex-pdf-zh.xsl diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c17bc5..2687809e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,7 @@ add_a2x_option( -f pdf ) # Add a2x options depending on which PDF generator we're using if( ${PDF_GENERATOR} MATCHES DBLATEX ) - # When the a2x target macro knows we're using dblatex, it adds in the - # --dblatex-opts command and uses the following options for that - add_dblatex_option( -P latex.output.revhistory=0 ) - add_dblatex_option( -P doc.publisher.show=0 ) - add_dblatex_option( -s ${PROJECT_SOURCE_DIR}/CMakeSupport/pdf-cover-dblatex.sty ) - + set_dblatex_common_options() find_package( DBLATEX REQUIRED ) endif() diff --git a/CMakeModules/AsciidocHelpers.cmake b/CMakeModules/AsciidocHelpers.cmake index dd61b70b..1474c87c 100644 --- a/CMakeModules/AsciidocHelpers.cmake +++ b/CMakeModules/AsciidocHelpers.cmake @@ -102,3 +102,12 @@ macro( add_fop_option ) list( APPEND FOP_OPTIONS ${OPT} ) endforeach() endmacro() + +# Set common dblatex options +macro(set_dblatex_common_options) + # When the a2x target macro knows we're using dblatex, it adds in the + # --dblatex-opts command and uses the following options for that + add_dblatex_option( -P latex.output.revhistory=0 ) + add_dblatex_option( -P doc.publisher.show=0 ) + add_dblatex_option( -s ${PROJECT_SOURCE_DIR}/CMakeSupport/pdf-cover-dblatex.sty ) +endmacro() diff --git a/CMakeModules/KiCadDocumentation.cmake b/CMakeModules/KiCadDocumentation.cmake index cd81068d..da5a5c40 100644 --- a/CMakeModules/KiCadDocumentation.cmake +++ b/CMakeModules/KiCadDocumentation.cmake @@ -124,9 +124,17 @@ macro( KiCadDocumentation DOCNAME ) # Non-ascii languages needs some special treatments if( "${LANGUAGE}" MATCHES "ja" ) + set(DBLATEX_OPTIONS "") + set_dblatex_common_options() add_dblatex_option( -b xetex -p ${CMAKE_CURRENT_SOURCE_DIR}/../../xsl/dblatex-pdf-ja.xsl ) elseif( "${LANGUAGE}" MATCHES "ru" ) + set(DBLATEX_OPTIONS "") + set_dblatex_common_options() add_dblatex_option( -b xetex -p ${CMAKE_CURRENT_SOURCE_DIR}/../../xsl/dblatex-pdf-ru.xsl ) + elseif( "${LANGUAGE}" MATCHES "zh" ) + set(DBLATEX_OPTIONS "") + set_dblatex_common_options() + add_dblatex_option( -b xetex -p ${CMAKE_CURRENT_SOURCE_DIR}/../../xsl/dblatex-pdf-zh.xsl ) endif() # Deal with chapters for all languages... diff --git a/xsl/dblatex-pdf-zh.xsl b/xsl/dblatex-pdf-zh.xsl new file mode 100644 index 00000000..0625cbdd --- /dev/null +++ b/xsl/dblatex-pdf-zh.xsl @@ -0,0 +1,11 @@ + + + + \usepackage{xeCJK} + + \def\baselinestretch{1.3} + + \usepackage{indentfirst} + + +