【问题标题】:Broken text in pdf with sphinx-build使用 sphinx-build 破坏 pdf 中的文本
【发布时间】:2020-01-07 12:11:43
【问题描述】:

我在 Mac (Mojave 10.14.1) 上使用 sphinx-build (Sphinx v1.6.3) 生成不同语言的 PDF。

所有语言都可以,但波兰语给了我破碎的字符:

它们的原始文本存储为 *.rst 文件(德语),然后我将它们翻译成 *.po 文件。

一个不起作用的示例词是: 特雷希奇

这是相应的采购订单文件:

# SOME DESCRIPTIVE TITLE.
# Copyright (C) Beat Gurtner
# This file is distributed under the same license as the Dokumentation des
# Sakkadentrainers package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
#
msgid ""
msgstr ""
"Project-Id-Version: Dokumentation des Sakkadentrainers\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-07-26 14:43+0200\n"
"PO-Revision-Date: 2019-12-29 17:38+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"X-Poedit-SourceCharset: UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.4.0\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pl\n"
"X-Generator: Poedit 2.2.4\n"

#: ../../index.rst:7
msgid "Willkommen zur Dokumentation des Sakkadentrainers"
msgstr "Witamy w dokumentacji Sakkadycznytrener"

#: ../../index.rst:9
msgid "`Zurück zum Training <https://www.sakkadentrainer.ch>`_"
msgstr "`Powrót do treningu <https://www.sakkadentrainer.ch>`_"

#: ../../index.rst:11
msgid "Inhalt:"
msgstr "Treść:"

生成PDF的命令是:

sphinx-build -t pl -D language=pl -b pdf /Applications/MAMP/htdocs/sakkadentrainer/doc/ /Applications/MAMP/htdocs/sakkadentrainer_medical_doc/pdf/pl/

感谢任何帮助

【问题讨论】:

    标签: macos pdf encoding python-sphinx rst2pdf


    【解决方案1】:

    这就是解决方案。将其放入您的 conf.py 文件中。

    问题是你需要一个支持特殊字符的字体。

    pdf_stylesheets = ['sphinx','kerning','a4']
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-16
      • 2019-08-08
      • 2016-02-26
      • 2019-05-05
      • 2013-10-17
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      相关资源
      最近更新 更多