Esempio n. 1
0
/*
 * EnumFunc - enumerate fonts
 */
WINEXPORT int CALLBACK EnumFunc( LPLOGFONT lf, LPTEXTMETRIC tm, UINT ftype, LPSTR data )
{
    tm = tm;
    ftype = ftype;
    data = data;

    /*
     * Something has happened in the font world and Windows font mapper since
     * the original source was written, it checked only for Courier. All the
     * font names below are verified as good monospaced fonts. Check for the
     * best fonts first, so that the system picks the best if enumerated first.
     * Changed the test to == 0, because it is easier to read and understand.
     */
#if defined( __NT__ )
    if( FARstricmp( lf->lfFaceName, "andale mono" ) == 0 ||
        FARstricmp( lf->lfFaceName, "lucida console" ) == 0 ||
        FARstricmp( lf->lfFaceName, "vera sans mono" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier new" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier" ) == 0 ) {
#else
    if( FARstricmp( lf->lfFaceName, "courier new" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier" ) == 0 ) {
#endif
        courierFont = CreateFont( 13, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, lf->lfCharSet,
                                  OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                                  lf->lfPitchAndFamily, lf->lfFaceName );
        return( 0 );
    }
    return( 1 );

} /* EnumFunc */

/*
 * getCourierFont - find a mono font
 */
static void getCourierFont( HANDLE inst )
{
    LOGFONT     logfont;
    FARPROC     fp;
    HDC         hdc;

    inst = inst;        /* shut up the compiler for NT */
    hdc = GetDC( (HWND)NULL );
    fp = MakeProcInstance( (FARPROC)EnumFunc, inst );
    EnumFonts( hdc, NULL, (LPVOID)fp, 0 );
    FreeProcInstance( fp );
    ReleaseDC( (HWND)NULL, hdc );

    if( courierFont == NULL ) {
        courierFont = GetStockObject( ANSI_FIXED_FONT );
        GetObject( courierFont, sizeof( LOGFONT ), (LPSTR)&logfont );
        courierFont = CreateFontIndirect( &logfont );
    }

} /* getCourierFont */
Esempio n. 2
0
/*
 * EnumFontFunc - enumerate fonts
 */
int CALLBACK EnumFontFunc( WPI_LOGFONT *lf, WPI_TEXTMETRIC *tm, UINT ftype,
                                                                LPSTR data )
{
    char        *facename;

    tm = tm;
    ftype = ftype;

    facename = _wpi_getfontfacename( *lf );
    if( !FARstricmp( facename, data ) ) {
        currentLogFont = malloc( sizeof(WPI_LOGFONT) );
        memcpy(currentLogFont, lf, sizeof(WPI_LOGFONT));
        return( 0 );
//      return( 1 );
    }
    return( 1 );
} /* EnumFontFunc */
Esempio n. 3
0
/*
 * EnumFunc - enumerate fonts
 */
int CALLBACK EnumFunc( LPLOGFONT lf, LPTEXTMETRIC tm, UINT ftype, LPSTR data )
{
    tm = tm;
    ftype = ftype;
    data = data;

    /* Something has happened in the font world and windows font mapper since
       the original source was written, it checked only for Courier. All the
       font names below are verified as good monospaced fonts. Checks for the
       best fonts first, so that the system picks the best if enumerated first.
       Changed the test to == 0, because it is easier to read and understand.   */
#if defined (__NT__)
    if((FARstricmp( lf->lfFaceName, "andale mono" ) == 0)    ||
       (FARstricmp( lf->lfFaceName, "lucida console" ) == 0) ||
       (FARstricmp( lf->lfFaceName, "vera sans mono" ) == 0) ||
       (FARstricmp( lf->lfFaceName, "courier new" ) == 0)    ||
       (FARstricmp( lf->lfFaceName, "courier" ) == 0) )
#else
    if((FARstricmp( lf->lfFaceName, "courier new" ) == 0) ||
       (FARstricmp( lf->lfFaceName, "courier" ) == 0) )
#endif
    {
        courierFont = CreateFont(
            13,
            0,
            0,
            0,
            FW_NORMAL,
            FALSE,
            FALSE,
            FALSE,
            lf->lfCharSet,
            OUT_DEFAULT_PRECIS,
            CLIP_DEFAULT_PRECIS,
            DEFAULT_QUALITY,
            lf->lfPitchAndFamily,
            lf->lfFaceName );
        return( 0 );
    }
    return( 1 );

} /* EnumFunc */
Esempio n. 4
0
int CALLBACK EnumFontsEnumFunc( const LOGFONT FAR *lf, const TEXTMETRIC FAR *tm, DWORD ftype, LPARAM data )
#endif
{
#ifdef __WINDOWS_386__
    const LOGFONT __far    *lf = MK_FP32( (void *)_lf );
    tm = tm;
#elif defined( __WINDOWS__ )
    const LOGFONT FAR      *lf = (const LOGFONT FAR *)elf;
//    const TEXTMETRIC FAR *tm = (const TEXTMETRIC FAR *)ntm;
    ntm = ntm;
#else
    tm = tm;
#endif
    ftype = ftype;
    data = data;

    /*
     * Something has happened in the font world and Windows font mapper since
     * the original source was written, it checked only for Courier. All the
     * font names below are verified as good monospaced fonts. Check for the
     * best fonts first, so that the system picks the best if enumerated first.
     * Changed the test to == 0, because it is easier to read and understand.
     */
#if defined( __NT__ )
    if( FARstricmp( lf->lfFaceName, "andale mono" ) == 0 ||
        FARstricmp( lf->lfFaceName, "lucida console" ) == 0 ||
        FARstricmp( lf->lfFaceName, "vera sans mono" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier new" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier" ) == 0 ) {
#else
    if( FARstricmp( lf->lfFaceName, "courier new" ) == 0 ||
        FARstricmp( lf->lfFaceName, "courier" ) == 0 ) {
#endif
        courierFont = CreateFont( 13, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, lf->lfCharSet,
                                  OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                                  lf->lfPitchAndFamily, lf->lfFaceName );
        return( 0 );
    }
    return( 1 );

} /* EnumFunc */

/*
 * getCourierFont - find a mono font
 */
static void getCourierFont( HANDLE inst )
{
    LOGFONT     logfont;
    FARPROC     fp;
    HDC         hdc;

    inst = inst;        /* shut up the compiler for NT */
    hdc = GetDC( HWND_DESKTOP );
    fp = MakeFontEnumProcInstance( EnumFontsEnumFunc, inst );
#if defined( __WINDOWS__ ) && defined( _M_I86 )
    EnumFonts( hdc, NULL, (OLDFONTENUMPROC)fp, 0 );
#else
    EnumFonts( hdc, NULL, (FONTENUMPROC)fp, 0 );
#endif
    FreeProcInstance( fp );
    ReleaseDC( (HWND)NULL, hdc );

    if( courierFont == NULL ) {
        courierFont = GetStockObject( ANSI_FIXED_FONT );
        GetObject( courierFont, sizeof( LOGFONT ), (LPSTR)&logfont );
        courierFont = CreateFontIndirect( &logfont );
    }

} /* getCourierFont */