+static float find_average_glyph_advance(gfxfont_t*f)
+{
+ if(!f->num_glyphs)
+ return 0.0;
+
+ float*values = (float*)malloc(sizeof(float)*f->num_glyphs);
+ int t;
+ for(t=0;t<f->num_glyphs;t++) {
+ values[t] = f->glyphs[t].advance;
+ }
+ float m = medianf(values, f->num_glyphs);
+ free(values);
+ return m;
+}
+
+gfxfont_t* FontInfo::getGfxFont()
+{
+ if(!this->gfxfont) {
+ this->gfxfont = createGfxFont(this);
+ this->gfxfont->id = strdup(this->id);
+ this->space_char = findSpace(this->gfxfont);
+ this->average_advance = find_average_glyph_advance(this->gfxfont);
+
+ if(this->space_char>=0) {
+ msg("<debug> Font %s has space char %d (unicode=%d)",
+ this->id, this->space_char,
+ this->gfxfont->glyphs[this->space_char].unicode);
+ } else if(config_addspace) {
+ this->space_char = addSpace(this->gfxfont);
+ msg("<debug> Appending space char to font %s, position %d", this->gfxfont->id, this->space_char);
+ }
+ }
+ return this->gfxfont;
+}
+
+GBool InfoOutputDev::upsideDown() {return gTrue;}
+GBool InfoOutputDev::useDrawChar() {return gTrue;}
+GBool InfoOutputDev::interpretType3Chars() {return gTrue;}
+GBool InfoOutputDev::useTilingPatternFill() {return gTrue;}
+
+void InfoOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+{
+ double x1,y1,x2,y2;
+ state->transform(crop_x1,crop_y1,&x1,&y1);
+ state->transform(crop_x2,crop_y2,&x2,&y2);
+ if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
+ if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
+ this->x1 = (int)x1;
+ this->y1 = (int)y1;
+ this->x2 = (int)x2;
+ this->y2 = (int)y2;
+ msg("<verbose> Generating info structure for page %d", pageNum);
+}
+void InfoOutputDev::endPage()
+{
+}
+void InfoOutputDev::drawLink(Link *link, Catalog *catalog)
+{
+ num_links++;
+}
+
+/* } else if(!strcmp(key,"fontquality")) {
+ this->config_fontquality = atof(value);
+ if(this->config_fontquality<=1)
+ this->config_fontquality=1;
+ } else if(!strcmp(key,"bigchar")) {
+ this->config_bigchar = atoi(value);
+ }
+ */
+