<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Textausgabe mit TrueTypeFonts]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte einen Text in einer ttf Schriftart ausgeben. Ich habe dazu ein Bsp. gefunden, leider ändert sich nicht die Schriftart. Die grösse der Schriftart kann ich aber verändern.</p>
<p>Hier ist der Code :</p>
<pre><code class="language-cpp">void CTouch_MFC2Dlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	// TODO: Add your message handler code here

	// Do not call CDialog::OnPaint() for painting messages

	CPen *oldpen = NULL;
	CPen VioletPen(PS_SOLID,2,RGB(128,0,128));
	oldpen = dc.SelectObject(&amp;VioletPen);// noch kein Raster zeichnen, nur Linie ausgeben
	dc.MoveTo(51, 51);
	dc.LineTo(150, 150);
	dc.SelectObject(oldpen);

	CBrush NewBrush(RGB(250, 25, 5));
	CBrush *pBrush = dc.SelectObject(&amp;NewBrush);
		dc.SelectObject(GetStockObject(NULL_PEN)); //NULL_PEN (Rechteck ohne Umrandung)
	dc.Rectangle(20, 20, 250, 125);

CFont font;
VERIFY(font.CreateFont(
   40,                        // nHeight
   0,                         // nWidth
   0,                         // nEscapement
   0,                         // nOrientation
   FW_NORMAL,                 // nWeight
   FALSE,                     // bItalic
   FALSE,                     // bUnderline
   0,                         // cStrikeOut
   ANSI_CHARSET,              // nCharSet
   OUT_DEFAULT_PRECIS,        // nOutPrecision
   CLIP_DEFAULT_PRECIS,       // nClipPrecision
   DEFAULT_QUALITY,           // nQuality
   DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
   _T(&quot;CENTURY&quot;)));             // lpszFacename

CFont* def_font = dc.SelectObject(&amp;font);
dc.ExtTextOut(325, 225, ETO_OPAQUE, NULL, _T(&quot;Hello&quot;), NULL);
dc.SelectObject(def_font);

// Finished with the font, now delete the font object.
font.DeleteObject(); 

}
</code></pre>
<p>Wer kann mir sagen, was ich falsch mache?</p>
<p>Gruß<br />
spacehelix</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/150677/textausgabe-mit-truetypefonts</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 13:45:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150677.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Jun 2006 11:46:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Textausgabe mit TrueTypeFonts on Mon, 19 Jun 2006 11:46:20 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte einen Text in einer ttf Schriftart ausgeben. Ich habe dazu ein Bsp. gefunden, leider ändert sich nicht die Schriftart. Die grösse der Schriftart kann ich aber verändern.</p>
<p>Hier ist der Code :</p>
<pre><code class="language-cpp">void CTouch_MFC2Dlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	// TODO: Add your message handler code here

	// Do not call CDialog::OnPaint() for painting messages

	CPen *oldpen = NULL;
	CPen VioletPen(PS_SOLID,2,RGB(128,0,128));
	oldpen = dc.SelectObject(&amp;VioletPen);// noch kein Raster zeichnen, nur Linie ausgeben
	dc.MoveTo(51, 51);
	dc.LineTo(150, 150);
	dc.SelectObject(oldpen);

	CBrush NewBrush(RGB(250, 25, 5));
	CBrush *pBrush = dc.SelectObject(&amp;NewBrush);
		dc.SelectObject(GetStockObject(NULL_PEN)); //NULL_PEN (Rechteck ohne Umrandung)
	dc.Rectangle(20, 20, 250, 125);

CFont font;
VERIFY(font.CreateFont(
   40,                        // nHeight
   0,                         // nWidth
   0,                         // nEscapement
   0,                         // nOrientation
   FW_NORMAL,                 // nWeight
   FALSE,                     // bItalic
   FALSE,                     // bUnderline
   0,                         // cStrikeOut
   ANSI_CHARSET,              // nCharSet
   OUT_DEFAULT_PRECIS,        // nOutPrecision
   CLIP_DEFAULT_PRECIS,       // nClipPrecision
   DEFAULT_QUALITY,           // nQuality
   DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
   _T(&quot;CENTURY&quot;)));             // lpszFacename

CFont* def_font = dc.SelectObject(&amp;font);
dc.ExtTextOut(325, 225, ETO_OPAQUE, NULL, _T(&quot;Hello&quot;), NULL);
dc.SelectObject(def_font);

// Finished with the font, now delete the font object.
font.DeleteObject(); 

}
</code></pre>
<p>Wer kann mir sagen, was ich falsch mache?</p>
<p>Gruß<br />
spacehelix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080556</guid><dc:creator><![CDATA[spacehelix]]></dc:creator><pubDate>Mon, 19 Jun 2006 11:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to Textausgabe mit TrueTypeFonts on Mon, 19 Jun 2006 12:12:37 GMT]]></title><description><![CDATA[<p>Ist die Schriftart auf dem PC installiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080572</guid><dc:creator><![CDATA[guenni81]]></dc:creator><pubDate>Mon, 19 Jun 2006 12:12:37 GMT</pubDate></item><item><title><![CDATA[Reply to Textausgabe mit TrueTypeFonts on Mon, 19 Jun 2006 12:27:44 GMT]]></title><description><![CDATA[<p>Ich arbeite mit Windows CE. Ich habe die Schrifart in das Verzeichnis Fonts auf dem Windows CE Rechner kopiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080580</guid><dc:creator><![CDATA[spacehelix]]></dc:creator><pubDate>Mon, 19 Jun 2006 12:27:44 GMT</pubDate></item></channel></rss>