I only want to add a local font to font face for use in a static HTML / CSS website. The font is located here: /Users/sdawes/Library/Fonts and my code is as follows, however it does not work. I am unsure whether my syntax is incorrect or am I missing something? Many thanks
#font-face {
font-family: CantoniPro;
src: local("/Users/sdawes/Library/Fonts/Brillant.ttf");
}
h2 {
font-family: "CantoniPro", "futura-pt", Serif;
font-weight: 500;
color: #2b292e;
font-size: 1.5em;
text-align: center;
margin-top: 5%;
}
Related
I have a react.js app up and running. I wanted to change the font to Galano Grotesque Bold. I downloaded the files and followed the tutorial here:
https://esfonts.pro/articulo/como-instalar-una-fuente#web
I have this style.css file:
#font-face {
font-family: 'Galano Grotesque';
src: local('Galano Grotesque Bold'), local('Galano-Grotesque-Bold'),
url('GalanoGrotesque-Bold.woff2') format('woff2'),
url('GalanoGrotesque-Bold.woff') format('woff'),
url('GalanoGrotesque-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
I import it in App.css like this:
#import url("fonts/roboto/style.css");
.App {
text-align: center;
margin-top: 20px;
}
.zoom {
width: auto;
height: auto;
}
body {
font-family: 'Galano Grotesque', Bold;
}
It's working perfectly in localhost. The problem comes when I deploy this app (using netlify). I see the following error and the font is not correct:
I understand that these files are being blocked by cord policy. I've read that I should do the request using HTTPS but I don't know how to do it.
Anyone knows how to fix this?
I have tried both ttf and woff formats with multiple different fonts across chrome, firefox, and edge but it doesn't seem to apply any font no matter what i do. Everything else in the style sheet is referenced perfectly fine besides #font-face. I've checked directory and syntax error but as far as i can see there are none.
.
.
body {
background-color: black;
color: #B0C1B4;
}
p {
font-family: font !important;
font-weight: 100;
}
#log {
width: 65%;
}
#font-face {
font-family: 'font';
src: url(data/fonts/font.ttf) format(ttf),
url(data/fonts/font.woff) format(woff);
font-style: normal;
font-weight: 100;
}
You're defining the wrong path here.
Path must be like this:
#font-face {
font-family: 'font';
src: url(data/fonts/font.ttf) format(ttf),
url(data/fonts/font.woff) format(woff);
font-style: normal;
font-weight: 100;
}
I am trying to generate pdf files using a MadCap Flare project, but the PDF files come out with the wrong font. I am using the latest version of Flare, 2019r2.
I am trying to generate paragraphs using the Flexo fonts from Duotype. All the fonts are installed in the main Windows font directory: C:\Windows\Fonts\DUROTYPE_-_FLEXO-REGULAR_1.OTF. This was accomplished by right clicking on the font and choosing "Install for all users".
An example of the issue is the h2 style. The stylesheet has the following declarations in the default section:
body
{
padding: 0 20px;
}
...
body,
div,
li,
p
{
color: #3b4151;
font-family: FlexoRegular, Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
margin: 0.5em 0;
mc-hyphenate: never;
orphans: 2;
widows: 2;
}
...
h2
{
color: #f8193f;
font-family: FlexoBoldIt, Arial, "Helvetica Neue", Helvetica, sans-serif;
font-weight: normal;
font-size: 1.67em;
page-break-after: avoid;
}
The selector I actually want to use is under a #media section with the following declarations.
body
{
padding: 0;
position: relative;
margin: 0;
}
h2
{
color: #f8193f;
font-family: "Flexo-BoldIt", Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 9pt;
margin-bottom: 0px;
margin: 0px;
margin-top: 6px;
}
When I define the font-familiy as "font-family: "Flexo", Arial, "Helvetica Neue", Helvetica, sans-serif;" I get output with the Flexo font. However, when I try "Flexo-BoldIt" or 'Flexo-BoldIt' or "Flexo Bold Italic" or various other combinations of quotes and font names I get output with Microsoft Sans Serif. When I try to override the style with an explicit declaration such as
<h2 style="text-align: center;font-family: "Flexo-BoldIt"...">
the output is again in MS Sans Serif.
Adding declarations like
font-style: italic;
font-weight: bold;
doesn't help.
Why doesn't Flare generate output with the correct font? Also, why doesn't it generate output with Arial, as that is installed? If I remove "Flexo-BoldIt" from the font-family I get output with Arial.
Any help would be much appreciated.
Have you added font-face in CSS
#font-face
{
font-family: 'YourFontFamilyName';
src: url(../path/to/font);
}
After that use font like
h1
{
font-family: 'YourFontFamilyName';
}
Also, keep your fonts in project files so you can access it with a relative path easily.
Try this out and give me feedback :)
UPDATE
This is more of a tip for every project similar to this one.
Do not use the system installed fonts because if the user doesn't have that font installed on their system it will be wrong. Always put font files in a project directory and access them like above.
Convert the font file into base64
#font-face {
font-family: 'myfont';
src: url(data:font/truetype;charset=utf-8;base64,<<copied base64 string>>) format('truetype');
font-weight: normal;
font-style: normal;
}
Try this, from https://www.madcapsoftware.com/blog/madcap-flare-tip-use-custom-fonts-flare-outputs/:
The #font-face rule can have “font-family” defined as any name. However, I recommend using the default name seen in Flare. You can find out what name Flare is reading the font by going to the Home Ribbon and selecting the Font dropdown. The reason I recommend this is because if the font name is different than what appears in the dropdown, the PDF outputs will have to point to a different font name than your HTML5 outputs.
The name you show in the example looks like the name on the filesystem, not necessarily what the name appears as in the ribbon.
I am using Sass for my project and I am getting this error on my home page while importing fonts from my custom fonts folder of Merriweather.The problem is that when i check the network tab on chrome it shows that Agenda font file is included but not the merriweather font file.Both Agenda and Merriweather fonts are in separate folders.
Error :
**http://localhost/project-name/fonts/Merriweather/Merriweather-Italic.tff net::ERR_ABORTED 404 (Not Found)**
My Project folder structure in like this:
project-folder/fonts-folder/Merriweather-folder/All fonts of Merriweather here
project-folder/fonts-folder/Agenda-folder/All fonts of Agenda here
project-folder/scss-folder/partials-folder/global.scss
project-folder/scss-folder/variables.scss
QUESTIONS:
I want to know the is my syntax right for importing multiple fonts
from the same font family like Merriweather ?
what exactly i am doing wrong in variables.scss ??
Please help me to resolve this issue.
Code in Variables.scss
#font-face {
font-family: Agenda;
font-weight: 500;
font-style: normal;
src: url("../fonts/Agenda/Agenda-Medium.otf") format("opentype");
}
#font-face {
font-family: Merriweather-Italic;
font-weight: normal;
font-style: italic;
src: url("../fonts/Merriweather/Merriweather-Italic.tff") format("truetype");
}
#font-face {
font-family: Merriweather-Regular;
font-weight: normal;
font-style: normal;
src: url("../fonts/Merriweather/Merriweather-Regular.tff") format("truetype");
}
This is how i am using fonts in globals.scss
#import "../variables";
body{
font-family: Merriweather-Regular;
font-size: 22px;
background-color: $white;
}
h1{
font-family: Merriweather-Italic;
font-style: italic;
font-size: 94px;
}
h2{
font-family: Merriweather-Regular,Merriweather-Italic;
font-size: 42px;
}
h3{
font-family: Agenda;
font-size: 30px;
}
h4{
font-family: Merriweather-Regular;
font-style: bold;
font-size: 27px;
}
h5{
font-family: Merriweather-Regular;
font-size: 26px;
}
To be sure I would have to see a screenshot of your fonts folder, but I think the font isn't found because of typo in the font-face declaration. True-type font files usually have a .ttf extension instead of .tff.
That means you would have to adjust your #font-face declaration from:
#font-face {
// omitted font-family, weight and style for clarity
src: url("../fonts/Merriweather/Merriweather-Italic.tff") format("truetype");
}
to:
#font-face {
// omitted font-family, weight and style for clarity
src: url("../fonts/Merriweather/Merriweather-Italic.ttf") format("truetype");
}
At this point, so in variables.scss, I usually also declare a font variable for each font (type) for usage in the rest of my SASS files, e.g $merriweather--italic: "Merriweather-Italic", serif;
Therefore you can use these variables in your global.scss as such:
h1{
font-family: $merriweather--italic;
font-size: 94px;
}
I am trying to add a google font as per instructions, and it works in testing files, but fails to load on a production site.
http://www.bleskuborka.ru/services/
The headings УБОРКА ОФИСА, УБОРКА КВАРТИРЫ etc. are supposed to be rendered with Roboto Condensed.
<link href="http://fonts.googleapis.com/css?family=Roboto+Condensed&subset=latin,cyrillic" rel="stylesheet" type="text/css">
The font is linked to page. The font-family is specified:
.serv-heading {
font-family: 'Roboto-Condensed', sans-serif;
text-transform: uppercase;
font-size: 30px;
line-height: 1.2em;
}
Still, something is missing.
I first thought that this might be due to the cyrillic characters but I tried renaming the headings into English, and it didn't work out.
Please help!
It should be Roboto Condensed. With space instead of dash.
.serv-heading {
font-family: 'Roboto Condensed', sans-serif;
text-transform: uppercase;
font-size: 30px;
line-height: 1.2em;
}
Try with Roboto Condensed instead of Roboto-Condensed and it will work fine:
.serv-heading {
font-family: 'Roboto Condensed', sans-serif;
text-transform: uppercase;
font-size: 30px;
line-height: 1.2em;
}
Also note to use https with Google Font links, it will avoid some issues if one day you work on a https website!