<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Extended characters with Allegro 4.9.21 </title>
		<link>http://www.allegro.cc/forums/view/604941</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 25 Aug 2010 19:35:08 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,</p><p>I wanna known how in Allegro 4.9.21 can I write characters like áçñÑè among others. <b>Using .TTF (TrueTypeFonts)</b></p><p>I used to use set_uformat(U_ASCII) in Allegro 4.2 but I cannot found an equivalent here.</p><p>Thanks in advance.<br />Marce.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marce666)</author>
		<pubDate>Tue, 24 Aug 2010 20:09:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can input them as UTF-8 characters. See the ex_font example.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 24 Aug 2010 20:12:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/604941/880572#target">Marce666</a> said:</div><div class="quote"><p>I wanna known how in Allegro 4.9.21 can I write characters like áçñÑè among others.</p></div></div><p>Allegro 5&#39;s new string api uses utf8. So you can generally just use utf8 anywhere and it ought to work. Though I think things will work more reliably if you use the _ustr functions when you have the option, rather than the functions that take plain <span class="source-code"><span class="k1">char</span><span class="k3">*</span></span>. like <span class="source-code">al_draw_ustr</span> rather than <span class="source-code">al_draw_text</span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 24 Aug 2010 20:14:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks, but where should I look up those examples ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marce666)</author>
		<pubDate>Tue, 24 Aug 2010 20:20:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the <span class="source-code">example<span class="k3">/</span></span> directory that comes with Allegro.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 24 Aug 2010 20:28:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Example of ex_font doesn&#39;t helps me because I have to use TrueTypeFont.<br />I also tried with utf8 but no extended characters appears.</p><p>In both cases, print function works until first extended characters is found.<br />In the attachment the resulting file. </p><p>Here the code:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span>al_init<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> 
<span class="number">  2</span>al_init_font_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> 
<span class="number">  3</span>al_init_ttf_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> 
<span class="number">  4</span>al_init_image_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> 
<span class="number">  5</span>al_init_primitives_addon<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  6</span>
<span class="number">  7</span>display <span class="k3">=</span> al_create_display<span class="k2">(</span><span class="n">320</span>, <span class="n">200</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>al_draw_filled_rectangle<span class="k2">(</span><span class="n">0</span>, <span class="n">0</span>, <span class="n">320</span>, <span class="n">200</span>, al_map_rgb<span class="k2">(</span><span class="n">0</span>, <span class="n">0</span>, <span class="n">180</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>
<span class="number"> 10</span>ALLEGRO_FONT <span class="k3">*</span> pFont <span class="k3">=</span> al_load_ttf_font<span class="k2">(</span><span class="s">"ARIAL.TTF"</span>, <span class="n">30</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>ALLEGRO_USTR <span class="k3">*</span> pText <span class="k3">=</span> al_ustr_new<span class="k2">(</span><span class="s">"Hello á Bye"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>    
<span class="number"> 13</span><span class="c">//draw with ALLEGRO_USTR</span>
<span class="number"> 14</span>al_draw_ustr<span class="k2">(</span>pFont, al_map_rgb<span class="k2">(</span><span class="n">255</span>, <span class="n">255</span>, <span class="n">0</span><span class="k2">)</span>, <span class="n">10</span>, <span class="n">10</span>, ALLEGRO_ALIGN_LEFT, pText<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>
<span class="number"> 16</span><span class="c">// draw with char *</span>
<span class="number"> 17</span>al_draw_text<span class="k2">(</span>pFont, al_map_rgb<span class="k2">(</span><span class="n">255</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span>, <span class="n">10</span>, <span class="n">50</span>, ALLEGRO_ALIGN_LEFT, <span class="s">"Hello ñ Bye "</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 18</span>
<span class="number"> 19</span>ALLEGRO_BITMAP <span class="k3">*</span> pBitmap <span class="k3">=</span> al_get_backbuffer<span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 20</span><span class="k1">if</span> <span class="k2">(</span>pBitmap<span class="k2">)</span>
<span class="number"> 21</span>  al_save_bitmap<span class="k2">(</span><span class="s">"file1.bmp"</span>, pBitmap<span class="k2">)</span><span class="k2">;</span>
</div></div><p>

Any idea ?</p><p>Thanks, Marce.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marce666)</author>
		<pubDate>Tue, 24 Aug 2010 22:11:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In your editor, make sure the file is encoded as UTF8.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 25 Aug 2010 01:08:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, my editor was set to Auto-dectect UTF8.<br />Still not working...<br /><img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marce666)</author>
		<pubDate>Wed, 25 Aug 2010 01:26:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does ex_ttf work?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 25 Aug 2010 01:38:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Make sure your font contains that particular character.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 25 Aug 2010 06:24:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve never done unicode in C/C++, but I&#39;ve seen <span class="source-code">L<span class="s">"some unicode string"</span></span> before... Try that?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kibiz0r)</author>
		<pubDate>Wed, 25 Aug 2010 07:10:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s the syntax for a wide character strings, which is too ambigous to be usable in portable programs. Allegro only accepts UTF-8 encoded strings.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 25 Aug 2010 09:05:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>When you source code is in UTF-8 every string you put in will work with Allegro. UCS-2 (L&quot;&quot; syntax) is supported in modern compilers, but usually there are not standard libraries which allow to convert between UCS-2 and UTF-8. Allegro have handy routines to deal with such conversion, look at al_utf8_width() and al_utf8_encode().</p><p>In case, when you want full Unicode support you need to use native system routines or external library.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Wed, 25 Aug 2010 12:11:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Finally the problem was the encode of the main.pp file.<br />example ex_ttf.c works fine.</p><p>Eventhought UTF-8 was in auto-detect mode (Visual Studio 2010 express), each file has to be save as unicode-UTF8.</p><p>Save File AS -&gt; Save with encoding -&gt; Unicode (UTF-8 widthout signature) - Codepage 65001</p><p>Nota: I have to save to another encode, save, close (IDE), open and then set the correct codepage.<br /><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>Thanks All !!!!<br />Marce.<br /><img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marce666)</author>
		<pubDate>Wed, 25 Aug 2010 19:35:08 +0000</pubDate>
	</item>
</rss>
