2012-02-01 13 views
5

Nell'applicazione my rails (2.x). Voglio usare caratteri personalizzati nella mia vista. In modo che ho aggiunto i file dei font in pubblico nella cartella dei caratteri. Quando provo a ottenere i caratteri nell'url o tramite l'applicazione, attraverso l'errore di routing. Immagino che le rotte dei binari non siano in grado di riconoscere il formato/file. Correggetemi se sbaglio e mi danno la soluzioneCome rendere Rails il percorso di risposta per i file di font (eot)?

codice CSS:

@font-face { 
    font-family: 'Effra'; 
    src: url('/fonts/effra_std_rg-webfont.eot'); 
    src: url('/fonts/effra_std_rg-webfont.eot?#iefix') format('embedded-opentype'), 
     url('/fonts/effra_std_rg-webfont.woff') format('woff'), 
     url('/fonts/effra_std_rg-webfont.ttf') format('truetype'), 
     url('/fonts/effra_std_rg-webfont.svg#EffraRegular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 

} 

Nota: ho in grado di ottenere WOFF, il file TTF digitando direttamente il percorso, ma non EOT file può.

Error trace: 
Unknown action 
No action responded to fonts. Actions: XXXXXXsomeactionsXXXXX and rescue_404 

Grazie in anticipo, Arun.

risposta

4

Ho risolto il problema precedente spostando la cartella dei font in public/stylesheets/fonts. e fatto il codice di cui sopra come di seguito.

font-face { 
    font-family: 'Effra'; 
    src: url('fonts/effra_std_rg-webfont.eot'); 
    src: url('fonts/effra_std_rg-webfont.eot?#iefix') format('embedded-opentype'), 
     url('fonts/effra_std_rg-webfont.woff') format('woff'), 
     url('fonts/effra_std_rg-webfont.ttf') format('truetype'), 
     url('fonts/effra_std_rg-webfont.svg#EffraRegular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

Spero che questo aiuti gli altri.

+0

Sto riscontrando un problema simile: i font non vengono serviti tramite la pipeline di asset localmente (il risultato è un 404 quando si tenta il percorso del font). Quanto sopra è una soluzione, ma mi piacerebbe sapere la correzione effettiva. – Geoff

Problemi correlati