/** * @param lpelfe : pointer to logical-font data * @param lpntme : pointer to physical-font data * @param FontType : type of font */ static int CALLBACK TVPFSFEnumFontsProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM userdata ) { // enumerate fonts tTVPFSEnumFontsProcData *data = reinterpret_cast<tTVPFSEnumFontsProcData*>(userdata); if( data->Flags & TVP_FSF_FIXEDPITCH ) { // fixed pitch only ? if(lpntme->ntmTm.tmPitchAndFamily & TMPF_FIXED_PITCH) return 1; } if( data->Flags & TVP_FSF_SAMECHARSET ) { // same character set only ? if(lpelfe->elfLogFont.lfCharSet != data->CharSet ) return 1; } if( data->Flags & TVP_FSF_IGNORESYMBOL ) { if(lpelfe->elfLogFont.lfCharSet == SYMBOL_CHARSET ) return 1; } if( data->Flags & TVP_FSF_NOVERTICAL ) { // not to list vertical fonts up ? if(lpelfe->elfLogFont.lfFaceName[0] == '@') return 1; } if( data->Flags & TVP_FSF_TRUETYPEONLY ) { // true type or opentype only ? bool is_outline = (lpntme->ntmTm.ntmFlags & NTM_PS_OPENTYPE) || (lpntme->ntmTm.ntmFlags & NTM_TT_OPENTYPE) || (FontType & TRUETYPE_FONTTYPE); if(!is_outline) return 1; } std::wstring facename(lpelfe->elfLogFont.lfFaceName); if(std::find(data->List.begin(), data->List.end(), facename) == data->List.end()) data->List.push_back(facename); // not insert the same face twice return 1; }
void CRichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event)) { long insertionPoint = m_textCtrl->GetInsertionPoint(); if (insertionPoint != m_currentPosition) { #if wxUSE_STATUSBAR wxTextAttr attr; if (m_textCtrl->GetStyle(insertionPoint, attr)) { wxString msg; wxString facename(wxT("unknown")); if (attr.GetFont().Ok()) { facename = attr.GetFont().GetFaceName(); } wxString alignment(wxT("unknown alignment")); if (attr.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) alignment = wxT("centred"); else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_RIGHT) alignment = wxT("right-aligned"); else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_LEFT) alignment = wxT("left-aligned"); else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED) alignment = wxT("justified"); msg.Printf(wxT("Facename: %s, wxColour(%d, %d, %d), %s"), (const wxChar*) facename, attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(), (const wxChar*) alignment); if (attr.HasFont()) { if (attr.GetFont().GetWeight() == wxBOLD) msg += wxT(" BOLD"); else if (attr.GetFont().GetWeight() == wxNORMAL) msg += wxT(" NORMAL"); if (attr.GetFont().GetStyle() == wxITALIC) msg += wxT(" ITALIC"); if (attr.GetFont().GetUnderlined()) msg += wxT(" UNDERLINED"); } SetStatusText(msg); } #endif // wxUSE_STATUSBAR m_currentPosition = insertionPoint; } }