Back to index

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

#include <BuiltinFont.h>

Collaboration diagram for BuiltinFontWidths:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BuiltinFontWidths (BuiltinFontWidth *widths, int sizeA)
 ~BuiltinFontWidths ()
GBool getWidth (char *name, Gushort *width)

Private Member Functions

int hash (char *name)

Private Attributes

BuiltinFontWidth ** tab
int size

Detailed Description

Definition at line 42 of file BuiltinFont.h.


Constructor & Destructor Documentation

Definition at line 23 of file BuiltinFont.cc.

                                                                        {
  int i, h;

  size = sizeA;
  tab = (BuiltinFontWidth **)gmalloc(size * sizeof(BuiltinFontWidth *));
  for (i = 0; i < size; ++i) {
    tab[i] = NULL;
  }
  for (i = 0; i < sizeA; ++i) {
    h = hash(widths[i].name);
    widths[i].next = tab[h];
    tab[h] = &widths[i];
  }
}

Here is the call graph for this function:

Definition at line 38 of file BuiltinFont.cc.

                                      {
  gfree(tab);
}

Here is the call graph for this function:


Member Function Documentation

GBool BuiltinFontWidths::getWidth ( char *  name,
Gushort width 
)

Definition at line 42 of file BuiltinFont.cc.

                                                            {
  int h;
  BuiltinFontWidth *p;

  h = hash(name);
  for (p = tab[h]; p; p = p->next) {
    if (!strcmp(p->name, name)) {
      *width = p->width;
      return gTrue;
    }
  }
  return gFalse;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int BuiltinFontWidths::hash ( char *  name) [private]

Definition at line 56 of file BuiltinFont.cc.

                                      {
  char *p;
  unsigned int h;

  h = 0;
  for (p = name; *p; ++p) {
    h = 17 * h + (int)(*p & 0xff);
  }
  return (int)(h % size);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 54 of file BuiltinFont.h.

Definition at line 53 of file BuiltinFont.h.


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