我想通過@ font-face在QtWebkit中使用自定義字體,並且它只能在Windows上正常工作。QtWebkit渲染非標準字體,斜體和正常切換
這裏是我的代碼示例:
@font-face {
font-family: 'LatoBoldItalic';
src: url('../fonts/Lato-Italic.ttf') format('truetype');
font-style: italic;
font-weight: 400;
text-rendering: optimizeLegibility;
}
@font-face {
font-family: 'LatoItalic';
src: url('../fonts/Lato-Light-Italic.ttf') format('truetype');
font-style: italic;
font-weight: 300;
text-rendering: optimizeLegibility;
}
@font-face {
font-family: 'Lato';
src: url('../fonts/Lato-Light.ttf') format('truetype');
font-style: normal;
font-weight: 300;
text-rendering: optimizeLegibility;
}
@font-face {
font-family: 'LatoBold';
src: url('../fonts/Lato-Regular.ttf') format('truetype');
font-style: normal;
font-weight: 400;
text-rendering: optimizeLegibility;
}
body{
font-family: "Lato";
}
h1{
font-family: 'LatoBold';
}
h2{
font-family: 'LatoItalic';
}
所以,我的內容和H1應該是正常的拉託,只有我的斜體H2。
它可以在Mac Os上工作,但在Windows上可以打開斜體和普通字體。我嘗試了幾件事,通過刪除所有斜體字體(甚至從文件系統),但文本是以斜體呈現的樣式...
我也嘗試聲明只有一個拉託字體,併爲每個重量調用不同的.ttf和風格,但我有同樣的問題。
也嘗試從網站加載的拉託字體,同樣的問題。
我真的不明白這裏有什麼問題。
更多的信息,應該是有幫助的:
Windows 7的
的Qt 5.3.1
文件從文件系統加載的,不在線(文件:// .. ...)
謝謝:)
謝謝!它運作良好。我認爲它與Qt有關,因爲我在Windows上沒有Chrome問題。 – hereismass 2014-09-03 11:40:31
在我的Chrome中有這個問題(Windows 7 64bit)。祝你好運! – 2014-09-03 13:02:38