composite = true;
}
- // Before PDF 1.5 if the font was one of the base 14 fonts, having a
- // FontDescriptor was not required.
- // This case is here for compatibility.
var descriptor = xref.fetchIfRef(dict.get('FontDescriptor'));
if (!descriptor) {
- // Note for Type3 fonts: it has no no base font, feeding default
- // font name and trying to get font metrics as the same way as for
- // a font without descriptor.
- var baseFontName = dict.get('BaseFont') || new Name('sans-serif');
-
- // Using base font name as a font name.
- baseFontName = baseFontName.name.replace(/,/g, '_');
- var metricsAndMap = this.getBaseFontMetricsAndMap(baseFontName);
-
- var properties = {
- type: type.name,
- encoding: metricsAndMap.map,
- differences: [],
- widths: metricsAndMap.widths,
- defaultWidth: metricsAndMap.defaultWidth,
- firstChar: 0,
- lastChar: 256
- };
- this.extractEncoding(dict, xref, properties);
+ if (type.name == 'Type3') {
+ // FontDescriptor is only required for Type3 fonts when the document
+ // is a tagged pdf. Create a barbebones one to get by.
+ descriptor = new Dict();
+ descriptor.set('FontName', new Name(type.name));
+ } else {
+ // Before PDF 1.5 if the font was one of the base 14 fonts, having a
+ // FontDescriptor was not required.
+ // This case is here for compatibility.
+ var baseFontName = dict.get('BaseFont');
- if (!IsName(baseFontName))
++ if (!isName(baseFontName))
+ return null;
+
+ // Using base font name as a font name.
+ baseFontName = baseFontName.name.replace(/,/g, '_');
+ var metricsAndMap = this.getBaseFontMetricsAndMap(baseFontName);
+
+ var properties = {
+ type: type.name,
+ encoding: metricsAndMap.map,
+ differences: [],
+ widths: metricsAndMap.widths,
+ defaultWidth: metricsAndMap.defaultWidth,
+ firstChar: 0,
+ lastChar: 256
+ };
+ this.extractEncoding(dict, xref, properties);
+
+ return {
+ name: baseFontName,
+ dict: baseDict,
+ properties: properties
+ };
+ }
- return {
- name: baseFontName,
- dict: baseDict,
- properties: properties
- };
}
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',