![]() |
Font combobox shows square boxes |
Post Reply ![]() |
Author | |
BethZ ![]() Newbie ![]() Joined: 25 October 2005 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() Posted: 25 October 2005 at 4:27pm |
I built a font combobox in the toolbar by following the Custom Themes sample and certain fonts cannot be displayed properly and they are shown as square boxes just like those in the sample program. Does anybody know the solution for this ? I am using Xtreme Command Bars Pro v9.70. Thanks, Beth Edited by BethZ |
|
![]() |
|
Barto ![]() Groupie ![]() Joined: 27 February 2005 Location: Germany Status: Offline Points: 60 |
![]() ![]() ![]() ![]() ![]() |
that's just the special symbol fonts, that only have symbols, but no letters. What I have seen in other applications ist that you draw the name of the font in the standard system font and draw a sample of the font right to it... I think there may even be a way to determine if a font is a symbol font or a "real" font |
|
![]() |
|
BethZ ![]() Newbie ![]() Joined: 25 October 2005 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
But not all of them that show square boxes are special symbol fonts, such as "Estrangelo Edessa", "Gautami", "Latha", "Mangal", "MV Boli", "Raavi", "Shruti", and "Tunga", and they are not shown as square boxes in Microsoft Word, but they are shown square boxes in the sample progam "Custom Themes" if you pick any of these fonts using "CustomDraw" toolbar button on the bottom of the window. Only two classes are needed to implement this font combobox, and they are CControlComboBoxCustomDraw and CControlComboBoxCustomDrawList. The code is as following. Is there anything missing in this code ? //////////////////////////////////////////////////////////// ////////////// CControlComboBoxCustomDraw() m_pCommandBar = new CControlComboBoxCustomDrawList(); ((CControlComboBoxCustomDrawList*)m_pCommandBar) ->EnumFontFamiliesEx(1); } /*********************************************************** **********/
//////////////////////////////////////////////////////////// ////////////// void DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ); virtual void CreateListBox() CreateEx(WS_EX_STATICEDGE|WS_EX_TOOLWINDOW, _T("LISTBOX"), _T(""), SetWindowLong(m_hWnd, GWL_HWNDPARENT, 0 ); friend class CControlComboBoxCustomDraw; /*********************************************************** **********/ BEGIN_MESSAGE_MAP(CControlComboBoxCustomDrawList, CXTPControlFontComboBoxList)
CRect rc(&lpDrawItemStruct->rcItem); ASSERT(lpDrawItemStruct->CtlType == ODT_LISTBOX); dc.Attach(lpDrawItemStruct->hDC); // Save these value to restore them when done drawing. COLORREF cltBkColor = crOldBkColor; // If this item is selected, set the background color dc.SetTextColor(XTPPaintManager()->GetXtremeC olor(XPCOLOR_HIGHLIGHT_TEXT)); dc.Draw3dRect(rc, XTPPaintManager()->GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDE R), XTPPaintManager()->GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDE R)); CFont fnt; CFont* pOldFont = (CFont*)dc.SelectObject(&fnt); dc.SetBkMode(TRANSPARENT); dc.SelectObject(pOldFont); // Reset the background color and the text color back to their dc.Detach();
Thanks, Beth |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |