Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsGlyphAgent Class Reference

List of all members.

Public Member Functions

 nsGlyphAgent ()
 ~nsGlyphAgent ()
eGlyphAgent GetState ()
DWORD GetGlyphMetrics (HDC aDC, PRUint8 aChar, GLYPHMETRICS *aGlyphMetrics)
DWORD GetGlyphMetrics (HDC aDC, PRUnichar aChar, PRUint16 aGlyphIndex, GLYPHMETRICS *aGlyphMetrics)

Private Attributes

MAT2 mMat
eGlyphAgent mState

Detailed Description

Definition at line 2101 of file nsFontMetricsWin.cpp.


Constructor & Destructor Documentation

Definition at line 2104 of file nsFontMetricsWin.cpp.

  {
    mState = eGlyphAgent_UNKNOWN;
    // set glyph transform matrix to identity
    FIXED zero, one;
    zero.fract = 0; one.fract = 0;
    zero.value = 0; one.value = 1; 
    mMat.eM12 = mMat.eM21 = zero;
    mMat.eM11 = mMat.eM22 = one;   
  }

Definition at line 2115 of file nsFontMetricsWin.cpp.

  {}

Member Function Documentation

DWORD nsGlyphAgent::GetGlyphMetrics ( HDC  aDC,
PRUint8  aChar,
GLYPHMETRICS aGlyphMetrics 
)

Definition at line 2143 of file nsFontMetricsWin.cpp.

{
  memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438
  return GetGlyphOutlineA(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD nsGlyphAgent::GetGlyphMetrics ( HDC  aDC,
PRUnichar  aChar,
PRUint16  aGlyphIndex,
GLYPHMETRICS aGlyphMetrics 
)

Definition at line 2155 of file nsFontMetricsWin.cpp.

{
  memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438
  if (eGlyphAgent_UNKNOWN == mState) { // first time we have been in this function
    // see if this platform implements GetGlyphOutlineW()
    DWORD len = GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
    if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) {
      // next time, we won't bother trying GetGlyphOutlineW()
      mState = eGlyphAgent_ANSI;
    }
    else {
      // all is well with GetGlyphOutlineW(), we will be using it from now on
      mState = eGlyphAgent_UNICODE;
      return len;
    }
  }

  if (eGlyphAgent_UNICODE == mState) {
    return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
  }

  // Otherwise, we are on a platform that doesn't implement GetGlyphOutlineW()
  // (see Q241358: The GetGlyphOutlineW Function Fails on Windows 95 & 98
  // http://support.microsoft.com/support/kb/articles/Q241/3/58.ASP)
  // we will use glyph indices as a work around.
  if (0 == aGlyphIndex) { // caller doesn't know the glyph index, so find it
    nsAutoChar16Buffer buf;
    if (NS_SUCCEEDED(GetGlyphIndices(aDC, nsnull, &aChar, 1, buf)))
      aGlyphIndex = *(buf.get());
  }
  if (0 < aGlyphIndex) {
    return GetGlyphOutlineA(aDC, aGlyphIndex, GGO_METRICS | GGO_GLYPH_INDEX, aGlyphMetrics, 0, nsnull, &mMat);
  }

  // if we ever reach here, something went wrong in GetGlyphIndices() above
  // because the current font in aDC wasn't a Unicode font
  return GDI_ERROR;
}

Here is the call graph for this function:

Definition at line 2118 of file nsFontMetricsWin.cpp.

  {
    return mState;
  }

Member Data Documentation

Definition at line 2132 of file nsFontMetricsWin.cpp.

Definition at line 2134 of file nsFontMetricsWin.cpp.


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