From 62b2c5a030aba973e482962daac84596ee0c2488 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 12 Oct 2012 14:05:50 -0500 Subject: [PATCH] Stops font processing when valid glyphs are absent in the font --- src/evaluator.js | 2 +- src/fonts.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/evaluator.js b/src/evaluator.js index f6ef31c9b..ed49f821b 100644 --- a/src/evaluator.js +++ b/src/evaluator.js @@ -161,7 +161,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { translated = this.translateFont(font, xref, resources, dependency); } catch (e) { - translated = { error: e }; + translated = { error: e instanceof Error ? e.message : e }; } font.translated = translated; diff --git a/src/fonts.js b/src/fonts.js index 17d847a8d..e7cac1345 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -3557,6 +3557,10 @@ var Font = (function FontClosure() { this.glyphNameMap = properties.glyphNameMap; } + if (ids.length === 0) { + error('Valid glyph data is not found'); + } + // Converting glyphs and ids into font's cmap table cmap.data = createCMapTable(glyphs, ids); var unicodeIsEnabled = [];