static int Win32_EnumFace(HDC hdc, const char *face) { #ifdef PLATFORM_WINCE return EnumFontFamilies(hdc, ToSystemCharset(face), Win32_AddFace, (LPARAM)~ToSystemCharset(face)); #else return EnumFontFamilies(hdc, face, Win32_AddFace, (LPARAM)face); #endif }
static BOOL unicode_CheckTwinBridgeForCsid(HDC hdc, int16 csid) { /* For 4.0 // Chinese: // Check for twin40.ini // Check for Font "Chn System" // Japanese: // Check for twinj40.ini // Check for Font "Jpn System" */ switch(csid) { case CS_BIG5: case CS_GB_8BIT: case CS_SJIS: { EnumFontTest test; test.found = FALSE; EnumFontFamilies(hdc, ((csid == CS_SJIS) ? "Jpn System" : "Chn System"), (FONTENUMPROC)DetectTwinBridge, (LPARAM)&test); return test.found; } case CS_KSC_8BIT: default: return FALSE; } }
static int is_font_installed(const char *name) { HDC hdc = GetDC(NULL); BOOL ret = !EnumFontFamilies(hdc, name, is_font_installed_proc, 0); ReleaseDC(NULL, hdc); return ret; }
AMInt32 AMGetBitmapFont(AMFont* pFont, const AMWChar* fontName) { if(NULL == pFont) return AME_ARG_AINVALID; if(NULL == fontName) return AMFontCreate(pFont); AMFont_* f = (AMFont_*)malloc(sizeof(AMFont_)); if(NULL == f) return AME_MALLOC_ERROR; memset(f, 0 , sizeof(AMFont_)); wcscpy((wchar_t *)f->fontName, (wchar_t *)fontName); f->style = AMFONT_STYLE_ERROR; f->size = AMFONT_SIZE_MEDIUM; f->face = AMFONT_FACE_SYSTEM; f->hdc = GetDC(NULL); EnumFontFamilies(f->hdc, NULL, _GetBitmapFontEnumFontFamProc, (LPARAM)f); if(NULL == f->hfont) { free(f); return AME_FONT_ERROR; } *pFont = f; return AME_FONT_SUCCESS; }
void CFontPropPage::FillFacenameList() { // Clear the list m_FontNames.ResetContent(); // Create a DC to enumerate CClientDC dc(NULL); EnumFontFamilies(dc.GetSafeHdc(), (LPCTSTR) NULL, (FONTENUMPROC)CFontPropPage::EnumFontFamiliesCallBack, (LPARAM) this); // Select the first one if (m_FontNames.SetCurSel(0) != CB_ERR) { // Fill the size list FillSizeList(); } else { m_FontNames.EnableWindow(FALSE); m_FontSizes.EnableWindow(FALSE); m_FontStyles.EnableWindow(FALSE); GetDlgItem(AFX_IDC_STRIKEOUT)->EnableWindow(FALSE); GetDlgItem(AFX_IDC_UNDERLINE)->EnableWindow(FALSE); } }
void COptionTreeFontSel::FillFaceNameList() { // Declare variables CClientDC dc(NULL); // Validate controls if (ValidateControls() == FALSE) { return; } // Clear the list m_ctlFontNames.ResetContent(); // Create a DC to enumerate EnumFontFamilies(dc.GetSafeHdc(), (LPCTSTR) NULL, (FONTENUMPROC)COptionTreeFontSel::EnumFontFamiliesCallBack, (LPARAM) this); // Select the first one if (m_ctlFontNames.SetCurSel(0) != CB_ERR) { // Fill the size list FillSizeStyleList(); } else { m_ctlFontNames.EnableWindow(FALSE); m_ctlFontSizes.EnableWindow(FALSE); m_ctlFontStyles.EnableWindow(FALSE); m_ctlUnderline.EnableWindow(FALSE); m_ctlStrikeout.EnableWindow(FALSE); } }
static int CALLBACK font_enum(const LOGFONT* lf, const TEXTMETRIC* tm, DWORD FontType, LPARAM lParam) { struct dialog_info* di = (struct dialog_info*)lParam; WCUSER_DumpLogFont("DlgFamily: ", lf, FontType); if (WCUSER_ValidateFont(di->data, lf)) { if (FontType & RASTER_FONTTYPE) { di->nFont = 0; EnumFontFamilies(PRIVATE(di->data)->hMemDC, lf->lfFaceName, font_enum_size2, (LPARAM)di); } else di->nFont = 1; if (di->nFont) { SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_ADDSTRING, 0, (LPARAM)lf->lfFaceName); } } return 1; }
static BOOL unicode_CheckFontOfCsid(HDC hdc, int16 csid) { EnumFontTest test; test.found = FALSE; test.testparam = unicode_CsidToCharset(csid); EnumFontFamilies(hdc, NULL,(FONTENUMPROC)DetectCharset, (LPARAM)&test); return test.found; }
void ReEnum() { HDC hdc; FontNum=0; hdc=GetDC(hWndMain); EnumFontFamilies(hdc, NULL, (FONTENUMPROC)EnumFamCallBack, (LPARAM)NULL); ReleaseDC(hWndMain, hdc); }
/* Cross call procedure implementations. Eval<nr> corresponds with a CrossCallEntry generated by NewCrossCallEntry (nr,Eval<nr>). */ void EvalCcRqGETFONTNAMES (CrossCallInfo *pcci) // no params; no result. { HDC hdc; hdc = GetDC (ghMainWindow); EnumFontFamilies (hdc, NULL, (FONTENUMPROC) EnumFontNameProc, 0); ReleaseDC (ghMainWindow, hdc); MakeReturn0Cci (pcci); }
BOOL CPPageTweaks::OnInitDialog() { __super::OnInitDialog(); SetHandCursor(m_hWnd, IDC_COMBO1); AppSettings& s = AfxGetAppSettings(); m_fDisableXPToolbars = s.fDisableXPToolbars; m_fUseWMASFReader = s.fUseWMASFReader; m_nJumpDistS = s.nJumpDistS; m_nJumpDistM = s.nJumpDistM; m_nJumpDistL = s.nJumpDistL; m_fNotifyMSN = s.fNotifyMSN; m_fNotifyGTSdll = s.fNotifyGTSdll; m_fPreventMinimize = s.m_fPreventMinimize; m_fUseWin7TaskBar = s.m_fUseWin7TaskBar; m_fDontUseSearchInFolder =s.m_fDontUseSearchInFolder; m_OSD_Size = s.nOSD_Size; m_OSD_Font = s.m_OSD_Font; CString str; int iSel = 0; m_FontType.Clear(); m_FontSize.Clear(); HDC dc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL); CAtlArray<CString> fntl; EnumFontFamilies(dc, NULL,(FONTENUMPROC)EnumFontProc, (LPARAM)&fntl); DeleteDC(dc); for (int i=0; i< fntl.GetCount(); i++) { if (i>0 && fntl[i-1] == fntl[i]) continue; m_FontType.AddString(fntl[i]); } for (int i=0; i< m_FontType.GetCount(); i++) { m_FontType.GetLBText(i,str); if (m_OSD_Font == str) iSel=i; } m_FontType.SetCurSel(iSel); for (int i=10; i<26; i++) { str.Format(_T("%d"), i); m_FontSize.AddString(str); if (m_OSD_Size == i) iSel=i; } m_FontSize.SetCurSel(iSel-10); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
//--------------------------------------------------------------------------// //--------------------------------------------------------------------------// void CFontList::InitFontArray() { m_FontArray.clear(); m_EnumFontDC = ::CreateIC("DISPLAY", NULL, NULL, NULL); EnumFontFamilies(m_EnumFontDC, NULL, (FONTENUMPROC) EnumFontFamilyProc, (LPARAM) this); ::DeleteDC(m_EnumFontDC); m_EnumFontDC = NULL; }
/****************************************************************** * fill_list_font * * Fills the font LB */ static BOOL fill_list_font(struct dialog_info* di) { SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0L, 0L); EnumFontFamilies(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di); if (SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING, (WPARAM)-1, (LPARAM)di->config.face_name) == LB_ERR) SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0L, 0L); fill_list_size(di, TRUE); return TRUE; }
void EvalCcRqGETFONTSIZES (CrossCallInfo *pcci) // textptr; no result. { HDC hdc; hdc = GetDC (ghMainWindow); EnumFontFamilies (hdc, (char *) pcci->p1, (FONTENUMPROC) EnumFontSizeProc, 0); ReleaseDC (ghMainWindow, hdc); rfree ((char *) pcci->p1); MakeReturn0Cci (pcci); }
static BOOL FAR PASCAL EnumCallBack(ENUMLOGFONT *lplf, NEWTEXTMETRIC *lpntm, DWORD fontType, LPVOID iptr) { // All we're concerned with are TrueType(T.M.Reg.U.S.Pat.Off.) fonts... if(fontType & TRUETYPE_FONTTYPE) { // Got the basic font name, now let's enumerate its members TCHAR work[256]; _tcscpy(work,lplf->elfLogFont.lfFaceName); HDC hdcScreen = GetDC(NULL); EnumFontFamilies(hdcScreen, (LPCTSTR)work, (FONTENUMPROC)EnumCallBack2, (LPARAM)iptr); } return TRUE; }
void ATMFontMan::FindClosestFont() { CDC Screen; if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) { EnumFontFamilies(Screen.m_hDC, NULL, (FONTENUMPROC) ATMFontMan_CallBackFindClosestFont, NULL); Screen.DeleteDC(); } }
void ATMFontMan::ValidateCache() { CDC Screen; if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) { EnumFontFamilies(Screen.m_hDC, NULL, (FONTENUMPROC) ATMFontMan_CallBackValidateFont, NULL); Screen.DeleteDC(); } }
void ATMFontMan::EnumAllFonts(OILEnumFonts* pClass) { CDC Screen; if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) { EnumFontFamilies(Screen.m_hDC, NULL, (FONTENUMPROC) ATMFontMan_CallBackDispatchFont, (LPARAM)pClass); Screen.DeleteDC(); } }
static int setCurLogfont( int overrideSize ) { int index; char size[8]; int height; HDC hdc; FONTENUMPROC lpEnumFam; if( overrideSize == 0 ) { index = SendMessage( hwndSize, CB_GETCURSEL, 0, 0L ); if( index == CB_ERR ) { return( 0 ); } SendMessage( hwndSize, CB_GETLBTEXT, index, (LONG)size ); height = atoi( size ); } else { height = overrideSize; } CurLogfont.lfHeight = -height; CurLogfont.lfWidth = 0; CurLogfont.lfEscapement = 0; CurLogfont.lfOrientation = 0; index = SendMessage( hwndStyle, LB_GETCURSEL, 0, 0L ); if( index == LB_ERR ) return( 0 ); CurLogfont.lfWeight = ( Style[index] & STYLE_BOLD ) ? FW_BOLD : FW_NORMAL; CurLogfont.lfItalic = ( Style[index] & STYLE_ITALIC ) ? 1 : 0; CurLogfont.lfUnderline = 0; CurLogfont.lfStrikeOut = 0; /* use defaults set below by SetupFontData */ #if 0 CurLogfont.lfCharSet = ANSI_CHARSET; CurLogfont.lfOutPrecision = OUT_DEFAULT_PRECIS; CurLogfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; CurLogfont.lfQuality = PROOF_QUALITY; CurLogfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; #endif index = SendMessage( hwndTypeface, LB_GETCURSEL, 0, 0L ); if( index == LB_ERR ) { return( 0 ); } SendMessage( hwndTypeface, LB_GETTEXT, index, (LONG)CurLogfont.lfFaceName ); /* set up defaults for charset, etc. from info for 1st font of this type */ hdc = GetDC( EditContainer ); lpEnumFam = (FONTENUMPROC) MakeProcInstance( (FARPROC) SetupFontData, InstanceHandle ); EnumFontFamilies( hdc, CurLogfont.lfFaceName, lpEnumFam, 0L ); FreeProcInstance( (FARPROC) lpEnumFam ); ReleaseDC( EditContainer, hdc ); return( 1 ); }
//--------------------------------------------------------------------------// //--------------------------------------------------------------------------// static int CALLBACK EnumFontFamilyProc(ENUMLOGFONT *pelf, NEWTEXTMETRIC * /*pntm*/, int FontType, LPARAM lParam) { if (FontType & TRUETYPE_FONTTYPE) { CFontList *pFontList = (CFontList *) lParam; EnumFontFamilies(pFontList->GetEnumFontDC(), pelf->elfLogFont.lfFaceName, (FONTENUMPROC) EnumFontFamilyProc2, lParam); } return (1); }
BOOL ATMFontMan::CacheNamedFont(String_64* pFontName) { CDC Screen; // and create a new one if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) { FontManager* pFontMan = GetApplication()->GetFontManager(); ERROR2IF(pFontMan == NULL,FALSE,"NULL FontManager ptr"); pFontMan->ClearTempFont(); EnumFontFamilies(Screen.m_hDC, NULL, (FONTENUMPROC) ATMFontMan_CallBackCacheNamedFont, (LPARAM)pFontName); Screen.DeleteDC(); return pFontMan->TempFontValid(); } return FALSE; }
static BOOL unicode_CheckUnionwayForCsid(HDC hdc,int16 csid) { /* // For Uniway, we could use EnumFontFamilies to check font name. // xxxUDEF ? Maybe Korean ? // xxxPDEF Simplified Chinese // xxxJDEF Japanese // xxxCDEF Chinese // Maybe we should first check wheather UWTOOLS.INI or uwfont.ini is // in the Windows directory */ EnumFontTest test; test.found = FALSE; test.testparam = csid; EnumFontFamilies(hdc, NULL,(FONTENUMPROC)DetectUnionway, (LPARAM)&test); return test.found; }
static void fillTypefaceBox( HWND hwnd ) { FARPROC fp; HDC hdc; hwnd = hwnd; /* put typefaces in combo box */ hdc = GetDC( EditContainer ); fp = MakeFontEnumProcInstance( EnumFamTypefaces, InstanceHandle ); EnumFontFamilies( hdc, NULL, (FONTENUMPROC)fp, 0L ); FreeProcInstance( fp ); ReleaseDC( EditContainer, hdc ); SendMessage( hwndTypeface, LB_SETCURSEL, 0, 0L ); }
static void fillTypefaceBox( HWND hwnd ) { FONTENUMPROC lpEnumFam; HDC hdc; hwnd = hwnd; /* put typefaces in combo box */ hdc = GetDC( EditContainer ); lpEnumFam = (FONTENUMPROC) MakeProcInstance( (FARPROC) EnumFamTypefaces, InstanceHandle ); EnumFontFamilies( hdc, NULL, lpEnumFam, 0L ); FreeProcInstance( (FARPROC) lpEnumFam ); ReleaseDC( EditContainer, hdc ); SendMessage( hwndTypeface, LB_SETCURSEL, 0, 0L ); }
bool CTextPropertyToolBar::Create(CWnd* pParentWnd) { if (!this->CreateEx(pParentWnd, AFX_DEFAULT_TOOLBAR_STYLE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP, { 1,1,1,1 }, ID_TB_TEXT)) { TRACE0("Failed to create toolbar\n"); return false; } //m_textToolBar.SetPaneStyle(m_textToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); std::vector<ButtonInfo> buttons = theResources.GetTextToolBarButtons(); for (std::vector<ButtonInfo>::iterator it_buttons = buttons.begin(); it_buttons != buttons.end(); it_buttons++) { this->LoadBitmap(it_buttons->uiImageResId, 0, 0, TRUE); CMFCToolBarButton button(it_buttons->uiCommandId, this->GetAllButtons().GetCount(), it_buttons->strText); button.SetStyle(TBBS_CHECKBOX); this->InsertButton(button, this->GetAllButtons().GetCount()); } //this->SetOwner(this); //this->SetRouteCommandsViaFrame(FALSE); //m_textToolBar.EnableCustomizeButton(TRUE, 0, L""); CMFCToolBarComboBoxButton combo(ID_FONTCOMBO_TEXT, 0); EnumFontFamilies(GetDC()->GetSafeHdc(), NULL, (FONTENUMPROC)EnumFamCallBack, (LPARAM)&combo); this->InsertButton(combo, this->GetAllButtons().GetCount()); CMFCToolBarComboBoxButton combo2(ID_SIZECOMBO_TEXT, 0, CBS_DROPDOWNLIST, 40); for (int i = 5; i < 16; i++) { CString size; size.Format(_T("%d"), i); combo2.AddItem(size); } this->InsertButton(combo2, this->GetAllButtons().GetCount()); this->SetWindowText(L"Text Property"); this->EnableDocking(CBRS_TOP); this->EnableReflections(); return true; }
void enumerate_tt() { HWND hWnd = GetDesktopWindow(); assert(hWnd != 0); HDC hDC = GetDC(hWnd); assert(hDC != 0); cout.flush(); printf("%-30s (%-10s) %-5s %-14s\n", "Name", "Style", "Size", "Pitch"); printf("------------------------------ ------------ ----- --------------\n"); EnumFontFamilies(hDC, NULL, (FONTENUMPROC) enum_proc, 0); ReleaseDC(hWnd,hDC); }
AMInt32 AMCreateSystemFont(AMFont* pFont, AMFontFace face, AMFontStyle style, AMFontSize size) { CHECK_PARG_AND_RET(pFont); AMFont_* f = (AMFont_*)malloc(sizeof(AMFont_)); CHECK_PARG_AND_RETV(f, AME_MALLOC_ERROR); memset(f, 0 , sizeof(AMFont_)); f->hdc = GetDC(NULL); f->size = size; f->style = style; f->face = face; EnumFontFamilies(f->hdc, NULL, _FontCreateSystemFontEnumFontFamProc, (LPARAM)f); if(NULL == f->hfont) { free(f); return AME_FONT_ERROR; } *pFont = f; return AME_FONT_SUCCESS; }
AMInt32 AMFontCreate(AMFont* pFont) { CHECK_PARG_AND_RET(pFont); AMFont_* f = (AMFont_*)malloc(sizeof(AMFont_)); CHECK_PARG_AND_RETV(f, AME_MALLOC_ERROR); memset(f, 0 , sizeof(AMFont_)); f->style = AMFONT_STYLE_ERROR; f->size = AMFONT_SIZE_MEDIUM; f->face = AMFONT_FACE_SYSTEM; f->hdc = GetDC(NULL); EnumFontFamilies(f->hdc, NULL, _FontCreateEnumFontFamProc, (LPARAM)f); if(NULL == f->hfont) { free(f); return AME_FONT_ERROR; } *pFont = f; return AME_FONT_SUCCESS; }
/****************************************************************** * fill_list_size * * fills the size list box according to selected family in font LB */ static BOOL fill_list_size(struct dialog_info* di, BOOL doInit) { int idx; WCHAR lfFaceName[LF_FACESIZE]; idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L); if (idx < 0) return FALSE; SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName); SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0L, 0L); HeapFree(GetProcessHeap(), 0, di->font); di->nFont = 0; di->font = NULL; EnumFontFamilies(PRIVATE(di->data)->hMemDC, lfFaceName, font_enum_size, (LPARAM)di); if (doInit) { int ref = -1; for (idx = 0; idx < di->nFont; idx++) { if (!lstrcmp(di->font[idx].faceName, di->config.face_name) && di->font[idx].height == di->config.cell_height && di->font[idx].weight == di->config.font_weight) { if (ref == -1) ref = idx; else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx); } } idx = (ref == -1) ? 0 : ref; } else idx = 0; SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0L); select_font(di); return TRUE; }
int FAR PASCAL zEnumFontFamilies( HDC pp1, LPCSTR pp2, FONTENUMPROC pp3, LPSTR pp4 ) { int r; FARPROC fpCentslessTaker; SaveRegs(); /* ** Log IN Parameters (No Create/Destroy Checking Yet!) */ LogIn( (LPSTR)"APICALL:EnumFontFamilies ++++", (short)0, (short)0, (short)0, (short)0 ); /* Hook the callback function (a census taker) with our own little twist */ fpCentslessTaker = (FARPROC) HookAdd((void far *)FamilyCounter, (void far *) pp3); /* ** Call the API! */ RestoreRegs(); GrovelDS(); r = EnumFontFamilies(pp1,pp2,fpCentslessTaker,pp4); UnGrovelDS(); SaveRegs(); /* ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!) */ LogOut( (LPSTR)"APIRET:EnumFontFamilies int+++++", r, (short)0, (short)0, (short)0, (short)0 ); RestoreRegs(); return( r ); }