【问题标题】:Python-Sphinx: setting text body fontPython-Sphinx:设置文本正文字体
【发布时间】:2019-01-30 05:04:29
【问题描述】:

我一直在尝试按照此示例在 Sphinx 文档中选择字体: https://developers.google.com/fonts/docs/getting_started

我正在使用“云”主题,并在我的 conf.py 文件中添加了以下行:

html_theme_options = { 
    "bodyfont": "PT Sans, sans-serif",
    "fontcssurl" : "//fonts.googleapis.com/css?family=PT+Sans|Noticia+Text|Open+Sans|Droid+Sans+Mono|Roboto",
}

此外,我尝试将以下内容放入我的 _static/style.css 文件中:

body {
  font-family: PT Sans, Roboto, Helvetica, sans-serif;
}

两者都不能帮助将“PT Sans”字体放置为文本。这是浏览器的问题吗?我怎么知道可以从可用的 google 列表中构建哪些字体?


【问题讨论】:

    标签: css fonts python-sphinx restructuredtext


    【解决方案1】:

    Cloud Sphinx theme documentation中,有一条说明:

    注意有许多选项可用于更改此主题使用的各种颜色和字体,这些选项仍未记录。完整列表可以在主题的配置文件 (/cloud_sptheme/themes/cloud/theme.conf) 中找到。

    这导致了这个sn-p。

    # font css url - for loading in fonts (eg google font dir)
    fontcssurl = //fonts.googleapis.com/css?family=Noticia+Text|Open+Sans|Droid+Sans+Mono
    

    尝试更改字体 URL 和conf.py 中 sn-p 上方的所有引用字体名称,看看是否可行。如果没有,那么您始终可以使用主题覆盖。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 1970-01-01
      • 2018-05-07
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多