I'm trying to use a Custom Font in my Phoenix Application. I've placed them in the priv/static/fonts
directory, and properly created and loaded the css file in web/templates/layout/app.html.eex
template but they're not being served by the Phoenix Server.
/Users/Psycho/code/elixir/my_app/
▾ priv/
▸ repo/
▾ static/
▸ css/
▾ fonts/
▾ walsheim/
gt-walsheim-light-web.svg
gt-walsheim-light-web.eot
gt-walsheim-light-web.ttf
gt-walsheim-light-web.woff
The css file for sourcing the font:
// my_app/priv/css/fonts.css
@font-face {
font-family: "Walsheim";
font-style: normal;
font-weight: 300;
src:
url("/fonts/walsheim/gt-walsheim-light-web.eot?#iefix") format("embedded-opentype"),
url("/fonts/walsheim/gt-walsheim-light-web.woff") format("woff"),
url("/fonts/walsheim/gt-walsheim-light-web.ttf") format("truetype"),
url("/fonts/walsheim/gt-walsheim-light-web.svg#Walsheim") format("svg");
}
Available Fonts To find the full list of custom fonts available for use in Power Apps there are a couple of techniques you can use. The fastest way is to search for 'Font Settings' in your Windows search bar. This will open up the Fonts menu. You can try any font name from this list to see if it works.
Use Any Font For Your Shopify StoreWith Fontify, you can use any font - both Google and Custom fonts! If you want to use customized fonts, just upload the font file and our app will do everything else. Our app will import any font you uploaded and process it to make it work in your store.
To add a font file to your Xcode project, select File > Add Files to “Your Project Name” from the menu bar, or drag the file from Finder and drop it into your Xcode project. You can add True Type Font (. ttf) and Open Type Font (. otf) files.
Okay, found the solution.
It looks like you have to tell phoenix
which directories to serve for static files. I went in to my my_app/lib/my_app/endpoint.ex
file and updated the Plug.Static
plug to serve the fonts
folder as well:
defmodule MyApp.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
plug Plug.Static,
at: "/", from: :my_app, gzip: false,
only: ~w(css images js fonts favicon.ico robots.txt)
# Other Stuff ...
end
Source: PhoenixTalk - Serving static assets in a Sub-Folder other than the defaults
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With