报告 Odoo 14 的自定义字体
Custom font for reports Odoo 14
如何在我的报告中添加自定义字体。当我生成 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>
已经解决。我从 Google font.
导入字体
<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>
如何在我的报告中添加自定义字体。当我生成 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>
已经解决。我从 Google font.
导入字体<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>