gpt4 book ai didi

html - 如何在 Weasyprint 中指定回退到 Monospace

转载 作者:行者123 更新时间:2023-11-28 11:28:06 25 4
gpt4 key购买 nike

当在

 标签中呈现文本时,我如何指定 weasyprint 应该退回到使用等宽字体?

我正在使用 weasyprint 将 HTML 文档转换为 PDF。该文档有一些我用

 标记的文本。我为此文本指定了固定宽度的字体“Consolas”,但如果 Consolas 在系统上不可用,我想回退到通用的等宽字体。

但是,如果我在 CSS 中指定“monospace”,weasyprint 根本不会以等宽字体呈现文本。我怀疑这可能是一个错误,但想看看我是否没有正确执行此操作。

在下面的示例中,“一些代码文本”以比例字体呈现,而“一些文本代码”以固定宽度字体呈现。

<html>
<body>
<pre style="font-family: Consolas, monospace; font-size: 3em">
Some code text
</pre>
<pre style="font-family: Consolas; font-size: 3em">
Some text code
</pre>
</body>
</html>

最佳答案

在 GitHub 上回复:https://github.com/Kozea/WeasyPrint/issues/158

顺便说一下,我通常不会看 StackOverflow 上的 WeasyPrint 问题。写信给 WeasyPrint 的邮件列表或问题跟踪器将获得更多响应。

关于html - 如何在 Weasyprint 中指定回退到 Monospace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21271711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com