Extracting Fonts from PDFs
Have you ever come across a PDF, which uses some really cool fonts, but you can't seem to get a hold of them... Here's a solution, you can extract font from PDFs! It's possible!
There are some drawbacks though, in many (and probably most) cases it won't be either legal or moral to extract a font from a PDF and then use it without paying a licensing fee. Next most PDF creators only embed a subset of characters into the PDF, which means you won't get a complete character set. This basically means this method is only useful for sampling...
Now first you'll need to convert the PDF to an old school PostScript file like so:
# pdftops 1Rules.pdf
Next open the 1Rules.ps file with your favorite text editor and search for the following:
%%BeginResource: font CIKHFG+Schoensperger-Modified
%!FontType1-1.0: CIKHFG+Schoensperger-Modified
12 dict begin
/FontInfo 10 dict dup begin
/Notice (©1991 FontFontRevival; FontShop International ¥ Modified by Marc G @ the Black Library 7/99 so we can write the word 'Skaven' properly.) readonly def
...
cleartomark
%%EndResource
Copy that excluding the %%BeginResource and %%EndResource lines to a new textfile, which you can then save using a .pfa extension.
Open the newly created .pfa file with FontForge, and reencode the font as Latin1 (Encoding - Reencode - Latin1), and compact the font (Encoding - Compact). Because of the embedding the font's name will be garbled, so you'll want to adjust that (Element - Font Info - Names). Finally you can generate a TrueType or PostScript Type1 font to your liking (File - Generate Fonts).
There are some drawbacks though, in many (and probably most) cases it won't be either legal or moral to extract a font from a PDF and then use it without paying a licensing fee. Next most PDF creators only embed a subset of characters into the PDF, which means you won't get a complete character set. This basically means this method is only useful for sampling...
Now first you'll need to convert the PDF to an old school PostScript file like so:
# pdftops 1Rules.pdf
Next open the 1Rules.ps file with your favorite text editor and search for the following:
%%BeginResource: font CIKHFG+Schoensperger-Modified
%!FontType1-1.0: CIKHFG+Schoensperger-Modified
12 dict begin
/FontInfo 10 dict dup begin
/Notice (©1991 FontFontRevival; FontShop International ¥ Modified by Marc G @ the Black Library 7/99 so we can write the word 'Skaven' properly.) readonly def
...
cleartomark
%%EndResource
Copy that excluding the %%BeginResource and %%EndResource lines to a new textfile, which you can then save using a .pfa extension.
Open the newly created .pfa file with FontForge, and reencode the font as Latin1 (Encoding - Reencode - Latin1), and compact the font (Encoding - Compact). Because of the embedding the font's name will be garbled, so you'll want to adjust that (Element - Font Info - Names). Finally you can generate a TrueType or PostScript Type1 font to your liking (File - Generate Fonts).
0 Comments:
Post a Comment
<< Home