Serve header font
This commit is contained in:
parent
53c4ff1b5c
commit
51fe78abce
4 changed files with 22 additions and 3 deletions
BIN
assets/amatic-sc-v9-latin-regular.woff
Normal file
BIN
assets/amatic-sc-v9-latin-regular.woff
Normal file
Binary file not shown.
|
@ -1,3 +1,11 @@
|
|||
@font-face {
|
||||
font-family: 'Amatic SC';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Amatic SC Regular'), local('AmaticSC-Regular'),
|
||||
url('amatic-sc-v9-latin-regular.woff') format('woff');
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: "Apple Garamond", "Baskerville",
|
||||
"Times New Roman", "Droid Serif", "Times",
|
||||
|
@ -5,7 +13,7 @@ html {
|
|||
}
|
||||
|
||||
h1 {
|
||||
font-family: 'Amatic SC', cursive;
|
||||
font-family: 'Amatic SC', sans-serif;
|
||||
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
|
13
src/site.rs
13
src/site.rs
|
@ -6,7 +6,7 @@ use std::fmt;
|
|||
|
||||
use futures::{self, Future};
|
||||
use hyper;
|
||||
use hyper::header::ContentType;
|
||||
use hyper::header::{ContentType, ContentLength, CacheControl, CacheDirective};
|
||||
use hyper::mime;
|
||||
use hyper::server::*;
|
||||
use serde_json;
|
||||
|
@ -82,6 +82,11 @@ struct StyleCss;
|
|||
#[mime = "application/javascript"]
|
||||
struct ScriptJs;
|
||||
|
||||
#[derive(StaticResource)]
|
||||
#[filename = "assets/amatic-sc-v9-latin-regular.woff"]
|
||||
#[mime = "application/font-woff"]
|
||||
struct AmaticFont;
|
||||
|
||||
struct WikiLookup {
|
||||
state: State,
|
||||
lookup_map: HashMap<String, Box<Fn() -> Box<Resource + Sync + Send>>>,
|
||||
|
@ -103,6 +108,12 @@ impl WikiLookup {
|
|||
as Box<Fn() -> Box<Resource + Sync + Send>>
|
||||
);
|
||||
|
||||
lookup_map.insert(
|
||||
format!("/_assets/amatic-sc-v9-latin-regular.woff"),
|
||||
Box::new(|| Box::new(AmaticFont) as Box<Resource + Sync + Send>)
|
||||
as Box<Fn() -> Box<Resource + Sync + Send>>
|
||||
);
|
||||
|
||||
WikiLookup { state, lookup_map }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>{{title}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Amatic+SC" rel="stylesheet">
|
||||
<link rel=preload href="_assets/amatic-sc-v9-latin-regular.woff" as=font crossorigin>
|
||||
<link href="_assets/style-{{style_css_checksum}}.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in a new issue