diff --git a/src/core/fonts.js b/src/core/fonts.js index b2c06c9c5..40a1d4b56 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -3084,21 +3084,21 @@ var Font = (function FontClosure() { builder.addTable( "head", "\x00\x01\x00\x00" + // Version number - "\x00\x00\x10\x00" + // fontRevision - "\x00\x00\x00\x00" + // checksumAdjustement - "\x5F\x0F\x3C\xF5" + // magicNumber - "\x00\x00" + // Flags - safeString16(unitsPerEm) + // unitsPerEM - "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // creation date - "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // modifification date - "\x00\x00" + // xMin - safeString16(properties.descent) + // yMin - "\x0F\xFF" + // xMax - safeString16(properties.ascent) + // yMax - string16(properties.italicAngle ? 2 : 0) + // macStyle - "\x00\x11" + // lowestRecPPEM - "\x00\x00" + // fontDirectionHint - "\x00\x00" + // indexToLocFormat + "\x00\x00\x10\x00" + // fontRevision + "\x00\x00\x00\x00" + // checksumAdjustement + "\x5F\x0F\x3C\xF5" + // magicNumber + "\x00\x00" + // Flags + safeString16(unitsPerEm) + // unitsPerEM + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // creation date + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // modifification date + "\x00\x00" + // xMin + safeString16(properties.descent) + // yMin + "\x0F\xFF" + // xMax + safeString16(properties.ascent) + // yMax + string16(properties.italicAngle ? 2 : 0) + // macStyle + "\x00\x11" + // lowestRecPPEM + "\x00\x00" + // fontDirectionHint + "\x00\x00" + // indexToLocFormat "\x00\x00" ); // glyphDataFormat @@ -3106,21 +3106,21 @@ var Font = (function FontClosure() { builder.addTable( "hhea", "\x00\x01\x00\x00" + // Version number - safeString16(properties.ascent) + // Typographic Ascent - safeString16(properties.descent) + // Typographic Descent - "\x00\x00" + // Line Gap - "\xFF\xFF" + // advanceWidthMax - "\x00\x00" + // minLeftSidebearing - "\x00\x00" + // minRightSidebearing - "\x00\x00" + // xMaxExtent - safeString16(properties.capHeight) + // caretSlopeRise - safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + // caretSlopeRun - "\x00\x00" + // caretOffset - "\x00\x00" + // -reserved- - "\x00\x00" + // -reserved- - "\x00\x00" + // -reserved- - "\x00\x00" + // -reserved- - "\x00\x00" + // metricDataFormat + safeString16(properties.ascent) + // Typographic Ascent + safeString16(properties.descent) + // Typographic Descent + "\x00\x00" + // Line Gap + "\xFF\xFF" + // advanceWidthMax + "\x00\x00" + // minLeftSidebearing + "\x00\x00" + // minRightSidebearing + "\x00\x00" + // xMaxExtent + safeString16(properties.capHeight) + // caretSlopeRise + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + // caretSlopeRun + "\x00\x00" + // caretOffset + "\x00\x00" + // -reserved- + "\x00\x00" + // -reserved- + "\x00\x00" + // -reserved- + "\x00\x00" + // -reserved- + "\x00\x00" + // metricDataFormat string16(numGlyphs) ); // Number of HMetrics diff --git a/src/display/display_utils.js b/src/display/display_utils.js index fd5610fe8..60f357e38 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -579,16 +579,16 @@ class PDFDateString { if (!pdfDateStringRegex) { pdfDateStringRegex = new RegExp( "^D:" + // Prefix (required) - "(\\d{4})" + // Year (required) - "(\\d{2})?" + // Month (optional) - "(\\d{2})?" + // Day (optional) - "(\\d{2})?" + // Hour (optional) - "(\\d{2})?" + // Minute (optional) - "(\\d{2})?" + // Second (optional) - "([Z|+|-])?" + // Universal time relation (optional) - "(\\d{2})?" + // Offset hour (optional) - "'?" + // Splitting apostrophe (optional) - "(\\d{2})?" + // Offset minute (optional) + "(\\d{4})" + // Year (required) + "(\\d{2})?" + // Month (optional) + "(\\d{2})?" + // Day (optional) + "(\\d{2})?" + // Hour (optional) + "(\\d{2})?" + // Minute (optional) + "(\\d{2})?" + // Second (optional) + "([Z|+|-])?" + // Universal time relation (optional) + "(\\d{2})?" + // Offset hour (optional) + "'?" + // Splitting apostrophe (optional) + "(\\d{2})?" + // Offset minute (optional) "'?" // Trailing apostrophe (optional) ); } diff --git a/test/unit/display_utils_spec.js b/test/unit/display_utils_spec.js index ee1e42f67..175226b11 100644 --- a/test/unit/display_utils_spec.js +++ b/test/unit/display_utils_spec.js @@ -224,7 +224,7 @@ describe("display_utils", function () { undefined: null, null: null, 42: null, - "2019": null, + 2019: null, D2019: null, "D:": null, "D:201": null, diff --git a/test/unit/pdf_find_utils_spec.js b/test/unit/pdf_find_utils_spec.js index 9134c7218..d108a5cc2 100644 --- a/test/unit/pdf_find_utils_spec.js +++ b/test/unit/pdf_find_utils_spec.js @@ -21,8 +21,8 @@ describe("pdf_find_utils", function () { const characters = { A: CharacterType.ALPHA_LETTER, a: CharacterType.ALPHA_LETTER, - "0": CharacterType.ALPHA_LETTER, - "5": CharacterType.ALPHA_LETTER, + 0: CharacterType.ALPHA_LETTER, + 5: CharacterType.ALPHA_LETTER, "\xC4": CharacterType.ALPHA_LETTER, // "Ä" "\xE4": CharacterType.ALPHA_LETTER, // "ä" _: CharacterType.ALPHA_LETTER,