From fbe839bc9606550761ce27249c93f7e0fcd806b9 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 3 Jan 2016 15:56:25 +1030 Subject: [PATCH] cairo: add missing font types (fontCIDType0COT and fontTrueTypeOT) bug 93559 --- poppler/CairoFontEngine.cc | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 1d611b5..3cff917 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -21,7 +21,7 @@ // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos // Copyright (C) 2007 Koji Otani // Copyright (C) 2008, 2009 Chris Wilson -// Copyright (C) 2008, 2012, 2014 Adrian Johnson +// Copyright (C) 2008, 2012, 2014, 2016 Adrian Johnson // Copyright (C) 2009 Darren Kenny // Copyright (C) 2010 Suzuki Toshiya // Copyright (C) 2010 Jan Kümmel @@ -499,6 +499,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, codeToGIDLen = n; /* Fall through */ case fontTrueType: + case fontTrueTypeOT: if (font_data != NULL) { ff = FoFiTrueType::make(font_data, font_data_len); } else { @@ -509,7 +510,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, goto err2; } /* This might be set already for the CIDType2 case */ - if (fontType == fontTrueType) { + if (fontType == fontTrueType || fontType == fontTrueTypeOT) { codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); codeToGIDLen = 256; } @@ -544,7 +545,41 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, goto err2; } break; - + + case fontCIDType0COT: + codeToGID = NULL; + n = 0; + if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { + n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); + if (n) { + codeToGID = (int *)gmallocn(n, sizeof(int)); + memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), + n * sizeof(int)); + } + } + codeToGIDLen = n; + + if (!codeToGID) { + if (!useCIDs) { + if (font_data != NULL) { + ff = FoFiTrueType::make(font_data, font_data_len); + } else { + ff = FoFiTrueType::load(fileNameC); + } + if (ff) { + if (ff->isOpenTypeCFF()) { + codeToGID = ff->getCIDToGIDMap((int *)&codeToGIDLen); + } + delete ff; + } + } + } + if (! _ft_new_face (lib, fileNameC, font_data, font_data_len, &face, &font_face)) { + error(errSyntaxError, -1, "could not create cid (OT) face\n"); + goto err2; + } + break; + default: fprintf (stderr, "font type %d not handled\n", (int)fontType); goto err2; -- 2.1.4