Back to index

tetex-bin  3.0
Public Member Functions | Private Attributes
GfxFontDict Class Reference

#include <GfxFont.h>

Collaboration diagram for GfxFontDict:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GfxFontDict (XRef *xref, Ref *fontDictRef, Dict *fontDict)
 ~GfxFontDict ()
GfxFontlookup (char *tag)
int getNumFonts ()
GfxFontgetFont (int i)

Private Attributes

GfxFont ** fonts
int numFonts

Detailed Description

Definition at line 293 of file GfxFont.h.


Constructor & Destructor Documentation

GfxFontDict::GfxFontDict ( XRef xref,
Ref fontDictRef,
Dict fontDict 
)

Definition at line 1449 of file GfxFont.cc.

                                                                     {
  int i;
  Object obj1, obj2;
  Ref r;

  numFonts = fontDict->getLength();
  fonts = (GfxFont **)gmalloc(numFonts * sizeof(GfxFont *));
  for (i = 0; i < numFonts; ++i) {
    fontDict->getValNF(i, &obj1);
    obj1.fetch(xref, &obj2);
    if (obj2.isDict()) {
      if (obj1.isRef()) {
       r = obj1.getRef();
      } else {
       // no indirect reference for this font, so invent a unique one
       // (legal generation numbers are five digits, so any 6-digit
       // number would be safe)
       r.num = i;
       if (fontDictRef) {
         r.gen = 100000 + fontDictRef->num;
       } else {
         r.gen = 999999;
       }
      }
      fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i),
                               r, obj2.getDict());
      if (fonts[i] && !fonts[i]->isOk()) {
       delete fonts[i];
       fonts[i] = NULL;
      }
    } else {
      error(-1, "font resource is not a dictionary");
      fonts[i] = NULL;
    }
    obj1.free();
    obj2.free();
  }
}

Here is the call graph for this function:

Definition at line 1488 of file GfxFont.cc.

                          {
  int i;

  for (i = 0; i < numFonts; ++i) {
    if (fonts[i]) {
      delete fonts[i];
    }
  }
  gfree(fonts);
}

Here is the call graph for this function:


Member Function Documentation

GfxFont* GfxFontDict::getFont ( int  i) [inline]

Definition at line 307 of file GfxFont.h.

{ return fonts[i]; }

Definition at line 306 of file GfxFont.h.

{ return numFonts; }
GfxFont * GfxFontDict::lookup ( char *  tag)

Definition at line 1499 of file GfxFont.cc.

                                      {
  int i;

  for (i = 0; i < numFonts; ++i) {
    if (fonts[i] && fonts[i]->matches(tag)) {
      return fonts[i];
    }
  }
  return NULL;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 311 of file GfxFont.h.

Definition at line 312 of file GfxFont.h.


The documentation for this class was generated from the following files: