- return fontname;
-
-/* ------------------------------ V2 */
-
-/* //substitute font
- char* fontname = 0;
- double m11, m12, m21, m22;
- int index;
- int code;
- double w,w1,w2;
- double*fm;
- double v;
- if(gfxFont->getName()) {
- fontname = gfxFont->getName()->getCString();
- }
-
-// printf("%d %s\n", t, gfxFont->getCharName(t));
- showFontError(gfxFont, 1);
- if(1) { //if (!gfxFont->isCIDFont()) { FIXME: xpdf 1.01 does not have is16Bit()
- if(gfxFont->isSymbolic()) {
- if(fontname && (strstr(fontname,"ing"))) //Dingbats, Wingdings etc.
- index = 16;
- else
- index = 12;
- } else if (gfxFont->isFixedWidth()) {
- index = 8;
- } else if (gfxFont->isSerif()) {
- index = 4;
- } else {
- index = 0;
- }
- if (gfxFont->isBold() && index!=16)
- index += 2;
- if (gfxFont->isItalic() && index!=16)
- index += 1;
- fontname = fontnames[index];
- // get width of 'm' in real font and substituted font
- if ((code = gfxFont->getCharCode("m")) >= 0)
- w1 = gfxFont->getWidth(code);
- else
- w1 = 0;
- w2 = fontsizes[index];
- if (gfxFont->getType() == fontType3) {
- // This is a hack which makes it possible to substitute for some
- // Type 3 fonts. The problem is that it's impossible to know what
- // the base coordinate system used in the font is without actually
- // rendering the font. This code tries to guess by looking at the
- // width of the character 'm' (which breaks if the font is a
- // subset that doesn't contain 'm').
- if (w1 > 0 && (w1 > 1.1 * w2 || w1 < 0.9 * w2)) {
- w1 /= w2;
- m11 *= w1;
- m12 *= w1;
- m21 *= w1;
- m22 *= w1;
- }
- fm = gfxFont->getFontMatrix();
- v = (fm[0] == 0) ? 1 : (fm[3] / fm[0]);
- m21 *= v;
- m22 *= v;
- } else if (!gfxFont->isSymbolic()) {
- // if real font is substantially narrower than substituted
- // font, reduce the font size accordingly
- if (w1 > 0.01 && w1 < 0.9 * w2) {
- w1 /= w2;
- if (w1 < 0.8) {
- w1 = 0.8;
- }
- m11 *= w1;
- m12 *= w1;
- m21 *= w1;
- m22 *= w1;
- }
- }
- }
- if(fontname) {
- this->t1id = searchT1Font(fontname);
- }
- if(substitutepos>=sizeof(substitutesource)/sizeof(char*)) {
- logf("<fatal> Too many fonts in file.");
- exit(1);
- }
- if(oldname) {
- substitutesource[substitutepos] = oldname;
- substitutetarget[substitutepos] = fontname;
- logf("<verbose> substituting %s -> %s", FIXNULL(oldname), FIXNULL(fontname));
- substitutepos ++;
- }
- return fontname;*/