Merge pull request #683 from vingtetun/master

Fix issue #681
This commit is contained in:
notmasteryet 2011-10-18 18:05:57 -07:00
commit e27e87aeef
4 changed files with 15 additions and 12 deletions

View File

@ -1329,7 +1329,7 @@ var Font = (function Font() {
// Character to glyphs mapping // Character to glyphs mapping
'cmap': createCMapTable(charstrings.slice(), 'cmap': createCMapTable(charstrings.slice(),
('glyphIds' in font) ? font.glyphIds: null), ('glyphIds' in font) ? font.glyphIds : null),
// Font header // Font header
'head': (function fontFieldsHead() { 'head': (function fontFieldsHead() {
@ -2613,14 +2613,13 @@ var Type2CFF = (function type2CFF() {
var glyph = charsets[i]; var glyph = charsets[i];
var code = glyphMap[glyph] || 0; var code = glyphMap[glyph] || 0;
var mapping = glyphs[code] || glyphs[glyph] || {}; var mapping = glyphs[code] || glyphs[glyph] || { width: defaultWidth };
var unicode = mapping.unicode; var unicode = mapping.unicode;
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255)) if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
unicode += kCmapGlyphOffset; unicode += kCmapGlyphOffset;
var width = ('width' in mapping) && isNum(mapping.width) ? mapping.width var width = isNum(mapping.width) ? mapping.width : defaultWidth;
: defaultWidth;
properties.encoding[code] = { properties.encoding[code] = {
unicode: unicode, unicode: unicode,
width: width width: width

View File

@ -8,6 +8,10 @@ body {
padding: 0px; padding: 0px;
} }
[hidden] {
display: none;
}
/* === Toolbar === */ /* === Toolbar === */
#controls { #controls {
background-color: #eee; background-color: #eee;

View File

@ -82,7 +82,7 @@
<div id="sidebarScrollView"> <div id="sidebarScrollView">
<div id="sidebarView"></div> <div id="sidebarView"></div>
</div> </div>
<div id="outlineScrollView" style="display:none"> <div id="outlineScrollView" hidden='true'>
<div id="outlineView"></div> <div id="outlineView"></div>
</div> </div>
<div id="sidebarControls"> <div id="sidebarControls">

View File

@ -186,7 +186,7 @@ var PDFView = {
load: function pdfViewLoad(data, scale) { load: function pdfViewLoad(data, scale) {
var loadingIndicator = document.getElementById('loading'); var loadingIndicator = document.getElementById('loading');
loadingIndicator.style.display = 'none'; loadingIndicator.setAttribute('hidden', 'true');
var sidebar = document.getElementById('sidebarView'); var sidebar = document.getElementById('sidebarView');
sidebar.parentNode.scrollTop = 0; sidebar.parentNode.scrollTop = 0;
@ -282,14 +282,14 @@ var PDFView = {
var outlineSwitchButton = document.getElementById('outlineSwitch'); var outlineSwitchButton = document.getElementById('outlineSwitch');
switch (view) { switch (view) {
case 'thumbs': case 'thumbs':
thumbsScrollView.style.display = 'block'; thumbsScrollView.removeAttribute('hidden');
outlineScrollView.style.display = 'none'; outlineScrollView.setAttribute('hidden', 'true');
thumbsSwitchButton.setAttribute('data-selected', true); thumbsSwitchButton.setAttribute('data-selected', true);
outlineSwitchButton.removeAttribute('data-selected'); outlineSwitchButton.removeAttribute('data-selected');
break; break;
case 'outline': case 'outline':
thumbsScrollView.style.display = 'none'; thumbsScrollView.setAttribute('hidden', 'true');
outlineScrollView.style.display = 'block'; outlineScrollView.removeAttribute('hidden');
thumbsSwitchButton.removeAttribute('data-selected'); thumbsSwitchButton.removeAttribute('data-selected');
outlineSwitchButton.setAttribute('data-selected', true); outlineSwitchButton.setAttribute('data-selected', true);
break; break;
@ -592,7 +592,7 @@ window.addEventListener('load', function webViewerLoad(evt) {
PDFView.open(params.file || kDefaultURL, parseFloat(scale)); PDFView.open(params.file || kDefaultURL, parseFloat(scale));
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) if (!window.File || !window.FileReader || !window.FileList || !window.Blob)
document.getElementById('fileInput').style.display = 'none'; document.getElementById('fileInput').setAttribute('hidden', 'true');
else else
document.getElementById('fileInput').value = null; document.getElementById('fileInput').value = null;
}, true); }, true);
@ -677,7 +677,7 @@ window.addEventListener('change', function webViewerChange(evt) {
document.title = file.name; document.title = file.name;
// URL does not reflect proper document location - hiding bookmark icon. // URL does not reflect proper document location - hiding bookmark icon.
document.getElementById('viewBookmark').style.display = 'none'; document.getElementById('viewBookmark').setAttribute('hidden', 'true');
}, true); }, true);
window.addEventListener('transitionend', function webViewerTransitionend(evt) { window.addEventListener('transitionend', function webViewerTransitionend(evt) {