Hi, It's the same; I have always extra large height then the text it self, look at this screenshoot:
if there any chance that the problem is with the font type I used. (I use font from adobe common files, it is "WinSoft Serif Pro" with extension ".otf" (open type font)). this is the font files:
http://forum.codejock.com/uploads/20070702_165857_Fonts.rar - uploads/20070702_165857_Fonts.rar
In other hand this my class implementation
IMPLEMENT_DYNAMIC(CCustomCaptionBar, CCustomCaptionBarBase)
BEGIN_MESSAGE_MAP(CCustomCaptionBar, CCustomCaptionBarBase) ON_WM_SIZE() END_MESSAGE_MAP()
CCustomCaptionBar::CCustomCaptionBar(CSize btnSize) { //Some Initialization //... //.. //.
this->m_cbGradientWidth = 30; this->m_clrGradientTop = RGB(79, 131, 209); this->m_clrGradientBottom = RGB(255, 255, 255); this->m_clrBack = RGB(255, 255, 255);
this->m_nXMargeTitle = 10; this->m_nYMargeTitle = 10;
m_strTitle = _T("قسم السنة الأولى أ");
//this->m_fntTitle.CreatePointFont( 180, _T("WinSoft Serif Pro") ); LOGFONT lf; ::ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight = -MulDiv( 18, theApp.m_pSAMResource->m_LogPixelsY, 72 ); lf.lfCharSet = ARABIC_CHARSET; lf.lfQuality = /*ANTIALIASED_QUALITY; //*/CLEARTYPE_QUALITY; ::STRCPY_S(lf.lfFaceName, LF_FACESIZE, _T("WinSoft Serif Pro") ); this->m_fntTitle.CreateFontIndirect( &lf );
}
CCustomCaptionBar::~CCustomCaptionBar() { this->m_fntTitle.DeleteObject(); }
VOID CCustomCaptionBar::DrawItem(LPDRAWITEMSTRUCT lpDrawIS) { CDC *pdc = CDC::FromHandle(lpDrawIS->hDC);
CRect rcClient; this->GetClientRect( &rcClient ); CRect rcGradient(rcClient); rcGradient.bottom = rcGradient.top + this->m_cbGradientWidth; CRect rcSolid(rcClient); rcSolid.MoveToY(rcGradient.bottom); rcSolid.bottom-=rcGradient.bottom;
XTPDrawHelpers()->GradientFill( pdc, rcGradient, this->m_clrGradientTop, this->m_clrGradientBottom, FALSE); pdc->FillSolidRect( rcSolid, this->m_clrBack );
pdc->SetBkMode( TRANSPARENT ); pdc->SetTextColor( RGB(55,55,55) ); pdc->SelectObject( m_fntTitle ); UINT nFormat = DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS;//|DT_RIGHT;//*|DT_RTLREADING*/|DT_NOCLIP;//DT_INTERNAL
this->m_rcTitle.SetRect(0,0,rcClient.Width(),0); pdc->DrawText( this->m_strTitle, this->m_rcTitle, DT_SINGLELINE|DT_CALCRECT ); pdc->DrawText( this->m_strTitle, this->m_rcTitle, nFormat ); pdc->FrameRect( this->m_rcTitle, &CBrush(RGB(255,0,0)) );
CRect rcrc(this->m_rcTitle); rcrc.top = rcrc.bottom; rcrc.bottom ++; rcrc.left +=6; //rcrc.right = 200; XTPDrawHelpers()->GradientFill( pdc, rcrc, this->m_clrGradientTop, this->m_clrGradientBottom, TRUE); }
Note: I used arabic characters, and drawing from right to left; the application initialized first with (CWinApp)this->SetDefaultLayout( LAYOUT_RTL );
|