snipt

Ctrl+h for KB shortcuts

Bash

Fix Firefox @font-face cross-domain restriction in Nginx

1
2
3
4
5
6
7
8
server {
    ...
    # Fix @font-face cross-domain restriction in Firefox
	location ~* \.(eot|ttf|woff)$ {
	    add_header Access-Control-Allow-Origin *;
	}
    ...
}
https://snipt.net/embed/171fd3aa59385b7082eab9600721a24e/
/raw/171fd3aa59385b7082eab9600721a24e/
171fd3aa59385b7082eab9600721a24e
bash
Bash
8
2019-07-16T14:04:42
True
False
False
/api/public/snipt/40414/
fix-firefox-font-face-cross-domain-restriction-in-nginx
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>server <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> ... </span><span id="L-3"><a name="L-3"></a> <span class="c1"># Fix @font-face cross-domain restriction in Firefox</span> </span><span id="L-4"><a name="L-4"></a> location ~* <span class="se">\.</span><span class="o">(</span>eot<span class="p">|</span>ttf<span class="p">|</span>woff<span class="o">)</span>$ <span class="o">{</span> </span><span id="L-5"><a name="L-5"></a> add_header Access-Control-Allow-Origin *<span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="o">}</span> </span><span id="L-7"><a name="L-7"></a> ... </span><span id="L-8"><a name="L-8"></a><span class="o">}</span> </span></pre></div> </td></tr></table>
@font-face, cross-domain, firefox, nginx

CSS

Anti-alias text

text-shadow: rgba(0,0,0,.01) 0 0 1px;
https://snipt.net/embed/7164d77351b69a245dacfa691d08832a/
/raw/7164d77351b69a245dacfa691d08832a/
7164d77351b69a245dacfa691d08832a
css
CSS
1
2019-07-10T04:26:00
True
False
False
/api/public/snipt/17097/
anti-alias-text
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">text-shadow</span><span class="o">:</span> <span class="nt">rgba</span><span class="o">(</span><span class="nt">0</span><span class="o">,</span><span class="nt">0</span><span class="o">,</span><span class="nt">0</span><span class="o">,</span><span class="nc">.01</span><span class="o">)</span> <span class="nt">0</span> <span class="nt">0</span> <span class="nt">1px</span><span class="o">;</span> </span></pre></div> </td></tr></table>
@font-face, css, typography

Bash

Compress font files for use with @font-face

1
2
3
4
5
6
# Compress font files for use with @font-face
Addtype font/opentype .otf
Addtype font/truetype .ttf
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css font/opentype font/truetype

# Comments: Both these declarations require their appropriate modules to be active: mod_mime and mod_deflate. And for best practice, the AddType declaration should be in the mime.conf file, and the AddOutputFilterByType declaration should be in the deflate.conf file. See your particular distribution's help files for enabling and configuring Apache modules.
https://snipt.net/embed/c84599fafe2526ca8e7e05460b94827d/
/raw/c84599fafe2526ca8e7e05460b94827d/
c84599fafe2526ca8e7e05460b94827d
bash
Bash
6
2019-07-01T17:47:33
True
False
False
/api/public/snipt/9204/
compress-font-files-for-use-with-font-face
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Compress font files for use with @font-face</span> </span><span id="L-2"><a name="L-2"></a>Addtype font/opentype .otf </span><span id="L-3"><a name="L-3"></a>Addtype font/truetype .ttf </span><span id="L-4"><a name="L-4"></a>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css font/opentype font/truetype </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1"># Comments: Both these declarations require their appropriate modules to be active: mod_mime and mod_deflate. And for best practice, the AddType declaration should be in the mime.conf file, and the AddOutputFilterByType declaration should be in the deflate.conf file. See your particular distribution&#39;s help files for enabling and configuring Apache modules.</span> </span></pre></div> </td></tr></table>
@font-face, compress, fonts, gzip, htaccess