Back to index

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

List of all members.

Public Member Functions

 nsFontXftUnicode (FcPattern *aPattern, FcPattern *aFontName)
virtual ~nsFontXftUnicode ()
virtual PRBool HasChar (PRUint32 aChar)
 nsFontXftUnicode (FcPattern *aPattern, FcPattern *aFontName)
virtual ~nsFontXftUnicode ()
virtual PRBool HasChar (PRUint32 aChar)
XftFont * GetXftFont (void)
XftFont * GetXftFont (void)
virtual nsresult GetTextExtents32 (const FcChar32 *aString, PRUint32 aLen, XGlyphInfo &aGlyphInfo)
virtual nsresult GetTextExtents32 (const FcChar32 *aString, PRUint32 aLen, XGlyphInfo &aGlyphInfo)
gint GetWidth32 (const FcChar32 *aString, PRUint32 aLen)
gint GetWidth32 (const FcChar32 *aString, PRUint32 aLen)
PRInt16 GetMaxAscent (void)
PRInt16 GetMaxAscent (void)
PRInt16 GetMaxDescent (void)
PRInt16 GetMaxDescent (void)
virtual FT_UInt CharToGlyphIndex (FcChar32 aChar)
virtual FT_UInt CharToGlyphIndex (FcChar32 aChar)
virtual nsresult DrawStringSpec (FcChar32 *aString, PRUint32 aLen, void *aData)
virtual nsresult DrawStringSpec (FcChar32 *aString, PRUint32 aLen, void *aData)

Public Attributes

XftFont * mXftFont
FcPattern * mPattern
FcPattern * mFontName
FcCharSet * mCharset

Detailed Description

Definition at line 121 of file nsFontMetricsXft.cpp.


Constructor & Destructor Documentation

nsFontXftUnicode::nsFontXftUnicode ( FcPattern *  aPattern,
FcPattern *  aFontName 
) [inline]

Definition at line 123 of file nsFontMetricsXft.cpp.

      : nsFontXft(aPattern, aFontName)
    { }

Definition at line 2007 of file nsFontMetricsXft.cpp.

{
}
nsFontXftUnicode::nsFontXftUnicode ( FcPattern *  aPattern,
FcPattern *  aFontName 
) [inline]

Definition at line 123 of file nsFontMetricsXft.cpp.

      : nsFontXft(aPattern, aFontName)
    { }
virtual nsFontXftUnicode::~nsFontXftUnicode ( ) [virtual]

Member Function Documentation

FT_UInt nsFontXft::CharToGlyphIndex ( FcChar32  aChar) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

Definition at line 1959 of file nsFontMetricsXft.cpp.

{
    return XftCharIndex(GDK_DISPLAY(), mXftFont, aChar);
}

Here is the caller graph for this function:

virtual FT_UInt nsFontXft::CharToGlyphIndex ( FcChar32  aChar) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

virtual nsresult nsFontXft::DrawStringSpec ( FcChar32 *  aString,
PRUint32  aLen,
void aData 
) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

nsresult nsFontXft::DrawStringSpec ( FcChar32 *  aString,
PRUint32  aLen,
void aData 
) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

Definition at line 1966 of file nsFontMetricsXft.cpp.

{
    NS_PRECONDITION(mXftFont, "FindFont should not return bad fonts");
    DrawStringData *data = (DrawStringData *)aData;

    FcChar32 *pstr = aString;
    const FcChar32 *end = aString + aLen;

    while(pstr < end) {
        nscoord x = data->x + data->xOffset;
        nscoord y = data->y;
        /* Convert to device coordinate. */
//        fprintf (stderr, "[%d %d -> ", x, y);
        data->context->TransformCoord(&x, &y);
//        fprintf (stderr, "%d %d] ", x, y);

        /* position in X is the location offset in the string 
           plus whatever offset is required for the spacing   
           argument                                           
        */                                                  

        FT_UInt glyph = CharToGlyphIndex(*pstr);
        data->drawBuffer->Draw(x, y, mXftFont, glyph);

        if (data->spacing) {
            data->xOffset += *data->spacing;
            data->spacing += IS_NON_BMP(*pstr) ? 2 : 1; 
        }
        else {
            XGlyphInfo info;                        
            XftGlyphExtents(GDK_DISPLAY(), mXftFont, &glyph, 1, &info);
            data->xOffset += NSToCoordRound(info.xOff * data->p2t);
        }

        ++pstr;
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1944 of file nsFontMetricsXft.cpp.

{
    NS_PRECONDITION(mXftFont, "FindFont should not return bad fonts");

    return mXftFont->ascent;
}

Here is the caller graph for this function:

Definition at line 1952 of file nsFontMetricsXft.cpp.

{
    NS_PRECONDITION(mXftFont, "FindFont should not return bad fonts");
    return mXftFont->descent;
}

Here is the caller graph for this function:

nsresult nsFontXft::GetTextExtents32 ( const FcChar32 *  aString,
PRUint32  aLen,
XGlyphInfo &  aGlyphInfo 
) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

Definition at line 1901 of file nsFontMetricsXft.cpp.

{
    NS_PRECONDITION(mXftFont, "FindFont should not return bad fonts");

    // NS_CONST_CAST needed for older versions of Xft
    XftTextExtents32(GDK_DISPLAY(), mXftFont,
                     NS_CONST_CAST(FcChar32*, aString), aLen, &aGlyphInfo);

    return NS_OK;
}

Here is the caller graph for this function:

virtual nsresult nsFontXft::GetTextExtents32 ( const FcChar32 *  aString,
PRUint32  aLen,
XGlyphInfo &  aGlyphInfo 
) [virtual, inherited]

Reimplemented in nsFontXftCustom, and nsFontXftCustom.

gint nsFontXft::GetWidth32 ( const FcChar32 *  aString,
PRUint32  aLen 
) [inherited]
gint nsFontXft::GetWidth32 ( const FcChar32 *  aString,
PRUint32  aLen 
) [inherited]

Definition at line 1914 of file nsFontMetricsXft.cpp.

{
    XGlyphInfo glyphInfo;
    GetTextExtents32(aString, aLen, glyphInfo);

    return glyphInfo.xOff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

XftFont * nsFontXft::GetXftFont ( void  ) [inherited]

Definition at line 1871 of file nsFontMetricsXft.cpp.

{
    if (!mXftFont) {
        FcPattern *pat = FcFontRenderPrepare(0, mPattern, mFontName);
        if (!pat)
            return nsnull;

        // bug 196312 : work around problem with CJK bi-width fonts
        // and fontconfig prior to 2.2. CJK bi-width fonts are regarded
        // as genuinely monospace by fontconfig that  sets FC_SPACING
        // to FC_MONOSPACE, which makes Xft drawing/measuring routines
        // use the global advance width (the width of double width glyphs 
        // and twice the width of single width glyphs) even for single width
        // characters (e.g. Latin letters and digits). This results in
        // spaced-out ('s p a c e d - o u t') rendering. By deleting
        // FC_SPACING here, we're emulating the behavior of fontconfig 2.2 or 
        // later that does not set FC_SPACING for any font.
        if (FcGetVersion() < 20300)
            FcPatternDel(pat, FC_SPACING);

        mXftFont = XftFontOpenPattern(GDK_DISPLAY(), pat);
        if (!mXftFont)
            FcPatternDestroy(pat);
    }

    return mXftFont;
}

Here is the caller graph for this function:

XftFont* nsFontXft::GetXftFont ( void  ) [inherited]

Implements nsFontXft.

Definition at line 2012 of file nsFontMetricsXft.cpp.

{
    return FcCharSetHasChar(mCharset, (FcChar32) aChar);
}
virtual PRBool nsFontXftUnicode::HasChar ( PRUint32  aChar) [virtual]

Implements nsFontXft.


Member Data Documentation

FcCharSet * nsFontXft::mCharset [inherited]

Definition at line 115 of file nsFontMetricsXft.cpp.

FcPattern * nsFontXft::mFontName [inherited]

Definition at line 114 of file nsFontMetricsXft.cpp.

FcPattern * nsFontXft::mPattern [inherited]

Definition at line 113 of file nsFontMetricsXft.cpp.

XftFont * nsFontXft::mXftFont [inherited]

Definition at line 112 of file nsFontMetricsXft.cpp.


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