"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/GfxFont.cc" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

GfxFont.cc  (xpdf-4.01.01):GfxFont.cc  (xpdf-4.02)
skipping to change at line 167 skipping to change at line 167
} }
if (encoding) { if (encoding) {
delete encoding; delete encoding;
} }
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// GfxFont // GfxFont
//------------------------------------------------------------------------ //------------------------------------------------------------------------
GfxFont *GfxFont::makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict) { GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA,
Ref idA, Dict *fontDict) {
GString *nameA; GString *nameA;
Ref embFontIDA; Ref embFontIDA;
GfxFontType typeA; GfxFontType typeA;
GfxFont *font; GfxFont *font;
Object obj1; Object obj1;
// get base font name // get base font name
nameA = NULL; nameA = NULL;
fontDict->lookup("BaseFont", &obj1); fontDict->lookup("BaseFont", &obj1);
if (obj1.isName()) { if (obj1.isName()) {
skipping to change at line 200 skipping to change at line 201
font = new Gfx8BitFont(xref, tagA, idA, nameA, typeA, embFontIDA, font = new Gfx8BitFont(xref, tagA, idA, nameA, typeA, embFontIDA,
fontDict); fontDict);
} else { } else {
font = new GfxCIDFont(xref, tagA, idA, nameA, typeA, embFontIDA, font = new GfxCIDFont(xref, tagA, idA, nameA, typeA, embFontIDA,
fontDict); fontDict);
} }
return font; return font;
} }
GfxFont::GfxFont(char *tagA, Ref idA, GString *nameA, GfxFont::GfxFont(const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Ref embFontIDA) { GfxFontType typeA, Ref embFontIDA) {
ok = gFalse; ok = gFalse;
tag = new GString(tagA); tag = new GString(tagA);
id = idA; id = idA;
name = nameA; name = nameA;
type = typeA; type = typeA;
embFontID = embFontIDA; embFontID = embFontIDA;
embFontName = NULL; embFontName = NULL;
hasToUnicode = gFalse; hasToUnicode = gFalse;
} }
skipping to change at line 544 skipping to change at line 545
ctu = CharCodeToUnicode::parseCMap(buf, nBits); ctu = CharCodeToUnicode::parseCMap(buf, nBits);
} }
delete buf; delete buf;
hasToUnicode = gTrue; hasToUnicode = gTrue;
return ctu; return ctu;
} }
GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) { GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
GfxFontLoc *fontLoc; GfxFontLoc *fontLoc;
SysFontType sysFontType; SysFontType sysFontType;
FoFiIdentifierType fft;
GString *path, *base14Name, *substName; GString *path, *base14Name, *substName;
PSFontParam16 *psFont16; PSFontParam16 *psFont16;
Object refObj, embFontObj; Object refObj, embFontObj;
int substIdx, fontNum; int substIdx, fontNum;
double oblique; double oblique;
GBool embed; GBool embed;
if (type == fontType3) { if (type == fontType3) {
return NULL; return NULL;
} }
skipping to change at line 638 skipping to change at line 640
path = globalParams->findBase14FontFile(base14Name, &fontNum, &oblique); path = globalParams->findBase14FontFile(base14Name, &fontNum, &oblique);
delete base14Name; delete base14Name;
if (path && (fontLoc = getExternalFont(path, fontNum, oblique, gFalse))) { if (path && (fontLoc = getExternalFont(path, fontNum, oblique, gFalse))) {
return fontLoc; return fontLoc;
} }
} }
//----- system font //----- system font
if (name && (path = globalParams->findSystemFontFile(name, &sysFontType, if (name && (path = globalParams->findSystemFontFile(name, &sysFontType,
&fontNum))) { &fontNum))) {
fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocExternal;
fontLoc->path = path;
fontLoc->fontNum = fontNum;
if (isCIDFont()) { if (isCIDFont()) {
if (sysFontType == sysFontTTF || sysFontType == sysFontTTC) { if (sysFontType == sysFontTTF || sysFontType == sysFontTTC) {
fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocExternal;
fontLoc->fontType = fontCIDType2; fontLoc->fontType = fontCIDType2;
fontLoc->path = path;
fontLoc->fontNum = fontNum;
return fontLoc; return fontLoc;
} else if (sysFontType == sysFontOTF) {
fft = FoFiIdentifier::identifyFile(fontLoc->path->getCString());
if (fft == fofiIdOpenTypeCFFCID) {
fontLoc->fontType = fontCIDType0COT;
return fontLoc;
} else if (fft == fofiIdTrueType) {
fontLoc->fontType = fontCIDType2;
return fontLoc;
}
} }
} else { } else {
if (sysFontType == sysFontTTF || sysFontType == sysFontTTC) { if (sysFontType == sysFontTTF || sysFontType == sysFontTTC) {
fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocExternal;
fontLoc->fontType = fontTrueType; fontLoc->fontType = fontTrueType;
fontLoc->path = path;
fontLoc->fontNum = fontNum;
return fontLoc; return fontLoc;
} else if (sysFontType == sysFontPFA || sysFontType == sysFontPFB) { } else if (sysFontType == sysFontPFA || sysFontType == sysFontPFB) {
fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocExternal;
fontLoc->fontType = fontType1; fontLoc->fontType = fontType1;
fontLoc->path = path;
return fontLoc; return fontLoc;
} else if (sysFontType == sysFontOTF) {
fft = FoFiIdentifier::identifyFile(fontLoc->path->getCString());
if (fft == fofiIdOpenTypeCFF8Bit) {
fontLoc->fontType = fontType1COT;
return fontLoc;
} else if (fft == fofiIdTrueType) {
fontLoc->fontType = fontTrueTypeOT;
return fontLoc;
}
} }
} }
delete path; delete fontLoc;
} }
if (!isCIDFont()) { if (!isCIDFont()) {
//----- 8-bit PS resident font //----- 8-bit PS resident font
if (ps) { if (ps) {
if (name && (path = globalParams->getPSResidentFont(name))) { if (name && (path = globalParams->getPSResidentFont(name))) {
fontLoc = new GfxFontLoc(); fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocResident; fontLoc->locType = gfxFontLocResident;
fontLoc->fontType = fontType1; fontLoc->fontType = fontType1;
skipping to change at line 866 skipping to change at line 879
obj2.free(); obj2.free();
obj1.free(); obj1.free();
return buf; return buf;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Gfx8BitFont // Gfx8BitFont
//------------------------------------------------------------------------ //------------------------------------------------------------------------
Gfx8BitFont::Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA, Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Ref embFontIDA, Dict *fontDict): GfxFontType typeA, Ref embFontIDA, Dict *fontDict):
GfxFont(tagA, idA, nameA, typeA, embFontIDA) GfxFont(tagA, idA, nameA, typeA, embFontIDA)
{ {
GString *name2; GString *name2;
BuiltinFont *builtinFont; BuiltinFont *builtinFont;
const char **baseEnc; const char **baseEnc;
char *buf; char *buf;
int len; int len;
FoFiType1 *ffT1; FoFiType1 *ffT1;
FoFiType1C *ffT1C; FoFiType1C *ffT1C;
skipping to change at line 1493 skipping to change at line 1506
// try the TrueType 'post' table to handle any unmapped characters // try the TrueType 'post' table to handle any unmapped characters
for (i = 0; i < 256; ++i) { for (i = 0; i < 256; ++i) {
if (map[i] <= 0 && (charName = enc[i])) { if (map[i] <= 0 && (charName = enc[i])) {
map[i] = ff->mapNameToGID(charName); map[i] = ff->mapNameToGID(charName);
} }
} }
return map; return map;
} }
int *Gfx8BitFont::getCodeToGIDMap(FoFiType1C *ff) {
int *map;
GHash *nameToGID;
int i, gid;
map = (int *)gmallocn(256, sizeof(int));
for (i = 0; i < 256; ++i) {
map[i] = 0;
}
nameToGID = ff->getNameToGIDMap();
for (i = 0; i < 256; ++i) {
if (!enc[i]) {
continue;
}
gid = nameToGID->lookupInt(enc[i]);
if (gid < 0 || gid >= 65536) {
continue;
}
map[i] = gid;
}
delete nameToGID;
return map;
}
Dict *Gfx8BitFont::getCharProcs() { Dict *Gfx8BitFont::getCharProcs() {
return charProcs.isDict() ? charProcs.getDict() : (Dict *)NULL; return charProcs.isDict() ? charProcs.getDict() : (Dict *)NULL;
} }
Object *Gfx8BitFont::getCharProc(int code, Object *proc) { Object *Gfx8BitFont::getCharProc(int code, Object *proc) {
if (enc[code] && charProcs.isDict()) { if (enc[code] && charProcs.isDict()) {
charProcs.dictLookup(enc[code], proc); charProcs.dictLookup(enc[code], proc);
} else { } else {
proc->initNull(); proc->initNull();
} }
skipping to change at line 1578 skipping to change at line 1618
// invalid font type -- which is ok, if we have a ToUnicode map or // invalid font type -- which is ok, if we have a ToUnicode map or
// an encoding // an encoding
return !hasToUnicode && !hasEncoding; return !hasToUnicode && !hasEncoding;
} }
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// GfxCIDFont // GfxCIDFont
//------------------------------------------------------------------------ //------------------------------------------------------------------------
GfxCIDFont::GfxCIDFont(XRef *xref, char *tagA, Ref idA, GString *nameA, GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Ref embFontIDA, Dict *fontDict): GfxFontType typeA, Ref embFontIDA, Dict *fontDict):
GfxFont(tagA, idA, nameA, typeA, embFontIDA) GfxFont(tagA, idA, nameA, typeA, embFontIDA)
{ {
Dict *desFontDict; Dict *desFontDict;
Object desFontDictObj; Object desFontDictObj;
Object obj1, obj2, obj3, obj4, obj5, obj6; Object obj1, obj2, obj3, obj4, obj5, obj6;
CharCodeToUnicode *utu; CharCodeToUnicode *utu;
CharCode c; CharCode c;
Unicode uBuf[8]; Unicode uBuf[8];
int c1, c2; int c1, c2;
skipping to change at line 2004 skipping to change at line 2044
if (ctu) { if (ctu) {
ctu->incRefCnt(); ctu->incRefCnt();
} }
return ctu; return ctu;
} }
GString *GfxCIDFont::getCollection() { GString *GfxCIDFont::getCollection() {
return cMap ? cMap->getCollection() : (GString *)NULL; return cMap ? cMap->getCollection() : (GString *)NULL;
} }
double GfxCIDFont::getWidth(CID cid) {
double w;
getHorizontalMetrics(cid, &w);
return w;
}
GBool GfxCIDFont::problematicForUnicode() { GBool GfxCIDFont::problematicForUnicode() {
GString *nameLC; GString *nameLC;
GBool symbolic; GBool symbolic;
// potential inputs: // potential inputs:
// - font is embedded (GfxFont.embFontID.num >= 0) // - font is embedded (GfxFont.embFontID.num >= 0)
// - font name (GfxFont.name) // - font name (GfxFont.name)
// - font type (GfxFont.type) // - font type (GfxFont.type)
// - symbolic (GfxFont.flags & fontSymbolic) // - symbolic (GfxFont.flags & fontSymbolic)
// - has a ToUnicode map (GfxFont.hasToUnicode) // - has a ToUnicode map (GfxFont.hasToUnicode)
 End of changes. 17 change blocks. 
16 lines changed or deleted 63 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)