Erratic success with #font-face in epubs - font-face

I'm building epubs that I am testing in Adobe Digital Editions. The problem is that some embedded fonts will show correctly, while others will be ignored. Yet I am using the same code (e.g. below) for each font.
#font-face {
font-family : "Jura Bold Italic";
src: url(fonts/Jura-Bold-Italic.ttf);
font-style: normal;
}
h2 {
font-family: "Jura Bold Italic";
}
Some fonts that seem to display properly, others don't. Also, any other combination of quotation marks or speech marks around the font-family or src url seems to stop the #font-face working.
Does anybody have any experience with this?

You need to add a file called "com.apple.ibooks.display-options.xml"
Here's the code:
<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>
Create this file and save it into your META-INF folder. This should make the fonts work in iBooks and ADE.

Related

Nuxt.js is not importing font-face properly

I'm using custom font files with Nuxt project. I tried to add font files to /static/fonts and import them using
font-family: 'coconregular';
src: url('fonts/cocon-regular-font.woff2') format('woff2'),
url('fonts/cocon-regular-font.woff') format('woff');
font-weight: normal;
font-style: normal;
}
$cocon: 'coconregular';
.brand-name {
font-family: $cocon;
}
I'm having '#nuxtjs/style-resources' installed and all other variables and SCSS loading is working totally fine but fonts are not loading.
This is my file structure
files screenshot
I can't find a way to add fonts properly neither i don't know how to check if the font is loaded. There aren't any errors.
What is the correct way for Nuxt and SCSS to load fontfiles?
So i finally figured out good workaround. I don't know if this is good or not, but i separated fonts download from anything else. Therefore i added another entrypoint to nuxt.config.js to include fonts stylesheet before other stuff.
css: [
'#/assets/scss/theme/fonts/stylesheet.css',
'#/assets/scss/main.scss'
],
It worked good because My fonts stylesheet for Woff and Woff2 files were generated by font squirrel generator anyway.
Hope this helps you guys

How to embed my fonts in blogger?

I tried to embed fonts in my blogger website, but it didn't work when I tested it on another PC without the font installed on that PC.
This is my blog Address: ann24h.com
My font is locate in another hosting: http://kesor168.com/sub/font/
<style>
#font-face {
font-family: Khmer OS Dangrek;
src: url(http://kesor168.com/sub/font/Khmer_OS_Dangrek.eot);
src: url(http://kesor168.com/sub/font/Khmer_OS_Dangrek.ttf);
}
#font-face {
font-family: Khmer OS Battambang;
src: url(http://kesor168.com/sub/font/Khmer_OS_Battambang.eot);
src: url(http://kesor168.com/sub/font/Khmer_OS_Battambang.ttf);
}
</style>
Any idea how to fix my CSS?
You need your name value pairs to have proper syntax. The font-family property needs "Example Font Name" (single or double quotes are fine) not Example Font Name
You currently only have an .eot and .ttf font files. Which only support IE9 and Safari on Android or iOS. If you have an IE fix for your .eot file then perhaps you'll gain support for IE6 - IE8.
#font-face {
font-family: 'Khmer OS Battambang';
src: url('http://kesor168.com/sub/font/Khmer_OS_Battambang.eot');
src: url('http://kesor168.com/sub/font/Khmer_OS_Battambang.eot?#iefix') format('embedded-opentype'),
url('http://kesor168.com/sub/font/Khmer_OS_Battambang.ttf') format('truetype')
}
To apply it to your entire page:
html, body {
font-family: 'Khmer OS Battambang', sans-serif;
}
I have one example above, you can easily make your other font-face by using the example.
Edit: You asked what line would you add so it would work on Google Chrome
Answer: Add the two lines below
url('Khmer_OS_Battambang.woff2') format('woff2'),
url('Khmer_OS_Battambang.woff') format('woff'),
The 'woff2' applies to really new modern browsers.
The 'woff' applies generally to modern browsers.
Of course you'll need the .woff and .woff2 files in the same directory as your other fonts. Also in the example I provided I only specified the file, you'll need to specify the directory.

Font family not applying in firefox

I wish to use font 'Bellota' in my website.I downloaded the font (formats-> .otf, .woff, .woff2, .eot) and copied to the folder named 'font' and I called this font in my stylesheet using the code:​
#font-face {
font-family: 'bellota';
src: url("fonts/Bellota-Regular.eot");
src: url("fonts/Bellota-Regular.eot") format("embedded-opentype"),
url("fonts/Bellota-Regular.woff2") format("woff2"),
url("fonts/Bellota-Regular.woff") format("woff"),
url("fonts/Bellota-Regular.otf");
}
Now the font is displayed in chrome but not in Firefox. Should anything be done specifically to use it in firefox?
The Firefox does not support the EOT file type thus making the whole #font-face destructed. Removed it and only put WOFF file in the CSS and it should work fine now.

font-face not working in IE 10

I have absolutely no succes in getting IE 10 to display custom fonts. Has anyone else a solution for this? I can see a few shout-outs on the net that others have trouble with their fonts in IE 10, but no solutions or confirmed bugs to be found.
Anyone with the same experience or solution?
This is what I have right now, and it works well in IE before 10, Chrome and Safari:
#font-face {
font-family: "LCD";
src: url('http://www.somedomain.xxx/Public/Fonts/Quartz_Regular.ttf');
}
<!--[if IE]>
<style type="text/css">
#font-face {
font-family: "LCD";
src: url('http://www.somedomain.xxx/Public/Fonts/Quartz_Regular.eot');
}
</style>
<![endif]-->
I have tried to substitute with font files in other formats woff, ott etc. but no luck at all with that.
The answer which hinted at font-squirrel made it Work.
Now the working markup (for IE 10) is:
#font-face {
font-family: "LCD";
src: url('/Public/Fonts/quartz_regular-webfont.eot');
src: url('/Public/Fonts/quartz_regular-webfont.eot?#iefix') format('embedded-opentype'),
url('/Public/Fonts/quartz_regular-webfont.woff') format('woff'),
url('/Public/Fonts/quartz_regular-webfont.ttf') format('truetype'),
url('/Public/Fonts/quartz_regular-webfont.svg#quartzregular') format('svg');
font-weight: normal;
font-style: normal;
}
I assume this is in an HTML file, due to the HTML comments and style elements...if not, look into that.
Beyond that, just use the #font-face generator
Is it possible that IE10 does not render web fonts if Security Mode is activated? After deactivating (internet options - security) my websites were displayed correctly ...
I had the font-squirrel #font-face working in everything but IE, myproblem though was that the .woff was the only thing not included in IIS mime-types on my server. That might help someone who's also ended up on this question.
I just came across a client reporting he was unable to see the webfont on his website. Ends up that the "High" security level (in IE options) blocks web fonts by default. You can create a custom security level that is basically "High" but still enables web-fonts. Or just turn it down to medium-high.
The font-face not updated on IE 10 -> reference , you can use it same IE-9
you can learn how use font-face here
i think you include all type of your font...
I used this here:
http://www.impressivewebs.com/ie10-css-hacks/
More specifically:
#media screen and (min-width:0\0) {
/* IE9 and IE10 rule sets go here */
}
By using this we can just pop in a nice alternative font and still have sexyness in the other browsers with open fonts.
Try the fonts here:
http://cssfontstack.com
Must add that the fontface generator doesn't fix this for all fonts. When using the font Helvetica Neue Medium Condensed (HelveticaNeueLTW1G-MdCn) for instance. I'm using multiple fonts on a website. They all work with the fontface generator, except that Helvetica-font.

firefox #font-face fail with fontawesome

I'm using the FontAwesome font on an OSS app I'm running and I can't seem to get past Firefox's font sanitizer.
The files are all served out the same domain, the paths are correct, and I'm using the official css from FontAwesome which works in Firefox when served via their site and the local docs.
So I must be missing something simple.
live url: https://bmark.us
[11:39:02.945] downloadable font: invalid version tag (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:0)
source: http://127.0.0.1:6543/static/font/fontawesome-webfont.eot # http://127.0.0.1:6543/static/css/responsive.css
[11:39:02.945] downloadable font: rejected by sanitizer (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:0)
source: http://127.0.0.1:6543/static/font/fontawesome-webfont.eot # http://127.0.0.1:6543/static/css/responsive.css
Are examples of Firefox's errors when I try to correct this via dev. I've tried to do full root paths /static/font and relative to the css ../font/ and it always fails with these errors for me.
Everything works in Chrome and such. It only seems Firefox hates me. I've searched through the other answers and I've got the whole series of font faces.
https://github.com/mitechie/Bookie/tree/develop/bookie/static/font
Thanks for any hints.
Thanks, this was a two part problem.
The second part comes first. The sample css from the fontawesome.scss uses single quotes around the paths of the various font formats. When I ran my scss builder (pyscss) on them, it stripped them. They needed to be double quotes.
Since there were no quotes, FF failed to parse the src: url(...) bit. Since it failed that it only had the src: ..eot that's meant for IE to have and it didn't work in FF.
Changing the quotes to double quotes made everything happy.
So this is my fault using pyscss and it's parser that ended up breaking the syntax for Firefox.
Thanks Matt for helping me look closer at this.
A) Are you sure your server has the mime types set for eot/woff/ttf/svg??
B) It looks like you're running in to a problem with the EOT. that could be explained by the fact that Firefox does not support EOTs; it uses WOFF and TTF.
C) Have you tried to debug using Firebug or Firefox's native developer tools?
D) Can you post your (relevant) CSS and HTML?
I ran into the same problem on one of my clients websites.
#font-face {
font-family: 'SourceSansProBlack';
src: url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/eot');
src: url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/eot') format('embedded-opentype'),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/woff') format('woff'),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/ttf') format('truetype'),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/svg') format('svg');
}
The above worked in firefox. The one below didn't work.
#font-face {
font-family: 'SourceSansProBlack';
src: url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/eot');
src: url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/eot') format(embedded-opentype),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/woff') format(woff),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/ttf') format(truetype),
url('http://everythingfonts.com/font/face/HwlUPF6WEeKcF1DlSVDSjg/svg') format(svg);
}
Turns out the format specifiers need to be quoted like format('svg'). Some of the css stylesheets served by the sites don't quote the format specifiers. I have experimented with the path with both single and double quotes and that didn't make any difference. So I can say that it is the problem with unquoted format specifiers rather than the double/single quoted paths.
In my case it was enough to place .eot/.woff/.svg/.ttf files in the same *.war file as other static content(css, png etc.) is placed. Looks like FF and IE found downloading font files from other servers dangerous.
I know this is coming in late, but the best option is to use font-awesome from the CDN. You will hardly run into this kind of error if you do so.
If you are referencing the font from an external file, comment out the lines:
#font-face {
font-family: FontAwesome;
src: url("../vendors/font-awesome/fonts/fontawesome-webfont.eot");
src: url("../vendors/font-awesome/fonts/fontawesome-webfont.eot") format("embedded-opentype"), url("../vendors/font-awesome/fonts/fontawesome-webfont.woff2") format("woff2"), url("../vendors/font-awesome/fonts/fontawesome-webfont.woff") format("woff"), url("../vendors/font-awesome/fonts/fontawesome-webfont.ttf") format("truetype"), url("../vendors/font-awesome/fonts/fontawesome-webfont.svg#fontawesomeregular") format("svg");
font-weight: 400;
font-style: normal
}
and use the link from the CDN in the head instead
<head>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head
and you would be good to go.

Resources