Skip to content

Commit

Permalink
Added special HTTP header for IE to use fonts from a repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Finesse committed Aug 15, 2017
1 parent 1a902f8 commit 9e0f7aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ chmod 777 logs
Make the directory `public` be the document root of the web server.
Or just open [http://localhost/public](http://localhost/public) if you installed the repository to the web server root.

Make all the requests to not-existing files be handled by `public/index.php`.
If you use Apache, you don't have to do it, `public/.htaccess` does it for you.
##### 3.1 Not Apache server

Do it if your web server is not Apache.

Make all the requests to not-existing files be handled by `public/index.php`.

Make the server add the `Access-Control-Allow-Origin: *` HTTP-header to the font files.
Otherwise some browsers will reject using fonts from the repository.
Use can do it using [this instruction](https://davidwalsh.name/cdn-fonts).

### Setup

Expand Down Expand Up @@ -116,7 +123,7 @@ Add a `<link>` tag to the HTML code of the page on which you want to embed a fon
<link rel="stylesheet" href="http://web-fonts-repository.local/css?family=Open+Sans:400,400i,700,700i|Roboto:300,400" />
```

Where `http://web-fonts-repository.local` is the root URL of a web fonts repository.
Where `http://web-fonts-repository.local` is the root URL of the installed web fonts repository.

The required fonts are specified the same way as on Google Fonts. Font families are divided by `|`, families styles
are divided by `,`, family name is separated from styles list using `:`.
Expand Down
5 changes: 5 additions & 0 deletions public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

# Some browsers require the special header
<FilesMatch "\.(woff|woff2|ttf|eot|svg)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

0 comments on commit 9e0f7aa

Please sign in to comment.