本文整理匯總了C++中EnumFontFamiliesEx函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnumFontFamiliesEx函數的具體用法?C++ EnumFontFamiliesEx怎麽用?C++ EnumFontFamiliesEx使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnumFontFamiliesEx函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: CreateMyFont
//================================================================================================
//--------------------------------------------------------------+++--> Create a Font For the Clock:
HFONT CreateMyFont(char* fontname, int fontsize, LONG weight, LONG italic, int angle) { //--+++-->
LOGFONT lf; POINT pt; HDC hdc; WORD langid;
char s[11]; int cp, i; BYTE charset; int FontQty;
memset(&lf, 0, sizeof(LOGFONT));
langid = (WORD)GetMyRegLong("Format", "Locale", (int)GetUserDefaultLangID());
FontQty = GetMyRegLong("Clock", "FontQuality", CLEARTYPE_QUALITY);
cp = CP_ACP;
if(GetLocaleInfo(langid, LOCALE_IDEFAULTANSICODEPAGE, s, 10) > 0) {
char *p;
p = s;
cp = 0;
while('0' <= *p && *p <= '9') cp = cp * 10 + *p++ - '0';
if(!IsValidCodePage(cp)) cp = CP_ACP;
}
charset = 0;
for(i = 0; codepage_charset[i].cp; i++) {
if(cp == codepage_charset[i].cp) {
charset = codepage_charset[i].charset; break;
}
}
hdc = GetDC(NULL);
// find a font named "fontname"
if(charset == 0) charset = GetTextCharset(hdc);
lf.lfCharSet = charset;
if(EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)fontname, 0)) {
lf.lfCharSet = OEM_CHARSET;
if(EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)fontname, 0)) {
lf.lfCharSet = ANSI_CHARSET;
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)fontname, 0);
}
}
pt.x = 0;
pt.y = MulDiv(fontsize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
DPtoLP(hdc, &pt, 1);
lf.lfHeight = -pt.y;
ReleaseDC(NULL, hdc);
lf.lfWidth = lf.lfEscapement = lf.lfOrientation = 0;
lf.lfWeight = weight;
lf.lfItalic = (BYTE)italic;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
if(angle >0) lf.lfEscapement = angle;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = FontQty; // This Just HAD To be Adjustable.
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
strcpy(lf.lfFaceName, fontname);
return CreateFontIndirect(&lf);
}
示例2: fontreplace
void fontreplace(char *font, int type)
{
if (!strlen(font))
return;
LOGFONT logfont;
ZeroMemory(&logfont, sizeof logfont);
logfont.lfCharSet = DEFAULT_CHARSET;
logfont.lfPitchAndFamily = FF_DONTCARE;
hdc = GetDC(0);
switch (type)
{
case MONOF:
lstrcpy(logfont.lfFaceName, gli_conf_monofont);
EnumFontFamiliesEx(hdc, &logfont, (FONTENUMPROC)monofont, 0, 0);
break;
case PROPF:
lstrcpy(logfont.lfFaceName, gli_conf_propfont);
EnumFontFamiliesEx(hdc, &logfont, (FONTENUMPROC)propfont, 0, 0);
break;
}
ReleaseDC(0, hdc);
}
示例3: wfontEnum1
static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
NEWTEXTMETRICEXW*,
int type,
LPARAM lParam)
{
if (lpelfe != 0 && (type & RASTER_FONTTYPE) == 0)
{
LOGFONTW lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
const String fontName (lpelfe->elfLogFont.lfFaceName);
fontName.copyToUnicode (lf.lfFaceName, LF_FACESIZE - 1);
HDC dc = CreateCompatibleDC (0);
EnumFontFamiliesEx (dc, &lf,
(FONTENUMPROCW) &wfontEnum2,
lParam, 0);
DeleteDC (dc);
}
return 1;
}
示例4: CreateCompatibleDC
const StringArray Font::findAllTypefaceNames()
{
StringArray results;
HDC dc = CreateCompatibleDC (0);
{
LOGFONTW lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
lf.lfFaceName[0] = 0;
EnumFontFamiliesEx (dc, &lf,
(FONTENUMPROCW) &wfontEnum1,
(LPARAM) &results, 0);
}
DeleteDC (dc);
results.sort (true);
return results;
}
示例5: InitComboFont
/*------------------------------------------------
Initialization of "Font" combo box
--------------------------------------------------*/
void InitComboFont(HWND hDlg)
{
HDC hdc;
LOGFONT lf = {0};
HWND hcombo;
wchar_t font[LF_FACESIZE];
int i;
hdc = GetDC(NULL);
// Enumerate fonts and set in the combo box
hcombo = GetDlgItem(hDlg, IDC_FONT);
lf.lfCharSet = DEFAULT_CHARSET; // fonts from any charset
EnumFontFamiliesEx(hdc, &lf, EnumFontFamExProc, (LPARAM)hcombo, 0);
ReleaseDC(NULL, hdc);
api.GetStrEx(L"Clock", L"Font", font, _countof(font), L"Arial");
i = ComboBox_FindStringExact(hcombo, -1, font);
if(i == LB_ERR)
i = 0;
ComboBox_SetCurSel(hcombo, i);
}
示例6: VERIFY
void CFontsPage::FillCharsets()
{
m_CharsetCtl.EnableWindow(TRUE);
m_CharsetCtl.ResetContent();
CString tmp;
tmp.LoadString(IDS_CHARSET_AUTO);
VERIFY(m_CharsetCtl.AddString(tmp)==0);
VERIFY(m_CharsetCtl.SetItemData(0,DEFAULT_CHARSET)!=LB_ERR);
if(m_fmtChar.dwMask&CFM_FACE && *m_fmtChar.szFaceName){
CClientDC dc(NULL);
LOGFONT lf;
memset(&lf,0,sizeof(lf));
lf.lfCharSet = DEFAULT_CHARSET;
strcpy(lf.lfFaceName,m_fmtChar.szFaceName);
EnumFontFamiliesEx(dc.m_hDC,&lf,(FONTENUMPROC)FillInCharsets,(LPARAM)&m_CharsetCtl,0);
}
int ii = m_CharsetCtl.GetCount();
for(int i=0;i<ii;i++){
if(m_CharsetCtl.GetItemData(i)==m_fmtChar.bCharSet){
m_CharsetCtl.SetCurSel(i);
break;
}
}
m_CharsetCtl.EnableWindow(m_CharsetCtl.GetCount()>1);
}
示例7: LogFontCpy
void CVisualSynanView::OnFonts()
{
CFontDialog dlgFonts;
if( dlgFonts.DoModal() != IDOK)
return;
LOGFONT lfOldFont;
LogFontCpy(&lfOldFont, m_LogFontForWords);
dlgFonts.GetCurrentFont(&m_LogFontForWords);
CString str = dlgFonts.GetFaceName();
CClientDC dc(this);
EnumFontFamiliesEx(dc.m_hDC, &m_LogFontForWords, &TestIfTrueTypeEx,(LPARAM)this,0);
if( !m_bExistUsefulFont )
{
::AfxMessageBox(IDS_NOT_TRUE_TYPE);
LogFontCpy(&m_LogFontForWords,lfOldFont);
return;
}
if(!(m_LogFontForWords.lfCharSet & RUSSIAN_CHARSET) )
{
::AfxMessageBox(IDS_NOT_RUSSIAN_CHARSET);
LogFontCpy(&m_LogFontForWords,lfOldFont);
return;
};
// m_LogFontForWords has changed!!
UpdateFontsFromLogFont();
CClientDC clDC(this);
Recalculate(clDC);
Invalidate();
}
示例8: InitOptionsFont
VOID InitOptionsFont(HWND hDlg)
{
// load up the list of fonts
HDC hDC = GetDC(hDlg);
CHARFORMAT cf;
LOGFONT lf;
SendDlgItemMessage(hDlg, IDC_SpnFontSize, UDM_SETRANGE, 0, MAKELONG(72, 6));
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfFaceName[0] = TEXT('\0');;
lf.lfPitchAndFamily = 0;
EnumFontFamiliesEx(hDC, &lf, ListAllFonts, (LPARAM) GetDlgItem(hDlg, IDC_LstFontFace), 0);
ReleaseDC(hDlg, hDC);
SetDlgItemText(hDlg, IDC_RtfPreview, TEXT("Text Preview ABC abc 123"));
// setup the config options
RegistryReadFont(&cf);
SetDlgItemText(hDlg, IDC_LstFontFace, cf.szFaceName);
SetDlgItemBool(hDlg, IDC_ChkFontBold, cf.dwEffects & CFE_BOLD);
SetDlgItemBool(hDlg, IDC_ChkFontItalic, cf.dwEffects & CFE_ITALIC);
SetDlgItemInt(hDlg, IDC_TxtFontSize, TwipToPoint(cf.yHeight), FALSE);
SetDlgItemBool(hDlg, IDC_ChkRevertCAFs, GHCi_Flag_RevertCAFs);
SetDlgItemBool(hDlg, IDC_ChkPrintStats, GHCi_Flag_PrintStats);
SetDlgItemBool(hDlg, IDC_ChkPrintTypes, GHCi_Flag_PrintTypes);
UpdateFontPreview(hDlg);
}
示例9: jassert
StringArray Font::findAllTypefaceFamilies()
{
StringArray results;
#if JUCE_USE_DIRECTWRITE
const Direct2DFactories& factories = Direct2DFactories::getInstance();
if (factories.systemFonts != nullptr)
{
ComSmartPtr<IDWriteFontFamily> dwFontFamily;
uint32 fontFamilyCount = 0;
fontFamilyCount = factories.systemFonts->GetFontFamilyCount();
for (uint32 i = 0; i < fontFamilyCount; ++i)
{
HRESULT hr = factories.systemFonts->GetFontFamily (i, dwFontFamily.resetAndGetPointerAddress());
ComSmartPtr<IDWriteLocalizedStrings> dwFamilyNames;
hr = dwFontFamily->GetFamilyNames (dwFamilyNames.resetAndGetPointerAddress());
jassert (dwFamilyNames != nullptr);
uint32 index = 0;
BOOL exists = false;
hr = dwFamilyNames->FindLocaleName (L"en-us", &index, &exists);
if (! exists)
index = 0;
uint32 length = 0;
hr = dwFamilyNames->GetStringLength (index, &length);
HeapBlock <wchar_t> familyName (length + 1);
hr = dwFamilyNames->GetString (index, familyName, length + 1);
results.add(String (familyName));
}
}
else
#endif
{
HDC dc = CreateCompatibleDC (0);
{
LOGFONTW lf = { 0 };
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
EnumFontFamiliesEx (dc, &lf,
(FONTENUMPROCW) &FontEnumerators::fontEnum1,
(LPARAM) &results, 0);
}
DeleteDC (dc);
}
results.sort (true);
return results;
}
示例10: check_height_family_enumproc
static int CALLBACK check_height_family_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMETRICEX *ntm, DWORD type, LPARAM lParam)
{
HDC hdc = GetDC(NULL);
enumlf->elfLogFont.lfHeight = 0;
EnumFontFamiliesEx(hdc, &enumlf->elfLogFont, (FONTENUMPROC)check_height_font_enumproc, lParam, 0);
ReleaseDC(NULL, hdc);
return 1;
}
示例11: FillFontSizeComboList
VOID
FillFontSizeComboList(HWND hwndCombo)
{
LOGFONT lf = { 0 };
HDC hdc = GetDC(hwndCombo);
/* default size */
INT cursize = 12;
INT i, count, nearest = 0;
HFONT hFont = GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hwndCombo,
WM_SETFONT,
(WPARAM)hFont,
0);
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfPitchAndFamily = 0;
/* empty the list */
SendMessage(hwndCombo,
CB_RESETCONTENT,
0,
0);
/* enumerate font sizes */
EnumFontFamiliesEx(hdc,
&lf,
(FONTENUMPROC)EnumFontSizes,
(LPARAM)hwndCombo,
0);
/* set selection to first item */
count = (INT)SendMessage(hwndCombo,
CB_GETCOUNT,
0,
0);
for(i = 0; i < count; i++)
{
INT n = (INT)SendMessage(hwndCombo,
CB_GETITEMDATA,
i,
0);
if (n <= cursize)
nearest = i;
}
SendMessage(hwndCombo,
CB_SETCURSEL,
nearest,
0);
ReleaseDC(hwndCombo,
hdc);
}
示例12: memset
XInstalledFontCollection::XInstalledFontCollection(void) {
HDC hdc=GetDC(0);
iMax=0;
memset(&lf,0,sizeof(lf));
lf.lfCharSet=DEFAULT_CHARSET;
strName[0]=0;
EnumFontFamiliesEx(hdc,&lf,(FONTENUMPROCW)funcEnumCount,(LPARAM)this,0);
ReleaseDC(0,hdc);
}
示例13: ListFonts
void ListFonts(HWND hWnd)
{
LOGFONT LFont;
LFont.lfCharSet = DEFAULT_CHARSET;
LFont.lfFaceName[0] = '\0';
HDC DC = GetDC(0);
EnumFontFamiliesEx(DC, &LFont, (FONTENUMPROC)EnumFontProc, (LPARAM)hWnd, 0);
ReleaseDC(0, DC);
}
示例14: FillFontListThread
void FillFontListThread(void *param)
{
HDC hdc = GetDC((HWND)param);
LOGFONT lf = {0};
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfFaceName[0] = 0;
lf.lfPitchAndFamily = 0;
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontsProc, (LPARAM) GetDlgItem((HWND)param, IDC_TYPEFACE), 0);
ReleaseDC((HWND)param, hdc);
}
示例15: wcscpy_s
bool CRbFont::IsExist(const wchar_t *filename)
{
static LOGFONTW lfw;
wcscpy_s(lfw.lfFaceName, filename);
int lp = 0;
HDC hScreenDC = GetDC(NULL);
if (EnumFontFamiliesEx(hScreenDC, &lfw, (FONTENUMPROC)FontCallback, lp, 0) == 7)
return true;
else
return false;
}