Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsXFontNormal Class Reference

#include <nsXFontNormal.h>

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

List of all members.

Public Member Functions

 nsXFontNormal (GdkFont *)
 ~nsXFontNormal ()
void DrawText8 (GdkDrawable *Drawable, GdkGC *GC, PRInt32, PRInt32, const char *, PRUint32)
void DrawText16 (GdkDrawable *Drawable, GdkGC *GC, PRInt32, PRInt32, const XChar2b *, PRUint32)
PRBool GetXFontProperty (Atom, unsigned long *)
XFontStruct * GetXFontStruct ()
PRBool LoadFont ()
void TextExtents8 (const char *, PRUint32, PRInt32 *, PRInt32 *, PRInt32 *, PRInt32 *, PRInt32 *)
void TextExtents16 (const XChar2b *, PRUint32, PRInt32 *, PRInt32 *, PRInt32 *, PRInt32 *, PRInt32 *)
PRInt32 TextWidth8 (const char *, PRUint32)
PRInt32 TextWidth16 (const XChar2b *, PRUint32)
void UnloadFont ()
PRBool IsSingleByte ()

Protected Attributes

GdkFont * mGdkFont
PRBool mIsSingleByte

Detailed Description

Definition at line 50 of file nsXFontNormal.h.


Constructor & Destructor Documentation

nsXFontNormal::nsXFontNormal ( GdkFont *  aGdkFont)

Definition at line 95 of file nsXFontNormal.cpp.

{
  mGdkFont = ::gdk_font_ref(aGdkFont);
}

Definition at line 146 of file nsXFontNormal.cpp.

{
  if (mGdkFont) {
    ::gdk_font_unref(mGdkFont);
  }
}

Member Function Documentation

void nsXFontNormal::DrawText16 ( GdkDrawable *  Drawable,
GdkGC *  GC,
PRInt32  aX,
PRInt32  aY,
const XChar2b *  aString,
PRUint32  aLength 
) [virtual]

Implements nsXFont.

Definition at line 55 of file nsXFontNormal.cpp.

{
  my_gdk_draw_text(aDrawable, mGdkFont, aGC, aX, aY,
                   (const char *)aString, aLength*2);
}

Here is the call graph for this function:

void nsXFontNormal::DrawText8 ( GdkDrawable *  Drawable,
GdkGC *  GC,
PRInt32  aX,
PRInt32  aY,
const char *  aString,
PRUint32  aLength 
) [virtual]

Implements nsXFont.

Definition at line 47 of file nsXFontNormal.cpp.

{
  my_gdk_draw_text(aDrawable, mGdkFont, aGC, aX, aY, aString, aLength);
}

Here is the call graph for this function:

PRBool nsXFontNormal::GetXFontProperty ( Atom  aAtom,
unsigned long aValue 
) [virtual]

Implements nsXFont.

Definition at line 64 of file nsXFontNormal.cpp.

{
  NS_ASSERTION(mGdkFont, "GetXFontProperty called before font loaded");
  if (mGdkFont==nsnull)
    return PR_FALSE;

  XFontStruct *fontInfo = (XFontStruct *)GDK_FONT_XFONT(mGdkFont);

  return ::XGetFontProperty(fontInfo, aAtom, aValue);
}
XFontStruct * nsXFontNormal::GetXFontStruct ( ) [virtual]

Implements nsXFont.

Definition at line 76 of file nsXFontNormal.cpp.

{
  NS_ASSERTION(mGdkFont, "GetXFontStruct called before font loaded");
  if (mGdkFont==nsnull)
    return nsnull;

  return (XFontStruct *)GDK_FONT_XFONT(mGdkFont);
}
PRBool nsXFont::IsSingleByte ( ) [inline, inherited]

Definition at line 52 of file nsXFont.h.

{ return mIsSingleByte; };

Here is the caller graph for this function:

Implements nsXFont.

Definition at line 86 of file nsXFontNormal.cpp.

{
  if (!mGdkFont)
    return PR_FALSE;
  XFontStruct *fontInfo = (XFontStruct *)GDK_FONT_XFONT(mGdkFont);
  mIsSingleByte = (fontInfo->min_byte1 == 0) && (fontInfo->max_byte1 == 0);
  return PR_TRUE;
}
void nsXFontNormal::TextExtents16 ( const XChar2b *  aString,
PRUint32  aLength,
PRInt32 aLBearing,
PRInt32 aRBearing,
PRInt32 aWidth,
PRInt32 aAscent,
PRInt32 aDescent 
) [virtual]

Implements nsXFont.

Definition at line 111 of file nsXFontNormal.cpp.

{
  gdk_text_extents(mGdkFont, (const char *)aString, aLength*2,
                    aLBearing, aRBearing, aWidth, aAscent, aDescent);
}
void nsXFontNormal::TextExtents8 ( const char *  aString,
PRUint32  aLength,
PRInt32 aLBearing,
PRInt32 aRBearing,
PRInt32 aWidth,
PRInt32 aAscent,
PRInt32 aDescent 
) [virtual]

Implements nsXFont.

Definition at line 101 of file nsXFontNormal.cpp.

{
  gdk_text_extents(mGdkFont, aString, aLength,
                    aLBearing, aRBearing, aWidth, aAscent, aDescent);
}
PRInt32 nsXFontNormal::TextWidth16 ( const XChar2b *  aString,
PRUint32  aLength 
) [virtual]

Implements nsXFont.

Definition at line 131 of file nsXFontNormal.cpp.

{
  NS_ASSERTION(mGdkFont, "TextWidth16 called before font loaded");
  if (mGdkFont==nsnull)
    return 0;
  PRInt32 width = gdk_text_width(mGdkFont, (const char *)aString, aLength*2);
  return width;
}
PRInt32 nsXFontNormal::TextWidth8 ( const char *  aString,
PRUint32  aLength 
) [virtual]

Implements nsXFont.

Definition at line 121 of file nsXFontNormal.cpp.

{
  NS_ASSERTION(mGdkFont, "TextWidth8 called before font loaded");
  if (mGdkFont==nsnull)
    return 0;
  PRInt32 width = gdk_text_width(mGdkFont, aString, aLength);
  return width;
}

Implements nsXFont.

Definition at line 141 of file nsXFontNormal.cpp.

{
  delete this;
}

Member Data Documentation

GdkFont* nsXFontNormal::mGdkFont [protected]

Definition at line 70 of file nsXFontNormal.h.

PRBool nsXFont::mIsSingleByte [protected, inherited]

Definition at line 63 of file nsXFont.h.


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