Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Try to fix chinese pdf problem (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuHanCheng authored and Marco Ciampa committed Jun 4, 2018
1 parent 98ad1da commit f7e9226
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
9 changes: 9 additions & 0 deletions CMakeModules/AsciidocHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 8 additions & 0 deletions CMakeModules/KiCadDocumentation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
11 changes: 11 additions & 0 deletions xsl/dblatex-pdf-zh.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:param name="xetex.font">
<xsl:text>\usepackage{xeCJK}
</xsl:text>
<xsl:text>\def\baselinestretch{1.3}
</xsl:text>
<xsl:text>\usepackage{indentfirst}
</xsl:text>
</xsl:param>
</xsl:stylesheet>

0 comments on commit f7e9226

Please sign in to comment.