So, I'm trying to load a "Barcode" font that will replace normal text to barcode on my webpage.
Now I'm new of using fonts. The font I'm trying to use is this:
http://www.fontsupply.com/fonts/F/Fre3of9x.html FRE3OF9X.TTF
The error message is this: Failed to decode downloaded font:
I can see, the font is loading 304
in network console. So what is causing this problem?
HTML
<div class="barcode"><span class="barcodeText">*11111*</span></div>
CSS
@font-face {
font-family: 'FRE3OF9X';
src: url('/fonts/FRE3OF9X.TTF');
}
.barcodeText{
font-family: 'FRE3OF9X', 'Georgia', serif;;
}
Result
*11111*
I also got this message OTS parsing error: maxp: failed to parse table
. But I do not really know what it is for.
FIDDLE
https://jsfiddle.net/f2a6gcvu/
EDIT
I did not solve this, but changed font. 3 of 9 works just fine.
https://www.searchfreefonts.com/free/3-of-9-barcode.htm
The reason you're getting the decode error is because the font actually is corrupt. Running it through TTX (a utility for switching font representations between binary and XML form) gives us this:
> ttx FRE3OF9X.TTF
Dumping "FRE3OF9X.TTF" to "FRE3OF9X.ttx"...
Dumping 'GlyphOrder' table...
Error: cmap subtable is reported as having zero length:
platformID 1, platEncID 0, format 0 offset 20. Skipping table.
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'maxp' table...
Dumping 'OS/2' table...
Dumping 'hmtx' table...
Error: cmap subtable is reported as having zero length:
platformID 1, platEncID 0, format 0 offset 20. Skipping table.
Dumping 'cmap' table...
Dumping 'loca' table...
Dumping 'glyf' table...
Dumping 'name' table...
Dumping 'post' table...
As the cmap
structure contains the information about which character a font supports, a broken cmap subtable is a terminal error. You can try to derive the broken data from other cmap subtables (which is what Photoshop is probably doing) but that's not guaranteed to do the right thing. Browsers err on the side of caution, so this font is simply going to get rejected.
What to do: 1. report this font as broken to the website so they can either have it fixed or removed, 2. pick a new font (I see you already did that), and 3. probably grab yourself a copy of TTX for checking bad fonts in the future.
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