Back to index

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

#include <Font.h>

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

List of all members.

Public Member Functions

 wxFont (void)
 wxFont (int PointSize, int FontIdOrFamily, int Style, int Weight, Bool underlined=FALSE, int smoothing=wxSMOOTHING_DEFAULT, Bool sip=FALSE, double Rotation=0.0)
 wxFont (int PointSize, const char *Face, int Family, int Style, int Weight, Bool underlined=FALSE, int smoothing=wxSMOOTHING_DEFAULT, Bool sip=FALSE)
 ~wxFont (void)
void InitFont (void)
int GetPointSize (void)
int GetFamily (void)
char * GetFamilyString (void)
int GetFontId (void)
char * GetFaceString (void)
int GetStyle (void)
char * GetStyleString (void)
int GetWeight (void)
char * GetWeightString (void)
Bool GetUnderlined (void)
int GetSmoothing (void)
int GetSizeInPixels (void)
Bool ScreenGlyphAvailable (int c, Bool for_label=FALSE)
wxFontGetRotated (double angle)
int CanRotate ()
voidGetInternalFont (double scale_x=1.0, double scale_y=1.0, double angle=0.0)
voidGetInternalAAFont (double scale_x=1.0, double scale_y=1.0, double angle=0.0)
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

wxListscaled_xfonts
wxListrotated_fonts
short point_size
short family
short style
short weight
Bool underlined
Bool size_in_pixels
int font_id
int smoothing
double rotation
char * main_screen_name

Detailed Description

Definition at line 42 of file Font.h.


Constructor & Destructor Documentation

Definition at line 258 of file Font.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

wxFont::wxFont ( int  PointSize,
int  FontIdOrFamily,
int  Style,
int  Weight,
Bool  underlined = FALSE,
int  smoothing = wxSMOOTHING_DEFAULT,
Bool  sip = FALSE,
double  Rotation = 0.0 
)

Definition at line 271 of file Font.cc.

{
    font_id       = FontIdOrFamily;
    family        = wxTheFontNameDirectory->GetFamily(FontIdOrFamily);
    style         = Style;
    weight        = Weight == wxNORMAL ? wxNORMAL_WEIGHT : Weight;
    point_size    = PointSize;
    underlined    = Underlined;
    smoothing     = Smoothing;
    size_in_pixels = sip;
    rotation      = Rotation;

    InitFont();
}

Here is the call graph for this function:

wxFont::wxFont ( int  PointSize,
const char *  Face,
int  Family,
int  Style,
int  Weight,
Bool  underlined = FALSE,
int  smoothing = wxSMOOTHING_DEFAULT,
Bool  sip = FALSE 
)

Definition at line 287 of file Font.cc.

{
    font_id       = wxTheFontNameDirectory->FindOrCreateFontId(Face, Family);
    family        = wxTheFontNameDirectory->GetFamily(font_id);
    style         = Style;
    weight        = Weight == wxNORMAL ? wxNORMAL_WEIGHT : Weight;
    point_size    = PointSize;
    underlined    = Underlined;
    smoothing     = Smoothing;
    size_in_pixels = sip;
    rotation      = 0.0;

    InitFont();
}

Here is the call graph for this function:

Definition at line 320 of file Font.cc.

{
  wxNode *node;
  node = scaled_xfonts->First();
  while (node) {
    XFontStruct *xfont;
    wxNode *next;
    xfont = (XFontStruct*)node->Data();
    next = node->Next();
    XFreeFont(wxAPP_DISPLAY, xfont);
    node = next;
  }
  DELETE_OBJ scaled_xfonts;

#ifdef  WX_USE_XFT
  node = scaled_xft_fonts->First();
  while (node) {
    wxFontStruct *xfont;
    xfont = (wxFontStruct*)node->Data();
    if (xfont != (wxFontStruct *)0x1)
      XftFontClose(wxAPP_DISPLAY, xfont);
    node = node->Next();
  }
  DELETE_OBJ scaled_xft_fonts;

  if (substitute_xft_fonts) {
    node = substitute_xft_fonts->First();
    while (node) {
      wxFont *sfont;
      sfont = (wxFont*)node->Data();
      DELETE_OBJ sfont;
      node = node->Next();
    }
    DELETE_OBJ substitute_xft_fonts;
  }
#endif

  if (rotated_fonts) {
    node = rotated_fonts->First();
    while (node) {
      wxFont *rot;
      rot = (wxFont*)node->Data();
      DELETE_OBJ rot;
      node = node->Next();
    }
    DELETE_OBJ rotated_fonts;
  }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 452 of file Font.cc.

{
  return 1;
}

Definition at line 369 of file Font.cc.

{
  /* If it's one of the portable facelss fonts, return NULL. */
  switch (font_id) {
  case wxDEFAULT:
  case wxDECORATIVE:
  case wxMODERN:
  case wxROMAN:
  case wxSCRIPT:
  case wxSWISS:
  case wxTELETYPE:
  case wxSYSTEM:
  case wxSYMBOL:
    return NULL;
  default:
    return wxTheFontNameDirectory->GetFontName(font_id); 
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxFont::GetFamily ( void  ) [inline]

Definition at line 56 of file Font.h.

{ return family; }

Here is the caller graph for this function:

char* wxFont::GetFamilyString ( void  ) [inline]

Definition at line 57 of file Font.h.

{ return wx_font_spec[family]; }
int wxFont::GetFontId ( void  ) [inline]

Definition at line 58 of file Font.h.

{ return font_id; }

Here is the caller graph for this function:

void * wxFont::GetInternalAAFont ( double  scale_x = 1.0,
double  scale_y = 1.0,
double  angle = 0.0 
)

Definition at line 522 of file Font.cc.

{
#ifdef WX_USE_XFT
  if (wxXRenderHere()) {
    char        sbuf[128];
    wxNode      *node=NULL;
    wxFontStruct *xft_font;


    if (angle != rotation) {
      wxFont *rot;
      rot = GetRotated(angle);
      return rot->GetInternalAAFont(scale_x, scale_y, angle);
    }

    limit_point_scale(point_size, &scale_x, &scale_y);
    sprintf(sbuf, "%g %g", scale_x, scale_y);

    if ((node = scaled_xft_fonts->Find(sbuf))) {
      xft_font = (wxFontStruct*)node->Data();
    } else {
      xft_font = wxLoadQueryNearestAAFont(main_screen_name,
                                     point_size, scale_x, scale_y, 
                                     style, weight,
                                     underlined, smoothing, size_in_pixels, angle);

      /* Record a 0x1 to mean "no AA font": */
      if (!xft_font)
       xft_font = (wxFontStruct*)0x1;

      scaled_xft_fonts->Append(sbuf, (wxObject*)xft_font);
    }
    if (xft_font == (wxFontStruct*)0x1)
      return NULL;    
    return (void*)xft_font;
  } else
    return NULL;
#else
    return GetInternalFont(scale_x, scale_y, angle);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void * wxFont::GetInternalFont ( double  scale_x = 1.0,
double  scale_y = 1.0,
double  angle = 0.0 
)

Definition at line 491 of file Font.cc.

{
  char        sbuf[128];
  wxNode      *node=NULL;
  XFontStruct *xfont;

  if (angle != rotation) {
    wxFont *rot;
    rot = GetRotated(angle);
    return rot->GetInternalFont(scale_x, scale_y, angle);
  }

  limit_point_scale(point_size, &scale_x, &scale_y);
  sprintf(sbuf, "%g %g", scale_x, scale_y);

  if ((node = scaled_xfonts->Find(sbuf))) {
    xfont = (XFontStruct*)node->Data();
  } else {
    xfont = wxLoadQueryNearestFont(main_screen_name,
                               point_size, scale_x, scale_y, 
                               font_id, family, style, weight,
                               underlined, size_in_pixels, angle);
    scaled_xfonts->Append(sbuf, (wxObject*)xfont);
  }
  return (void*)xfont;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxFont::GetPointSize ( void  ) [inline]

Definition at line 55 of file Font.h.

{ return point_size; }

Here is the caller graph for this function:

wxFont * wxFont::GetRotated ( double  angle)

Definition at line 457 of file Font.cc.

{
  int int_angle = (int)(angle * 1000);
  wxNode *node;
  wxFont *rot;

  if (!rotated_fonts) {
    rotated_fonts = new wxList(wxKEY_INTEGER);
  }

  node = rotated_fonts->Find(int_angle);
  if (node)
    return (wxFont *)node->Data();

  rot = new wxFont(point_size, font_id, style, weight,
                 underlined, smoothing, size_in_pixels, angle);
  
  rotated_fonts->Append(int_angle, (wxObject*)rot);

  return rot;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 66 of file Font.h.

{ return size_in_pixels; }

Here is the caller graph for this function:

int wxFont::GetSmoothing ( void  ) [inline]

Definition at line 65 of file Font.h.

{ return smoothing; }

Here is the caller graph for this function:

int wxFont::GetStyle ( void  ) [inline]

Definition at line 60 of file Font.h.

{ return style; }

Here is the caller graph for this function:

char* wxFont::GetStyleString ( void  ) [inline]

Definition at line 61 of file Font.h.

{ return wx_font_spec[style]; }

Definition at line 64 of file Font.h.

{ return underlined; }

Here is the caller graph for this function:

int wxFont::GetWeight ( void  ) [inline]

Definition at line 62 of file Font.h.

Here is the caller graph for this function:

char* wxFont::GetWeightString ( void  ) [inline]

Definition at line 63 of file Font.h.

{ return wx_font_spec[weight]; }

Definition at line 303 of file Font.cc.

{
  wxList *sl;
  
  __type = wxTYPE_FONT;
  
  sl = new wxList(wxKEY_STRING, FALSE);
  scaled_xfonts = sl;

#ifdef WX_USE_XFT
  sl = new wxList(wxKEY_STRING, FALSE);
  scaled_xft_fonts = sl;
#endif

  main_screen_name = wxTheFontNameDirectory->GetScreenName(font_id, weight, style);
}

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;}
Bool wxFont::ScreenGlyphAvailable ( int  c,
Bool  for_label = FALSE 
)

Definition at line 388 of file Font.cc.

{
  XFontStruct *fontinfo;
#ifdef WX_USE_XFT
  wxFontStruct *xfontinfo;
#endif
  unsigned int byte1, byte2;
  int char_metric_offset;

#ifdef WX_USE_XFT
  xfontinfo = (wxFontStruct*)GetInternalAAFont(1.0, 1.0);
  if (xfontinfo)
    fontinfo = NULL;
  else
#endif
    fontinfo = (XFontStruct*)GetInternalFont(1.0, 1.0);

# ifdef WX_USE_XFT
  if (xfontinfo) {
    int index = 1;
    while (1) {
      if (XftGlyphExists(wxAPP_DISPLAY, xfontinfo, c))
       return TRUE;
      
      xfontinfo = (wxFontStruct*)GetNextAASubstitution(index++, c, 1.0, 1.0, 0.0);
      if (!xfontinfo)
       return FALSE;
    }
  }
#endif

  byte2 = c & 0xff;
  byte1 = c >> 8;

  if ((byte1 < fontinfo->min_byte1) 
      || (byte1 > fontinfo->max_byte1))
    return FALSE;

  if ((byte2 < fontinfo->min_char_or_byte2) 
      || (byte2 > fontinfo->max_char_or_byte2)) {
    return FALSE;
  }

  if (fontinfo->all_chars_exist
      || !fontinfo->per_char)
    return TRUE;

  char_metric_offset = ((byte1 - fontinfo->min_byte1)
                     * (fontinfo->max_char_or_byte2 - fontinfo->min_char_or_byte2 + 1)
                     - fontinfo->min_char_or_byte2
                     + byte2);

  if (!fontinfo->per_char[char_metric_offset].width
      && !fontinfo->per_char[char_metric_offset].ascent
      && !fontinfo->per_char[char_metric_offset].descent)
    return FALSE;
  
  return TRUE;
}

Here is the call graph for this function:

Here is the caller 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.

short wxFont::family [private]

Definition at line 89 of file Font.h.

int wxFont::font_id [private]

Definition at line 91 of file Font.h.

char* wxFont::main_screen_name [private]

Definition at line 94 of file Font.h.

short wxFont::point_size [private]

Definition at line 88 of file Font.h.

Definition at line 87 of file Font.h.

double wxFont::rotation [private]

Definition at line 93 of file Font.h.

Definition at line 82 of file Font.h.

Definition at line 90 of file Font.h.

Definition at line 92 of file Font.h.

short wxFont::style [private]

Definition at line 89 of file Font.h.

Definition at line 90 of file Font.h.

short wxFont::weight [private]

Definition at line 89 of file Font.h.


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