Is anyone familar with the .fntdata structure of an embedded font? This is used in PowerPoint 2007/2010 when embedding a font into a presentation (it is unlike .odttf that is used in Word 2007/Word 2010). Basically, I just want to convert this to a .ttf or .odttf file so it can be read by WPF/Silverlight applcations.
One page of the standard states the following:
c. The standard states that application/x-fontdata specifies that the font shall be stored as a bitmapped font (each glyph is stored as a raster image).
PowerPoint stores TrueType and OpenType fonts (Embed-Open-Type-Format, Micro-Type-Exp-Format) in parts of this type. Word does not read or write this content type.
Which is helpful to know that at least there is a direction to research, but I'm not sure where to go from here in terms of how to convert, if it's possible to convert, etc. (in .NET preferablly).
Right now, I can't even figure out how to read it. I've tried Microsoft Font Validator, but it says it is not a valid font.
To see this kind of font, go into PowerPoint 2007/2010, create one blank slide and add a text box. Add some text and change the font to "Chiller" (for example). Then, go to Orb (that round thing at top), click Save As... and then right next to the Save button click the Tools dropdown and then click on Save Options. Once the dialog pops, at the bottom choose Embed fonts in file (doesn't matter which radio below that you choose). Okay, now save and you're done. Now close the file, and find it in the location where you just saved it. Rename the extention from .p开发者_Python百科ptx to .zip and then unzip it. In that folder, go to /ppt/fonts/ and you'll find a number of fonts there. Anyone of them will do.
Does anyone have any ideas?
I think I have close to the answer for you. Fonts of this type are of the Embedded Open Type (EOT) format that follows the PowerPoint Binary File Format spec. You can read more about the details of EOTs on the W3C's Embedded Open Type (EOT) file format.
I tested a few fonts against this, like Calibri Bold and Chiller, doing both the instructions you gave above for PowerPoint and then also using the Microsoft Web Embedding Fonts Tool (WEFT). They both create the same file sizes, but the encryption appears to be different - I'm guessing that WEFT is applying some different encryption due to how it builds the EOTs for specific websites. The W3C page above may have more details on encryption.
The good news is that, at least in a web page, you can use the PowerPoint-generated one "as is". In the PowerPoint embedded font I created of the Chiller font which is font1.fntdata when embedded, I just took that and created a web page using it and it worked just fine:
<html>
<head>
<title>Chill</title>
<style type="text/css">
@font-face{
font-family: Chiller;
src: url('font1.fntdata');
}
.Chiller{
font-family: Chiller;
font-size:60px;
color:#000;
}
</style>
</head>
<body>
<div class="Chiller">Cold Beer</div>
Free!
</body>
</html>
I haven't gone so far as to test as to whether or not these can be used directly in WPF/Silverlight but at least now you know what you're dealing with.
What I gather from the linked page is that .fntdata
files contain only rasterized glyphs. This means the results are likely to be ugly if any scaling has to be performed.
Step one is obviously to extract the glyphs. A quick search yields absolutely nothing on the web about .fntdata
files. I tried eyeballing one in a hex editor, but nothing really popped out (other than the font's name as a string). Additionally, TrID had absolutely no idea what was in there. You might be able to experiment and see if you can extract any useful data – I wish you luck.
If you do figure out how to get the glyphs out, next you just have to get them in to a TTF file. According to the OpenType file spec (which covers .ttf
files), TTFs may contain bitmapped glyphs. (Specifically, see the EBDT table). I don't think there's a .NET implementation of a TTF parser or writer, so you'd have to start from scratch to implement the spec. Again, I wish you luck.
Of course, if I'm correct about the embedded fonts only containing rasterized glyphs, then all of this work will be for very little payoff – you're not really getting the font. I obviously don't know what your requirements are or why you're trying to extract these fonts, but this may be a case where it's simply more effective to just find the original font.
Just to let you know what the status is in 2022: Extracted .fntdata files cannot (no longer?) be loaded directly into HTML through CSS (as one of the answers here suggests, but it is from 2010, and was perhaps in Internet Explorer?).
In Chrome I get this error in console:
Failed to decode downloaded font: https://…/font1.fntdata
OTS parsing error: invalid sfntVersion: 112134400
I tested this with a .fntdata file created using PowerPoint 16.63.1 and tried the provided HTML in Safari and Chrome (103), on a local and https connection.
精彩评论