View | Details | Raw Unified | Return to bug 152780
Collapse All | Expand All

(-)../poppler-0.4.5/poppler/Gfx.cc (+2 lines)
Lines 2154-2159 void Gfx::opSetFont(Object args[], int n Link Here
2154
	   args[1].getNum());
2154
	   args[1].getNum());
2155
    fflush(stdout);
2155
    fflush(stdout);
2156
  }
2156
  }
2157
2158
  font->incRefCnt();
2157
  state->setFont(font, args[1].getNum());
2159
  state->setFont(font, args[1].getNum());
2158
  fontChanged = gTrue;
2160
  fontChanged = gTrue;
2159
}
2161
}
(-)../poppler-0.4.5/poppler/GfxFont.cc (-1 / +13 lines)
Lines 147-152 GfxFont::GfxFont(char *tagA, Ref idA, Go Link Here
147
  family = NULL;
147
  family = NULL;
148
  stretch = StretchNotDefined;
148
  stretch = StretchNotDefined;
149
  weight = WeightNotDefined;
149
  weight = WeightNotDefined;
150
  refCnt = 1;
150
}
151
}
151
152
152
GfxFont::~GfxFont() {
153
GfxFont::~GfxFont() {
Lines 166-171 GfxFont::~GfxFont() { Link Here
166
  }
167
  }
167
}
168
}
168
169
170
void GfxFont::incRefCnt() {
171
  refCnt++;
172
}
173
174
void GfxFont::decRefCnt() {
175
  if (--refCnt == 0)
176
    delete this;
177
}
178
169
void GfxFont::readFontDescriptor(XRef *xref, Dict *fontDict) {
179
void GfxFont::readFontDescriptor(XRef *xref, Dict *fontDict) {
170
  Object obj1, obj2, obj3, obj4;
180
  Object obj1, obj2, obj3, obj4;
171
  double t;
181
  double t;
Lines 459-464 Gfx8BitFont::Gfx8BitFont(XRef *xref, cha Link Here
459
  Object obj1, obj2, obj3;
469
  Object obj1, obj2, obj3;
460
  int n, i, a, b, m;
470
  int n, i, a, b, m;
461
471
472
  refCnt = 1;
462
  type = typeA;
473
  type = typeA;
463
  ctu = NULL;
474
  ctu = NULL;
464
475
Lines 1086-1091 GfxCIDFont::GfxCIDFont(XRef *xref, char Link Here
1086
  int c1, c2;
1097
  int c1, c2;
1087
  int excepsSize, i, j, k;
1098
  int excepsSize, i, j, k;
1088
1099
1100
  refCnt = 1;
1089
  ascent = 0.95;
1101
  ascent = 0.95;
1090
  descent = -0.35;
1102
  descent = -0.35;
1091
  fontBBox[0] = fontBBox[1] = fontBBox[2] = fontBBox[3] = 0;
1103
  fontBBox[0] = fontBBox[1] = fontBBox[2] = fontBBox[3] = 0;
Lines 1530-1536 GfxFontDict::~GfxFontDict() { Link Here
1530
1542
1531
  for (i = 0; i < numFonts; ++i) {
1543
  for (i = 0; i < numFonts; ++i) {
1532
    if (fonts[i]) {
1544
    if (fonts[i]) {
1533
      delete fonts[i];
1545
      fonts[i]->decRefCnt();
1534
    }
1546
    }
1535
  }
1547
  }
1536
  gfree(fonts);
1548
  gfree(fonts);
(-)../poppler-0.4.5/poppler/GfxFont.h (+4 lines)
Lines 115-120 public: Link Here
115
115
116
  GBool isOk() { return ok; }
116
  GBool isOk() { return ok; }
117
117
118
  void incRefCnt();
119
  void decRefCnt();
120
118
  // Get font tag.
121
  // Get font tag.
119
  GooString *getTag() { return tag; }
122
  GooString *getTag() { return tag; }
120
123
Lines 215-220 protected: Link Here
215
  double missingWidth;		// "default" width
218
  double missingWidth;		// "default" width
216
  double ascent;		// max height above baseline
219
  double ascent;		// max height above baseline
217
  double descent;		// max depth below baseline
220
  double descent;		// max depth below baseline
221
  int refCnt;
218
  GBool ok;
222
  GBool ok;
219
};
223
};
220
224
(-)../poppler-0.4.5/poppler/GfxState.cc (+7 lines)
Lines 21-26 Link Here
21
#include "Array.h"
21
#include "Array.h"
22
#include "Page.h"
22
#include "Page.h"
23
#include "GfxState.h"
23
#include "GfxState.h"
24
#include "GfxFont.h"
24
25
25
//------------------------------------------------------------------------
26
//------------------------------------------------------------------------
26
27
Lines 2676-2681 GfxState::~GfxState() { Link Here
2676
  if (saved) {
2677
  if (saved) {
2677
    delete saved;
2678
    delete saved;
2678
  }
2679
  }
2680
  if (font) {
2681
    font->decRefCnt();
2682
  }
2679
}
2683
}
2680
2684
2681
// Used for copy();
2685
// Used for copy();
Lines 2697-2702 GfxState::GfxState(GfxState *state) { Link Here
2697
    lineDash = (double *)gmalloc(lineDashLength * sizeof(double));
2701
    lineDash = (double *)gmalloc(lineDashLength * sizeof(double));
2698
    memcpy(lineDash, state->lineDash, lineDashLength * sizeof(double));
2702
    memcpy(lineDash, state->lineDash, lineDashLength * sizeof(double));
2699
  }
2703
  }
2704
  if (font)
2705
    font->incRefCnt();
2706
2700
  saved = NULL;
2707
  saved = NULL;
2701
}
2708
}
2702
2709
(-)../poppler-0.4.5/poppler/TextOutputDev.cc (+5 lines)
Lines 118-123 Link Here
118
118
119
TextFontInfo::TextFontInfo(GfxState *state) {
119
TextFontInfo::TextFontInfo(GfxState *state) {
120
  gfxFont = state->getFont();
120
  gfxFont = state->getFont();
121
  if (gfxFont)
122
    gfxFont->incRefCnt ();
121
#if TEXTOUT_WORD_LIST
123
#if TEXTOUT_WORD_LIST
122
  fontName = (gfxFont && gfxFont->getOrigName())
124
  fontName = (gfxFont && gfxFont->getOrigName())
123
                 ? gfxFont->getOrigName()->copy()
125
                 ? gfxFont->getOrigName()->copy()
Lines 126-131 TextFontInfo::TextFontInfo(GfxState *sta Link Here
126
}
128
}
127
129
128
TextFontInfo::~TextFontInfo() {
130
TextFontInfo::~TextFontInfo() {
131
  if (gfxFont)
132
    gfxFont->decRefCnt ();
129
#if TEXTOUT_WORD_LIST
133
#if TEXTOUT_WORD_LIST
130
  if (fontName) {
134
  if (fontName) {
131
    delete fontName;
135
    delete fontName;
Lines 3298-3303 void TextSelectionPainter::visitWord (Te Link Here
3298
3302
3299
  state->setFillColor(glyph_color);
3303
  state->setFillColor(glyph_color);
3300
  out->updateFillColor(state);
3304
  out->updateFillColor(state);
3305
  word->font->gfxFont->incRefCnt();
3301
  state->setFont(word->font->gfxFont, word->fontSize);
3306
  state->setFont(word->font->gfxFont, word->fontSize);
3302
  out->updateFont(state);
3307
  out->updateFont(state);
3303
3308

Return to bug 152780