2014-02-06 94 views
0

據瞭解,從以下網址wkhtmltopdf只使用ttf格式的字體。 use custom fonts with wkhtmltopdf Google Web Fonts and PDF generation from HTML with wkhtmltopdf字體沒有使用相同的字體系列名稱使用wkhtmltopdf

我的網站只使用WOFF,如此,是因爲我使用用戶樣式表添加TTF字體。我使用了許多谷歌字體,如氧氣,Inconsolata,Open Sans,merriweather等,在用戶樣式表中使用相同的字體系列名稱並正確渲染。 但問題在於字體的「Open Sans Condensed」和「排序磨」。當我試圖用別的東西來改變字體名稱時,它的正確渲染不完全是相同的名稱。 我想使用相同的名稱,並且不想更改變量名稱,因爲我想使用Web字體而不是本地字體。 第二件事是我不想將字體下載到我的系統並使用它,但只有網絡字體。 我使用userstylesheet的方法是這樣的

@font-face { 
font-family: 'Inconsolata'; 
font-style: normal; 
font-weight: 400; 
src: url('https://googlefontdirectory.googlecode.com/hg-history/829b7e77062a1a06dfc90c29f0f413e2a1de44fe/inconsolata/Inconsolata.ttf') format('truetype'); 

} 

@font-face { 
font-family: "sorts mill goudy"; 
font-style: normal; 
font-weight: 400; 
src: url('https://googlefontdirectory.googlecode.com/hg-history/73427626e72275f857e7fdfd29e0a5c52516fed5/sortsmillgoudy/SortsMillGoudy-Regular.ttf')  format('truetype'); 
/* 
src: url('https://bienvenidod-fonts.googlecode.com/hg-history/73427626e72275f857e7fdfd29e0a5c52516fed5/sortsmillgoudy/SortsMillGoudy-Regular.ttf')  format('truetype');*/ 
} 

@font-face { 
font-family: 'Sorts Mill Goudy'; 
font-style: italic; 
font-weight: 400; 
src: url('https://googlefontdirectory.googlecode.com/hg-history/73427626e72275f857e7fdfd29e0a5c52516fed5/sortsmillgoudy/SortsMillGoudy-Italic.ttf') format('truetype'); 
} 

@font-face { 
font-family: 'Merriweather'; 
font-style: normal; 
font-weight: 300; 
src: url('https://jenniferespencer-webfont.googlecode.com/hg-history/0ab6594f99d5904bb834e02e43d1d536c87f8622/merriweather/Merriweather-Light.ttf') format('truetype'); 
} 
@font-face { 
font-family: 'Merriweather'; 
font-style: normal; 
font-weight: 400; 
src: url('https://jenniferespencer-webfont.googlecode.com/hg-history/0ab6594f99d5904bb834e02e43d1d536c87f8622/merriweather/Merriweather-Regular.ttf') format('truetype'); 
} 
@font-face { 
font-family: 'Merriweather'; 
font-style: normal; 
font-weight: 700; 
src: url('https://jenniferespencer-webfont.googlecode.com/hg-history/0ab6594f99d5904bb834e02e43d1d536c87f8622/merriweather/Merriweather-Bold.ttf') format('truetype'); 
} 

@font-face { 
font-family: 'Open Sans Condensed'; 
font-style: normal; 
font-weight: 400; 
src: url('http://testinghtmltopdf.site40.net/fonts/OpenSans-CondLight.ttf') format('truetype'); 
} 


@font-face { 
font-family: 'Open Sans Condensed'; 
font-style: normal; 
font-weight: bold; 
src: url('http://testinghtmltopdf.site40.net/fonts/OpenSans-CondBold.ttf') format('truetype'); 
} 

@font-face { 
font-family: 'Open Sans Condensed'; 
font-style: italic; 
font-weight: 300; 
src: url('http://testinghtmltopdf.site40.net/fonts/OpenSans-CondLightItalic.ttf') format('truetype'); 
} 
@font-face { 
font-family: "open sans"; 
font-weight: 400; 
font-style: normal; 
    src:url('http://themes.googleusercontent.com/static/fonts/opensans/v7/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf') format('truetype'); 
} 


@font-face { 
font-family: "open sans"; 
font-weight: 700; 
font-style: normal; 
src:  url('http://themes.googleusercontent.com/static/fonts/opensans/v7/k3k702ZOKiLJc3WVjuplzInF5uFdDttMLvmWuJdhhgs.ttf') format('truetype'); 
} 

@font-face { 
font-family: "open sans"; 
font-weight: 700; 
font-style: italic; 
src:  url('http://themes.googleusercontent.com/static/fonts/opensans/v7/PRmiXeptR36kaC0GEAetxp_TkvowlIOtbR7ePgFOpF4.ttf') format('truetype'); 
} 


@font-face { 
font-family: "open sans"; 
font-weight: 800; 
font-style: italic; 
src:  url('http://themes.googleusercontent.com/static/fonts/opensans/v7/PRmiXeptR36kaC0GEAetxlDMrAYtoOisqqMDW9M_Mqc.ttf') format('truetype'); 
} 

而下面是我使用的源代碼在網站

@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700|Droid+Sans+Mono); 

@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800); 

@import url(http://fonts.googleapis.com/css?family=Bree+Serif); 

@import url(http://fonts.googleapis.com/css?family=Libre+Baskerville:400,700,400italic); 

@import url(http://fonts.googleapis.com/css?family=Philosopher:400,700,400italic,700italic|Droid+Sans+Mono|Roboto+Condensed:300italic,400italic,700italic,400,300,700|Roboto:400,100,300,100italic,300italic,400italic,500,500italic,700,700italic,900,900italic|EB+Garamond); 

@import url(http://fonts.googleapis.com/css?family=Inconsolata:400,700); 

@import url(http://fonts.googleapis.com/css?family=Dancing+Script:400,700); 

@import url(http://fonts.googleapis.com/css?family=Oxygen:400,300,700&subset=latin,latin-ext); 

@import url(http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic); 

@import url(http://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400,400italic); 

@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700); 

當我試圖改變從字體系列名稱的方式在用戶樣式表和源代碼中對'mill goudy sorts'進行'排序mill goudyy'。什麼可以是相同的字體家族名稱的問題?

回答

0

您可以嘗試使用支持WOFF字體的latest version (0.12)

+0

Ohh謝謝..他剛剛在4小時前發佈.. –

+0

我認爲這將是更有幫助的,如果這實際上會工作(如此測試自己),而不是隻發佈鏈接。儘管wkhtmltopdf的改進工作得到了很大的尊重和讚賞。 – user1914292

相關問題