Fix bug 77557

This commit is contained in:
Oleg Korshul
2025-10-13 18:25:42 +03:00
parent c297eff6ec
commit bdcd70daa5
2 changed files with 44 additions and 13 deletions

View File

@ -721,23 +721,54 @@
return "Embedded: ";
};
window['AscFonts'].initEmbeddedFonts = function(fonts)
window['AscFonts'].initEmbeddedFonts = function(fonts, isMerge)
{
const prefix = AscFonts.getEmbeddedFontPrefix();
let fontFiles = AscFonts.g_font_files;
if (CFontFileLoaderEmbed.prototype.startIndex > 0)
fontFiles.splice(CFontFileLoaderEmbed.prototype.startIndex);
CFontFileLoaderEmbed.prototype.startIndex = fontFiles.length;
let currentIndex = CFontFileLoaderEmbed.prototype.startIndex;
for (let i = 0, len = fonts.length; i < len; i++)
if (!isMerge)
{
let name = prefix + fonts[i];
AscFonts.g_font_files.push(new CFontFileLoaderEmbed(name));
AscFonts.g_font_infos_embed.push(new CFontInfoEmbed(name, currentIndex++));
AscFonts.g_map_font_index_embed[name] = i;
if (CFontFileLoaderEmbed.prototype.startIndex > 0)
fontFiles.splice(CFontFileLoaderEmbed.prototype.startIndex);
CFontFileLoaderEmbed.prototype.startIndex = fontFiles.length;
let currentIndex = CFontFileLoaderEmbed.prototype.startIndex;
for (let i = 0, len = fonts.length; i < len; i++)
{
let name = prefix + fonts[i];
AscFonts.g_font_files.push(new CFontFileLoaderEmbed(name));
AscFonts.g_font_infos_embed.push(new CFontInfoEmbed(name, currentIndex++));
AscFonts.g_map_font_index_embed[name] = i;
}
}
else
{
let startIndex = CFontFileLoaderEmbed.prototype.startIndex;
let endIndex = fontFiles.length;
let currentIndex = endIndex;
for (let i = 0, len = fonts.length; i < len; i++)
{
let name = prefix + fonts[i];
let isFound = false;
for (let j = startIndex; j < endIndex; j++)
{
if (fontFiles[j].Id === name)
{
isFound = true;
break;
}
}
if (isFound)
continue;
AscFonts.g_font_files.push(new CFontFileLoaderEmbed(name));
AscFonts.g_font_infos_embed.push(new CFontInfoEmbed(name, currentIndex++));
AscFonts.g_map_font_index_embed[name] = i;
}
}
};

View File

@ -7382,7 +7382,7 @@ var CPresentation = CPresentation || function(){};
let standardFonts = oFile.nativeFile["getInteractiveFormsStandardFonts"]();
let embeddedFonts = oFile.nativeFile["getInteractiveFormsEmbeddedFonts"]();
AscFonts.initEmbeddedFonts(standardFonts.concat(embeddedFonts));
AscFonts.initEmbeddedFonts(standardFonts.concat(embeddedFonts), true);
this.Viewer.checkLoadCMap();
this.Viewer.navigateToPage(nNavigateTo);