我一直在寻找错误或让dompdf与我的谷歌下载字体一起使用的方法,在这种情况下是“Roboto”,我不知道我还能做些什么来完成这项工作,我已经尝试创建robot-font.css
的链接路径,并尝试将所有这些代码粘贴到PDF刀片中的样式标记内:
<style>
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.svg#Roboto') format('svg');
font-weight: 100;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Thin';
src: url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Thin-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.svg#Roboto') format('svg');
font-weight: 100;
font-style: italic;
}
@font-face {
font-family: 'Roboto-ThinItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-ThinItalic-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.svg#Roboto') format('svg');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Light';
src: url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Light-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.svg#Roboto') format('svg');
font-weight: 300;
font-style: italic;
}
@font-face {
font-family: 'Roboto-LightItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-LightItalic-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.svg#Roboto') format('svg');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Regular';
src: url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Regular-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.svg#Roboto') format('svg');
font-weight: 400;
font-style: italic;
}
@font-face {
font-family: 'Roboto-RegularItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Italic-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.svg#Roboto') format('svg');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Medium';
src: url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Medium-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.svg#Roboto') format('svg');
font-weight: 500;
font-style: italic;
}
@font-face {
font-family: 'Roboto-MediumItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-MediumItalic-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.svg#Roboto') format('svg');
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Bold';
src: url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Bold-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.svg#Roboto') format('svg');
font-weight: 700;
font-style: italic;
}
@font-face {
font-family: 'Roboto-BoldItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-BoldItalic-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.svg#Roboto') format('svg');
font-weight: 900;
font-style: normal;
}
@font-face {
font-family: 'Roboto-Black';
src: url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-Black-webfont.svg#Roboto') format('svg');
}
@font-face {
font-family: 'Roboto';
src: url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.svg#Roboto') format('svg');
font-weight: 900;
font-style: italic;
}
@font-face {
font-family: 'Roboto-BlackItalic';
src: url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.eot');
src: url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.woff') format('woff'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.ttf') format('truetype'),
url('../../../public/vendor/poncho/fonts/Roboto-BlackItalic-webfont.svg#Roboto') format('svg');
}
</style>
如果我将PDF中的随机<p>
标记称为任何字体系列名称并应用一些重量或强烈或粗体标记,则显示具有适当重量的sans-serif,但不显示Roboto。
不幸的是,PDF字体对于这个项目非常重要。不能将其保留为sans-serif
。