Created
March 29, 2013 02:43
-
-
Save yurydelendik/5268384 to your computer and use it in GitHub Desktop.
Converts PDF Type1 data to PFB file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/fonts.js b/src/fonts.js | |
index fb5f541..fdde476 100644 | |
--- a/src/fonts.js | |
+++ b/src/fonts.js | |
@@ -5514,6 +5514,16 @@ var Type1Font = function Type1Font(name, file, properties) { | |
this.charstrings = charstrings; | |
this.data = this.wrap(name, type2Charstrings, this.charstrings, | |
subrs, properties); | |
+ | |
+ // creating Type1 binary file | |
+ properties.pfbFile = 'data:application/x-font-type1;base64,' + btoa( | |
+ '\x80\x01' + String.fromCharCode(properties.length1 & 255, (properties.length1 >> 8) & 255, | |
+ (properties.length1 >> 16) & 255, (properties.length1 >>> 24) & 255) + bytesToString(headerBlock) + | |
+ '\x80\x02' + String.fromCharCode(properties.length2 & 255, (properties.length2 >> 8) & 255, | |
+ (properties.length2 >> 16) & 255, (properties.length2 >>> 24) & 255) + bytesToString(eexecBlock) + | |
+ '\x80\x01\x14\x02\x00\x00' + | |
+ Array(9).join('0000000000000000000000000000000000000000000000000000000000000000\n') + | |
+ 'cleartomark\r\x80\x03'); | |
}; | |
Type1Font.prototype = { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Convert to OTF:
makeotf -f font.pfb -o font.otf
(see FDK; for windows usemakeotfexe
)/cc @brendandahl