I have some .ttf files I am using for an embedded project and I would like to reduce their filesizes. I don't have any experience working with font's other than mapping the files to this library I'm using. Basically I would like the fonts to only contain latin characters, any recommended tools for doing this? Ideally, something that I could script or configure so that I could process multiple .ttf files
Thanks for any thoughts or ideas!
For anyone who's interested, FontForge made this really easy
Related
I'm interested in creating my own .ttf file using my own code. I did some research and found Apple's specification for .ttf files.
I'm having trouble understanding it though. Here is an excerpt:
"A TrueType font file consists of a sequence of concatenated tables. A table is a sequence of words. Each table must be long aligned and padded with zeroes if necessary." https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html
I opened up a .ttf file with notepad++, expecting to see the tables described above, but just got a bunch of incomprehensible stuff. See attached screenshot.
My question: What are these tables?
Can anybody expand on what I need to do to create these tables? I'm newer to writing code, so maybe the problem is my lack of coding knowledge. If that's the case, could someone point me to a reference where I can educate myself on these tables?
Take a look at OpenType Cookbook about how to program fonts. If you want to simply take a look at the tables you mentioned, you'll need a tool like TTX/FontTools to convert the binary tables to something more readable (an XML file in this case).
I found the answer to my question:
http://www.fileformat.info/tool/hexdump.htm
I uploaded a .ttf file here and the site converted it to hexadecimal form to display. Now i can read the .ttf specification in one window and have an example of the spec being implemented up in another.
Originally i was looking for a binary display, but this hex display is much better for viewing.
Using this hex dump along with the .ttx file makes the .ttf file format a LOT more understandable.
Update:
I found another answer. There's a python package called 'ufo-extractor' that converts .otf or .ttf files into .ufo files. A .ufo file is a human readable font file. See:
http://unifiedfontobject.org/
MS Word's .docx files contain a bunch of .xml files.
Setup.exe files spit out hundreds of files that a program uses.
Zips, rars etc also hold lots of compressed stuff.
So how are they made? What does MS Word or another program that produces these files have to do to put files inside files?
When I looked this up I just got a bunch of results about compression, but let's say I wanted to make a program that 'wraps' files inside a file without making the final result any smaller. What would I even have to write?
I'm not asking/expecting any source code that does this, I just need a pointer. Is there something you think I'm misunderstanding based on what I've asked here?
Even a simple link to an article or some documentation would be greatly appreciated.
Ok, I'll just come up with some headers for ordinary files and write them along with the bytes of the actual files into one custom-defined file. You guys were very helpful, thank you!
Historically, Windows had a number of technologies to support solutions like this. These were often called Compound Files or Structured storage. However, I don't think the newer Office documents use these technologies. I think the Office file formats are similar to ZIP files with a different extensions. If you change a file with .docx extension to .zip and open it with your favorite compression tool, you'll see a bunch of folders and XML files.
Here are some links to descriptions of different file formats that create "files within files"
Zip file format
Compound File Binary Format (CFBF)
Structured Storage
Compound Document File Format
Office Open XML I: Exploring the Office Open XML Formats
At least on POSIX systems (e.g. Linux), a file is only a stream (i.e. a sequence) of bytes. And you can only grow (or shrink, i.e. truncate) it at the end - there is no way to insert bytes in the middle (without copying the rest).
You need some conventions, and some additional software, to handle it otherwise.
You might be interested in Sqlite, which gives you a library to handle some (e.g.) *.sqlite file as an SQL database
You could also use GDBM - a library giving you some indexed file abstraction.
libtar is a library to manipulate tar archives. See also tardy, a tar file postprocessor.
HI, I am using CGZipLibrary.dll in my code for zipping the files. A .zip file is being created but the file is not getting compressed. The original file and the .zip file are of same size.
Please provide some suggestions. Thanks in advance.
CGZipLibrary.dll... that's a rather old library if my memory is serving me right, I remember using it (or some other library with a similary name) in some old VB6 projects, and I had to update it because it had some problems when compressing folder structures. I may have the updated library lying somewhere around.
For .Net there are better alternatives like SharpZipLib and DotNetZip. I see the question is tagged with VB6 as well... if you need to use the library from VB6, from what I know, DotNetZip is marked as visible for COM, so you should be able to use it as well, although haven't tried it myself.
I create hundreds of PDF files with the same images and fonts. I there a way I can share these resources between all the files instead of having them embedded in each PDF? It sure would be a disk space saver.
No. PDFs are meant to be stand-alone files which fully encompass font information, vector graphics and whatnot in a single file. Sharing between files would break this. If you're looking to save space (and application requirements), you might consider generating the PDFs on the fly.
You can embed external links for things like files if you just want to share linked files.
Is it possible to programmatically zip/unzip files in vb.net? Meaning, not that it will extract the files for the user, but take the files inside the zip and be able to use them in the application? Then, is it possible for this to create a zip?
I couldn't seem to find a compression namespace anywhere.
Thanks for the help!
We used SharpZibLib in the past with great success.
You can also have look at the System.IO.Compression namespace, it provides the functionality compress and decompress streams but unfortunately not the functionality to extract files from a Zip file :(
Update:
I wasn't aware of this namespace System.IO.Packaging, seems it can indeed deal with files 'packed' into a zip file.
For an excellent commercial solution try http://xceed.com/
We have used this and it's great for working with zip file (and for merging and creating self-extracting zips if this is required)
note: Not affiliated with Xceed in any way.