<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Question about rendering Text?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : General Discussion : Question about rendering Text?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 27 Apr 2026 17:24:04 +0000</pubDate>
  <lastBuildDate>Mon, 27 Aug 2007 06:01:16 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=7489</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Question about rendering Text? : There is a better option to rewrite...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=25390&amp;title=question-about-rendering-text#25390</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2928">terrym</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 27 August 2007 at 6:01am<br /><br />There is a better option to rewrite the DrawText function as this is a very limited function as it works in integers and loses accuracy, therefore not giving WYSIWYG<DIV>&nbsp;</DIV><DIV>We decided to write our own version which uses it's own kerning and works using floating point accuracy giving true WYSIWYG</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Mon, 27 Aug 2007 06:01:16 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=25390&amp;title=question-about-rendering-text#25390</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : hi oleg, I finally figure it out...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24188&amp;title=question-about-rendering-text#24188</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 04 July 2007 at 1:48pm<br /><br /><P>hi oleg, I finally figure it out and find some sort of solution....</P><P>I agree with you maybe the problem is in the font, but this is the solution I have found:</P><P>if I want to create Normal font with weight = <FONT color=#990000>FW_NORMAL </FONT>then I must use:</P><P>to calculate the rect;<BR>pdc-&gt;DrawText( strTitle, rcTitle, DT_VCENTER|DT_SINGLELINE|DT_CALCRECT );&nbsp;<FONT color=#009933>//DT_VCENTER solve the problem of extra height</FONT></P><P>to draw <BR>pdc-&gt;DrawText( strTitle, m_rcTitle, DT_BOTTOM|DT_SINGLELINE );</P><P><BR>if I want to create Bold font with weight = <FONT color=#990000>FW_BOLD</FONT> then simply use:</P><P>to calculate the rect;<BR>pdc-&gt;DrawText( strTitle, rcTitle, DT_SINGLELINE|DT_CALCRECT );</P><P>to draw <BR>pdc-&gt;DrawText( strTitle, m_rcTitle, DT_BOTTOM|DT_SINGLELINE );<BR></P>]]>
   </description>
   <pubDate>Wed, 04 Jul 2007 13:48:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24188&amp;title=question-about-rendering-text#24188</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : I see,   thank you.. ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24149&amp;title=question-about-rendering-text#24149</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 03 July 2007 at 6:05am<br /><br />I see, <DIV>&nbsp;</DIV><DIV>thank you.. </DIV>]]>
   </description>
   <pubDate>Tue, 03 Jul 2007 06:05:01 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24149&amp;title=question-about-rendering-text#24149</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : Hello,  Code now looks good...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24144&amp;title=question-about-rendering-text#24144</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 03 July 2007 at 1:54am<br /><br />Hello,<DIV>&nbsp;</DIV><DIV>Code now looks good :( Problem can be indeed because of fonts. if you use predefined height of font you can use predefined height of this text line too....</DIV>]]>
   </description>
   <pubDate>Tue, 03 Jul 2007 01:54:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24144&amp;title=question-about-rendering-text#24144</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : Hi, It&amp;#039;s the same; I have...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24130&amp;title=question-about-rendering-text#24130</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 02 July 2007 at 5:01pm<br /><br /><P>Hi, It's the same; I have always extra large height then the text it self, look at this screenshoot:</P><P><img src="http://forum.codejock.com/uploads/20070702_164902_View.png" border="0"><BR></P><DIV>if there any chance that the problem is with the font type I used. (I&nbsp; use font from adobe common files, it is "WinSoft Serif Pro"&nbsp; with extension ".otf" (open type font)).<BR>this is the font files:</DIV><P><a href="http://forum.codejock.com/uploads/20070702_165857_Fonts.rar" target="_blank">uploads/20070702_165857_Fonts.rar</A></P><DIV><BR>In other hand this my class implementation</DIV><P><BR>IMPLEMENT_DYNAMIC(CCustomCaptionBar, CCustomCaptionBarBase)</P><P>BEGIN_MESSAGE_MAP(CCustomCaptionBar, CCustomCaptionBarBase)<BR>&nbsp;ON_WM_SIZE()<BR>END_MESSAGE_MAP()</P><P><BR>CCustomCaptionBar::CCustomCaptionBar(CSize btnSize)<BR>{&nbsp;<BR>&nbsp;//Some Initialization<BR>&nbsp;//...<BR>&nbsp;//..<BR>&nbsp;//.</P><P>&nbsp;this-&gt;m_cbGradientWidth &nbsp;= 30;<BR>&nbsp;this-&gt;m_clrGradientTop&nbsp;&nbsp;= RGB(79, 131, 209);<BR>&nbsp;this-&gt;m_clrGradientBottom&nbsp;= RGB(255, 255, 255);<BR>&nbsp;this-&gt;m_clrBack&nbsp;&nbsp;&nbsp;= RGB(255, 255, 255);</P><P>&nbsp;this-&gt;m_nXMargeTitle = 10;<BR>&nbsp;this-&gt;m_nYMargeTitle = 10;</P><P>&nbsp;m_strTitle = _T("&#1602;&#1587;&#1605; &#1575;&#1604;&#1587;&#1606;&#1577; &#1575;&#1604;&#1571;&#1608;&#1604;&#1609; &#1571;");</P><P>&nbsp;//this-&gt;m_fntTitle.CreatePointFont( 180, _T("WinSoft Serif Pro") );<BR>&nbsp;LOGFONT lf;<BR>&nbsp;::ZeroMemory(&amp;lf, sizeof(LOGFONT));</P><P>&nbsp;lf.lfHeight = -MulDiv( 18, theApp.m_pSAMResource-&gt;m_LogPixelsY, 72 );<BR>&nbsp;lf.lfCharSet = ARABIC_CHARSET;<BR>&nbsp;lf.lfQuality = /*ANTIALIASED_QUALITY; //*/CLEARTYPE_QUALITY;<BR>&nbsp;&nbsp;&nbsp; &nbsp;::STRCPY_S(lf.lfFaceName, LF_FACESIZE, _T("WinSoft Serif Pro") );&nbsp; <BR>&nbsp;<BR>&nbsp;this-&gt;m_fntTitle.CreateFontIndirect( &amp;lf );</P><P><BR>}</P><P>CCustomCaptionBar::~CCustomCaptionBar()<BR>{<BR>&nbsp;this-&gt;m_fntTitle.DeleteObject();<BR>}</P><P><BR>VOID CCustomCaptionBar::DrawItem(LPDRAWITEMSTRUCT lpDrawIS)<BR>{<BR>&nbsp;CDC&nbsp;&nbsp;*pdc = CDC::FromHandle(lpDrawIS-&gt;hDC);</P><P>&nbsp;CRect&nbsp;rcClient;&nbsp;this-&gt;GetClientRect( &amp;rcClient );<BR>&nbsp;CRect&nbsp;rcGradient(rcClient); rcGradient.bottom = rcGradient.top + this-&gt;m_cbGradientWidth;<BR>&nbsp;CRect&nbsp;rcSolid(rcClient);&nbsp; rcSolid.MoveToY(rcGradient.bottom); rcSolid.bottom-=rcGradient.bottom;</P><P>&nbsp;XTPDrawHelpers()-&gt;GradientFill( pdc, rcGradient, this-&gt;m_clrGradientTop, this-&gt;m_clrGradientBottom, FALSE);&nbsp;<BR>&nbsp;pdc-&gt;FillSolidRect( rcSolid, this-&gt;m_clrBack );</P><P>&nbsp;pdc-&gt;SetBkMode( TRANSPARENT );<BR>&nbsp;pdc-&gt;SetTextColor( RGB(55,55,55) );<BR>&nbsp;pdc-&gt;SelectObject( m_fntTitle );<BR>&nbsp;UINT&nbsp;nFormat = DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS;//|DT_RIGHT;//*|DT_RTLREADING*/|DT_NOCLIP;//DT_INTERNAL</P><P>&nbsp;this-&gt;m_rcTitle.SetRect(0,0,rcClient.Width(),0);<BR>&nbsp;pdc-&gt;DrawText( this-&gt;m_strTitle, this-&gt;m_rcTitle, DT_SINGLELINE|DT_CALCRECT&nbsp; );<BR>&nbsp;pdc-&gt;DrawText( this-&gt;m_strTitle, this-&gt;m_rcTitle, nFormat );<BR>&nbsp;pdc-&gt;FrameRect( this-&gt;m_rcTitle, &amp;CBrush(RGB(255,0,0)) );</P><P>&nbsp;CRect&nbsp;rcrc(this-&gt;m_rcTitle); rcrc.top = rcrc.bottom; rcrc.bottom ++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rcrc.left +=6; //rcrc.right = 200;<BR>&nbsp;XTPDrawHelpers()-&gt;GradientFill( pdc, rcrc, this-&gt;m_clrGradientTop, this-&gt;m_clrGradientBottom, TRUE);&nbsp;<BR>&nbsp;<BR>}</P><P>Note: I used arabic characters, and drawing from right to left; the application initialized first with (CWinApp)this-&gt;SetDefaultLayout( LAYOUT_RTL );<BR></P>]]>
   </description>
   <pubDate>Mon, 02 Jul 2007 17:01:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24130&amp;title=question-about-rendering-text#24130</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : in line this-&amp;gt;m_rcTitle.SetRect(0,0,0,0); height...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24113&amp;title=question-about-rendering-text#24113</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 02 July 2007 at 8:46am<br /><br /><P>in line this-&gt;m_rcTitle.SetRect(0,0,0,0);<BR></P><DIV></DIV>height have to be 0, but width have to be real width you need. try to replace to<DIV>&nbsp;</DIV>&nbsp;this-&gt;m_rcTitle.SetRect(0,0,<strong>rcClient.Width(),</strong>0);<BR>&nbsp;pdc-&gt;DrawText( this-&gt;m_strTitle, this-&gt;m_rcTitle,<strong> DT_SINGLELINE</strong>|DT_CALCRECT );<BR><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Mon, 02 Jul 2007 08:46:16 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24113&amp;title=question-about-rendering-text#24113</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : First I like to thanks oleg forhis...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24105&amp;title=question-about-rendering-text#24105</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 02 July 2007 at 5:45am<br /><br /><DIV>First I like to thanks <strong><U>oleg</U></strong> for&nbsp;his great help. <img src="http://forum.codejock.com/smileys/smiley20.gif" border="0"></DIV><DIV>&nbsp;</DIV><DIV>Look I don't know where I am wrong, this is my code:</DIV><DIV><BR>VOID CCustomCaptionBar::DrawItem(LPDRAWITEMSTRUCT lpDrawIS)<BR>{<BR>&nbsp;CDC *pdc = CDC::FromHandle(lpDrawIS-&gt;hDC);</DIV><P>&nbsp;CRect rcClient; this-&gt;GetClientRect( &amp;rcClient );<BR>&nbsp;CRect rcGradient(rcClient); rcGradient.bottom = rcGradient.top + this-&gt;m_cbGradientWidth;<BR>&nbsp;CRect rcSolid(rcClient); rcSolid.MoveToY(rcGradient.bottom); rcSolid.bottom-=rcGradient.bottom;</P><P>&nbsp;XTPDrawHelpers()-&gt;GradientFill( pdc, rcGradient, this-&gt;m_clrGradientTop, this-&gt;m_clrGradientBottom, FALSE); </P><P>&nbsp;pdc-&gt;FillSolidRect( rcSolid, this-&gt;m_clrBack );<BR>&nbsp;pdc-&gt;SetBkMode( TRANSPARENT );<BR>&nbsp;pdc-&gt;SetTextColor( RGB(255,0,0) );<BR>&nbsp;pdc-&gt;SelectObject( this-&gt;m_fntTitle );</P><P>&nbsp;UINT nFormat = DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS;//|DT_RIGHT;//*|DT_RTLREADING*/|DT_NOCLIP;//DT_INTERNAL<BR>&nbsp;this-&gt;m_rcTitle.SetRect(0,0,0,0);<BR>&nbsp;pdc-&gt;DrawText( this-&gt;m_strTitle, this-&gt;m_rcTitle, DT_CALCRECT );<BR>&nbsp;//Mybe I will use margin so I used<BR>&nbsp;this-&gt;m_rcTitle.MoveToXY( MarginX, MarginY );&nbsp;&lt;&lt;=== It's this right. I have remove it for testing but it's the same<BR>&nbsp;pdc-&gt;DrawText( this-&gt;m_strTitle, this-&gt;m_rcTitle, nFormat );<BR>}<BR></P>]]>
   </description>
   <pubDate>Mon, 02 Jul 2007 05:45:29 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24105&amp;title=question-about-rendering-text#24105</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : pdc-&amp;gt;DrawText( CString, CRect,DT_CALCRECT...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24099&amp;title=question-about-rendering-text#24099</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 02 July 2007 at 5:01am<br /><br /><FONT size=2>pdc-&gt;DrawText( CString, CRect,&nbsp;DT_CALCRECT ); have to return right value - check that rcHeight is 0 before you run it:<DIV></DIV><DIV></DIV><DIV></DIV>CRect rc(0, <strong>0</strong>, nWidth, <strong>0</strong>);<DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV></FONT>]]>
   </description>
   <pubDate>Mon, 02 Jul 2007 05:01:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24099&amp;title=question-about-rendering-text#24099</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : I have a question about calculate...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24082&amp;title=question-about-rendering-text#24082</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 02 July 2007 at 2:20am<br /><br /><P>I have a question about calculate the height of Text?</P><FONT size=2><DIV>First I select a font object created previously </DIV><DIV>*/pdc-&gt;<FONT size=2>SelectObject( mFont );</FONT></FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>then I used one of these function</FONT></DIV><DIV><FONT size=2>1/pdc-&gt;GetTextMetrics(&amp;<FONT size=2>TEXTMETRIC);</FONT></FONT></DIV><DIV><FONT size=2>&nbsp;&nbsp; then I use <FONT size=2>TEXTMETRIC.<FONT size=2>tmHeight</FONT></FONT></FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>2/CSIZE = pdc-&gt;<FONT size=2>GetTextExtent( CString );</FONT></FONT></DIV><DIV><FONT size=2>&nbsp;&nbsp; then I use CSIZE.cy</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>3/pdc-&gt;DrawText<FONT size=2>( CString</FONT><FONT size=2>, CRect</FONT><FONT size=2>,&nbsp;<FONT size=2>DT_CALCRECT</FONT> );</FONT></FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>but no one of them can return the right value of height.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Well, I wonder if you can help me....</DIV></FONT>]]>
   </description>
   <pubDate>Mon, 02 Jul 2007 02:20:15 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24082&amp;title=question-about-rendering-text#24082</guid>
  </item> 
  <item>
   <title><![CDATA[Question about rendering Text? : There is no problem, but I just...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24064&amp;title=question-about-rendering-text#24064</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3085">shobits1</a><br /><strong>Subject:</strong> 7489<br /><strong>Posted:</strong> 30 June 2007 at 2:47pm<br /><br />There is no problem, but I just wondered if there is special function in codejock.<DIV>&nbsp;</DIV><DIV>thank's for replay</DIV>]]>
   </description>
   <pubDate>Sat, 30 Jun 2007 14:47:07 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7489&amp;PID=24064&amp;title=question-about-rendering-text#24064</guid>
  </item> 
 </channel>
</rss>