0

如何在我的报告中添加自定义字体。当我生成 pdf 报告时,它不会改变我的字体。


@font-face {
font-family: 'CourierPrime-Regular';
src: local('CourierPrime-Regular'), local('CourierPrime-Regular'),
  url('/sales_invoice_report/static/src/fonts/CourierPrime-Regular.ttf') format('truetype');
 }

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="centaur_invoice_template" name="centaur_invoice" inherit_id="web.report_assets_pdf">
            <xpath expr="." position="inside">
                <link rel="stylesheet" href="/sales_invoice_report/static/src/css/sales_invoice.css" type="text/css"/>
            </xpath>
        </template>
    </data>
</odoo>
4

1 回答 1

2

已经解决了。我从谷歌字体导入字体。

<xpath expr="." position="inside">
    <link rel="preconnect" href="https://fonts.gstatic.com" />
    <link href="https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap" rel="stylesheet" />
</xpath>
于 2021-04-02T06:40:36.967 回答