Back to index

plt-scheme  4.2.1
Public Member Functions | Public Attributes | Private Attributes
wxFontNameDirectory Class Reference

#include <FontDirectory.h>

Inheritance diagram for wxFontNameDirectory:
Inheritance graph
[legend]
Collaboration diagram for wxFontNameDirectory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxFontNameDirectory (void)
 ~wxFontNameDirectory ()
char * GetScreenName (int fontid, int weight, int style)
char * GetPostScriptName (int fontid, int weight, int style)
void SetScreenName (int fontid, int weight, int style, char *s)
void SetPostScriptName (int fontid, int weight, int style, char *s)
void Initialize (int fontid, int family, const char *name)
int GetNewFontId (void)
int FindOrCreateFontId (const char *name, int family)
int GetFontId (const char *name, int family)
char * GetFontName (int fontid)
int GetFamily (int fontid)
void install_cleanup ()
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
voidoperator new (size_t size, void *p)
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
void operator delete (void *obj)
void operator delete (void *, void *)
void operator delete (void *obj)
voidoperator new[] (size_t size)
voidoperator new[] (size_t size, GCPlacement gcp)
voidoperator new[] (size_t size, void *p)
void operator delete[] (void *obj)
void operator delete[] (void *, void *)

Public Attributes

WXTYPE __type
void__gc_external

Private Attributes

wxHashTabletable
int nextFontId

Detailed Description

Definition at line 39 of file FontDirectory.h.


Constructor & Destructor Documentation

Definition at line 329 of file FontDirectory.cxx.

{
  wxHashTable *ht;
  ht = new WXGC_PTRS wxHashTable(wxKEY_INTEGER, 20);
  table = ht;
  nextFontId = 100; /* Larger than all family ids */
}

Definition at line 337 of file FontDirectory.cxx.


Member Function Documentation

int wxFontNameDirectory::FindOrCreateFontId ( const char *  name,
int  family 
)

Definition at line 669 of file FontDirectory.cxx.

{
  int id;
  char *s;

  if ((id = GetFontId(name, family)))
    return id;

  id = GetNewFontId();
  s = new WXGC_ATOMIC char[strlen(name) + 2];
  strcpy(s + 1, name);
  s[0] = '@';
  Initialize(id, family, s);

  return id;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 814 of file FontDirectory.cxx.

{
  wxFontNameItem *item;
  item = (wxFontNameItem *)table->Get(fontid);
  
  if (!item)
    return wxDEFAULT;

  return item->family;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxFontNameDirectory::GetFontId ( const char *  name,
int  family 
)

Definition at line 796 of file FontDirectory.cxx.

{
  wxNode *node;

  table->BeginFind();

  while ((node = table->Next())) {
    wxFontNameItem *item;
    item = (wxFontNameItem *)node->Data();
    if (!item->isfamily 
       && !strcmp(name, item->name+1)
       && item->family == family)
      return item->id;
  }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 782 of file FontDirectory.cxx.

{
  wxFontNameItem *item;
  item = (wxFontNameItem *)table->Get(fontid);
  
  if (!item)
    return NULL;

  if (item->isfamily)
    return NULL;

  return item->name + 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 342 of file FontDirectory.cxx.

{
  return (nextFontId++);
}

Here is the caller graph for this function:

char * wxFontNameDirectory::GetPostScriptName ( int  fontid,
int  weight,
int  style 
)

Definition at line 746 of file FontDirectory.cxx.

{
  int wt, st;
  wxFontNameItem *item;

  item = (wxFontNameItem *)table->Get(fontid);

  if (!item)
    return NULL;

  wt = WCoordinate(weight);
  st = SCoordinate(style);

  /* Check for init */
  if (!item->printing->map[wt][st])
    item->printing->Initialize(item->name, "PostScript", wt, st, item->family);

  return item->printing->map[wt][st];
}

Here is the call graph for this function:

char * wxFontNameDirectory::GetScreenName ( int  fontid,
int  weight,
int  style 
)

Definition at line 686 of file FontDirectory.cxx.

{
  int wt, st;
  wxFontNameItem *item;

  item = (wxFontNameItem *)table->Get(fontid);
  
  if (!item)
    return NULL;

  wt = WCoordinate(weight);
  st = SCoordinate(style);

  /* Check for init */
  if (!item->screen->map[wt][st])
    item->screen->Initialize(item->name, "Screen", wt, st, item->family);

  return item->screen->map[wt][st];
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxFontNameDirectory::Initialize ( int  fontid,
int  family,
const char *  name 
)

Definition at line 655 of file FontDirectory.cxx.

{
  wxFontNameItem *item;
  
  item = new WXGC_PTRS wxFontNameItem;

  item->id = fontid;
  item->family = family;
  item->isfamily = (resname[0] != '@');
  item->name = copystring(resname);

  table->Put(fontid, item);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file wxGC.cxx.

{
  GC_finalization_proc old_fn;
  void *old_data;

# ifdef MZ_PRECISE_GC
#  define ALLOW_NON_BASE 0
#  define CHECK_BASE 0
# else
#  ifdef wx_xt
#   define ALLOW_NON_BASE 0
#   define CHECK_BASE 0
#  else
#   ifdef WIN32
#    define ALLOW_NON_BASE 0
#    define CHECK_BASE 1
#    define CRASH_ON_NONBASE 1
#   else
#    define ALLOW_NON_BASE 1
#    define CHECK_BASE 0
#   endif
#  endif
# endif

# if CHECK_BASE || ALLOW_NON_BASE
  if (GC_base(this) != (void *)this) {
#  if ALLOW_NON_BASE
    return;
#  else
#   ifdef CRASH_ON_NONBASE
    *(long *)0x0 = 1;
#   else
    printf("Clean-up object is not the base object\n");
    abort();
#   endif
#  endif
  }
# endif

  GC_register_finalizer_ignore_self(gcOBJ_TO_PTR(this), 
                                CAST_GCP GC_cleanup, NULL, 
                                CAST_GCPP &old_fn, &old_data);

# if CHECK_BASE
  if (old_fn) {
#  ifdef CRASH_ON_NONBASE
       *(long *)0x0 = 1;
#  else
    printf("Object already has a clean-up\n");
    abort();
#  endif
  }
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc::operator delete ( void obj) [inline, inherited]
void gc::operator delete ( void obj) [inline, inherited]

Definition at line 287 of file gc_cpp.h.

                                           {
    GC_FREE( obj );}

Here is the caller graph for this function:

void gc::operator delete ( void ,
void  
) [inline, inherited]

Definition at line 291 of file gc_cpp.h.

{}
void gc::operator delete[] ( void obj) [inline, inherited]

Definition at line 305 of file gc_cpp.h.

                                             {
    gc::operator delete( obj );}

Here is the call graph for this function:

void gc::operator delete[] ( void ,
void  
) [inline, inherited]

Definition at line 309 of file gc_cpp.h.

{}
void* gc::operator new ( size_t  size) [inline, inherited]
void* gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]
void * gc::operator new ( size_t  size) [inline, inherited]

Definition at line 273 of file gc_cpp.h.

                                           {
    return GC_MALLOC( size );}

Here is the caller graph for this function:

void * gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 276 of file gc_cpp.h.

                                                            {
    if (gcp == UseGC) 
        return GC_MALLOC( size );
    else if (gcp == PointerFreeGC)
       return GC_MALLOC_ATOMIC( size );
    else
        return GC_MALLOC_UNCOLLECTABLE( size );}
void * gc::operator new ( size_t  size,
void p 
) [inline, inherited]

Definition at line 284 of file gc_cpp.h.

                                                    {
    return p;}
void * gc::operator new[] ( size_t  size) [inline, inherited]

Definition at line 296 of file gc_cpp.h.

                                             {
    return gc::operator new( size );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 299 of file gc_cpp.h.

                                                              {
    return gc::operator new( size, gcp );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
void p 
) [inline, inherited]

Definition at line 302 of file gc_cpp.h.

                                                      {
    return p;}
void wxFontNameDirectory::SetPostScriptName ( int  fontid,
int  weight,
int  style,
char *  s 
)

Definition at line 766 of file FontDirectory.cxx.

{
  int wt, st;
  wxFontNameItem *item;

  item = (wxFontNameItem *)table->Get(fontid);

  if (!item)
    return;

  wt = WCoordinate(weight);
  st = SCoordinate(style);

  item->printing->map[wt][st] = s;
}

Here is the call graph for this function:

void wxFontNameDirectory::SetScreenName ( int  fontid,
int  weight,
int  style,
char *  s 
)

Definition at line 706 of file FontDirectory.cxx.

{
  int wt, st;
  wxFontNameItem *item;

  item = (wxFontNameItem *)table->Get(fontid);
  
  if (!item)
    return;

  wt = WCoordinate(weight);
  st = SCoordinate(style);

#ifdef wx_x
  {
    /* Safety: name must be less than 500 chars, and must not contain %
       except maybe one instance of %d. */
    int i, found_d = 0;
    for (i = 0; s[i]; i++) {
      if (i > 500) {
       s = NULL;
       break;
      }
      if (s[i] == '%') {
       if (found_d || (s[i+1] != 'd')) {
         s = NULL;
         break;
       } else
         found_d = 1;
      }
    }
  }

  if (!s)
    return;
#endif

  item->screen->map[wt][st] = s;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 146 of file wxGC.h.

WXTYPE wxObject::__type [inherited]

Definition at line 77 of file Object.h.

Definition at line 42 of file FontDirectory.h.

Definition at line 41 of file FontDirectory.h.


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