1。enum所有的系统字体/
2。根据返回创建字体;
3。use it。

解决方案 »

  1.   

    The following example uses the EnumFontFamilies function to retrieve the number of available raster, vector, and TrueType font families.     UINT uAlignPrev; 
        int aFontCount[] = { 0, 0, 0 }; 
        char szCount[8]; 
     
        EnumFontFamilies(hdc, (LPCTSTR) NULL, 
            (FONTENUMPROC) EnumFamCallBack, (LPARAM) aFontCount); 
     
        uAlignPrev = SetTextAlign(hdc, TA_UPDATECP); 
     
        MoveToEx(hdc, 10, 50, (LPPOINT)NULL); 
        TextOut(hdc, 0, 0, "Number of raster fonts: ", 24); 
        itoa(aFontCount[0], szCount, 10); 
        TextOut(hdc, 0, 0, szCount, strlen(szCount)); 
     
        MoveToEx(hdc, 10, 75, (LPPOINT)NULL); 
        TextOut(hdc, 0, 0, "Number of vector fonts: ", 24); 
        itoa(aFontCount[1], szCount, 10); 
        TextOut(hdc, 0, 0, szCount, strlen(szCount)); 
     
        MoveToEx(hdc, 10, 100, (LPPOINT)NULL); 
        TextOut(hdc, 0, 0, "Number of TrueType fonts: ", 26); 
        itoa(aFontCount[2], szCount, 10); 
        TextOut(hdc, 0, 0, szCount, strlen(szCount)); 
     
        SetTextAlign(hdc, uAlignPrev); 
     
    BOOL CALLBACK EnumFamCallBack(LPLOGFONT lplf, LPNEWTEXTMETRIC lpntm, DWORD FontType, LPVOID aFontCount) 

        int far * aiFontCount = (int far *) aFontCount; 
     
        // Record the number of raster, TrueType, and vector 
        // fonts in the font-count array. 
     
        if (FontType & RASTER_FONTTYPE) 
            aiFontCount[0]++; 
        else if (FontType & TRUETYPE_FONTTYPE) 
            aiFontCount[2]++; 
        else 
            aiFontCount[1]++; 
     
        if (aiFontCount[0] || aiFontCount[1] || aiFontCount[2]) 
            return TRUE; 
        else 
            return FALSE; 
     
        UNREFERENCED_PARAMETER( lplf ); 
        UNREFERENCED_PARAMETER( lpntm ); 

      

  2.   

    To:zhizhi() 
    你有源码吗,我是要枚举指定字体的所有元素
      

  3.   

    To:wpxs0303(纹坪秀士) 
    谢谢,但我的意思是想获得某一个字体的所有字符和其属性(通过其索引列出)
    例如(宋体 中所有字符)