constructor.prototype = {
         translateFont: function(fontDict, xref, resources) {
             var descriptor = xref.fetch(fontDict.get("FontDescriptor"));
-            var fontName = descriptor.get("FontName").name;
-            fontName = fontName.replace("+", "_");
+
+            var fontName = descriptor.get("FontName");
+            assertWellFormed(IsName(fontName), "invalid font name");
+            fontName = fontName.name.replace("+", "_");
 
             var fontFile = descriptor.get2("FontFile", "FontFile2");
             if (!fontFile)
 
                     // Get the font charset if any
                     var charset = descriptor.get("CharSet");
-                    if (charset)
-                      charset = charset.split("/");
+                    assertWellFormed(IsString(charset), "invalid charset");
 
+                    charset = charset.split("/");
                 } else if (IsName(encoding)) {
-                    var encoding = Encodings[encoding];
+                    var encoding = Encodings[encoding.name];
                     if (!encoding)
                         error("Unknown encoding");
 
                     var widths = xref.fetchIfRef(fontDict.get("Widths"));
                     var firstChar = xref.fetchIfRef(fontDict.get("FirstChar"));
-                    alert(firstchar);
                     assertWellFormed(IsArray(widths) && IsInteger(firstChar),
                                      "invalid Widths or FirstChar");
                     var charset = [];
 
             return {
                 name: fontName,
-              file: fontFile,
-              properties: properties
+                file: fontFile,
+                properties: properties
             }
         },