Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Attributes
nsFontWinUnicode Class Reference
Inheritance diagram for nsFontWinUnicode:
Inheritance graph
[legend]
Collaboration diagram for nsFontWinUnicode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFontWinUnicode (LOGFONT *aLogFont, HFONT aFont, PRUint16 *aCCMap)
virtual ~nsFontWinUnicode ()
virtual PRInt32 GetWidth (HDC aDC, const PRUnichar *aString, PRUint32 aLength)
virtual void DrawString (HDC aDC, PRInt32 aX, PRInt32 aY, const PRUnichar *aString, PRUint32 aLength)
virtual PRInt32 GetWidth (HDC aDC, const char *aString, PRUint32 aLength)
virtual void DrawString (HDC aDC, PRInt32 aX, PRInt32 aY, const char *aString, PRUint32 aLength, INT *aDx0)
virtual PRBool HasGlyph (PRUint32 ch)
PRBool FillClipRect (PRInt32 aX, PRInt32 aY, UINT aLength, UINT uOptions, RECT &clipRect)

Public Attributes

char mName [LF_FACESIZE]
HFONT mFont
PRUint16mCCMap
nscoord mMaxAscent
nscoord mMaxDescent
LONG mOverhangCorrection
LONG mMaxCharWidthMetric
LONG mMaxHeightMetric
BYTE mPitchAndFamily

Private Attributes

PRBool mUnderlinedOrStrikeOut

Detailed Description

Definition at line 2298 of file nsFontMetricsWin.cpp.


Constructor & Destructor Documentation

nsFontWinUnicode::nsFontWinUnicode ( LOGFONT *  aLogFont,
HFONT  aFont,
PRUint16 aCCMap 
)

Definition at line 4343 of file nsFontMetricsWin.cpp.

                    : nsFontWin(aLogFont, aFont, aCCMap)
{
// This is used for a bug in WIN95 where it does not render
// unicode TrueType fonts with underline or strikeout correctly.
// @see  nsFontWinUnicode::DrawString
  NS_ASSERTION(aLogFont != NULL, "Null logfont passed to nsFontWinUnicode constructor");
  mUnderlinedOrStrikeOut = aLogFont->lfUnderline || aLogFont->lfStrikeOut;
}

Definition at line 4353 of file nsFontMetricsWin.cpp.

{
}

Member Function Documentation

void nsFontWin::DrawString ( HDC  aDC,
PRInt32  aX,
PRInt32  aY,
const char *  aString,
PRUint32  aLength,
INT aDx0 
) [virtual, inherited]

Definition at line 4300 of file nsFontMetricsWin.cpp.

{
  NS_ExtTextOutA(aDC, this, aX, aY, 0, NULL, aString, aLength, lpDx);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFontWinUnicode::DrawString ( HDC  aDC,
PRInt32  aX,
PRInt32  aY,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Implements nsFontWin.

Definition at line 4368 of file nsFontMetricsWin.cpp.

{
  DEBUG_VERIFY_FONT_HASGLYPH(this, aString, aLength);
  // Due to a bug in WIN95 unicode rendering of truetype fonts
  // with underline or strikeout, we need to set a clip rect
  // to prevent the underline and/or strikethru from being rendered
  // too far to the right of the character string.
  // The WIN95 bug causes the underline to be 20-30% longer than
  // it should be. @see bugzilla bug 8322
                           
  // Do check for underline or strikeout first since they are rarely
  // used. HTML text frames draw the underlines or strikeout rather
  // than relying on loading and underline or strikeout font so very
  // few fonts should have mUnderlinedOrStrikeOut set.
  if (mUnderlinedOrStrikeOut) {
    if (IsWin95OrWin98()) {
      // Clip out the extra underline/strikethru caused by the
      // bug in WIN95.
      SIZE size;
      ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
      size.cx -= mOverhangCorrection;
      RECT clipRect;
      clipRect.top = aY - size.cy;
      clipRect.bottom = aY + size.cy; // Make it plenty large to allow for character descent.
                                      // Not necessary to clip vertically, only horizontally
      clipRect.left = aX;
      clipRect.right = aX + size.cx;
      NS_ExtTextOutW(aDC, this, aX, aY, ETO_CLIPPED, &clipRect, aString, aLength, NULL); 
      return;
    }
  } 

  // Do normal non-WIN95 text output without clipping
  NS_ExtTextOutW(aDC, this, aX, aY, 0, NULL, aString, aLength, NULL);  
}

Here is the call graph for this function:

PRBool nsFontWin::FillClipRect ( PRInt32  aX,
PRInt32  aY,
UINT  aLength,
UINT  uOptions,
RECT &  clipRect 
) [inherited]

Definition at line 4259 of file nsFontMetricsWin.cpp.

{
  if (!(uOptions & (ETO_CLIPPED | ETO_OPAQUE)) &&
      mOverhangCorrection > 0 && !(mPitchAndFamily & TMPF_FIXED_PITCH)) {
    // bug 52596 - although the clipping rectangle is said to be optional, we
    // have to use a clipping rectange to work around a GDI bug on
    // Win9X-Japanese that causes the text to be truncated incorrectly.
    clipRect.top = aY - mMaxHeightMetric;
    clipRect.bottom = aY + mMaxHeightMetric;
    clipRect.left = aX;
    clipRect.right = aX + mMaxCharWidthMetric * aLength;
    return PR_TRUE;
  }
  return PR_FALSE;
}

Here is the caller graph for this function:

PRInt32 nsFontWin::GetWidth ( HDC  aDC,
const char *  aString,
PRUint32  aLength 
) [virtual, inherited]

Definition at line 4250 of file nsFontMetricsWin.cpp.

{
  SIZE size;
  ::GetTextExtentPoint32(aDC, aString, aLength, &size);
  size.cx -= mOverhangCorrection;
  return size.cx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsFontWinUnicode::GetWidth ( HDC  aDC,
const PRUnichar aString,
PRUint32  aLength 
) [virtual]

Implements nsFontWin.

Definition at line 4358 of file nsFontMetricsWin.cpp.

{
  DEBUG_VERIFY_FONT_HASGLYPH(this, aString, aLength);
  SIZE size;
  ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
  size.cx -= mOverhangCorrection;
  return size.cx;
}
virtual PRBool nsFontWin::HasGlyph ( PRUint32  ch) [inline, virtual, inherited]

Reimplemented in nsFontWinSubstituteA, and nsFontWinSubstitute.

Definition at line 113 of file nsFontMetricsWin.h.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file nsFontMetricsWin.h.

HFONT nsFontWin::mFont [inherited]

Definition at line 132 of file nsFontMetricsWin.h.

Definition at line 138 of file nsFontMetricsWin.h.

Definition at line 143 of file nsFontMetricsWin.h.

Definition at line 139 of file nsFontMetricsWin.h.

Definition at line 144 of file nsFontMetricsWin.h.

char nsFontWin::mName[LF_FACESIZE] [inherited]

Definition at line 113 of file nsFontMetricsWin.h.

Definition at line 142 of file nsFontMetricsWin.h.

Definition at line 145 of file nsFontMetricsWin.h.

Definition at line 2321 of file nsFontMetricsWin.cpp.


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