<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] feature request: &quot;al_create_builtin_8x8_bitmap_font&quot;</title>
		<link>http://www.allegro.cc/forums/view/605306</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 06 Nov 2010 13:09:08 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just posting this here, so I can link to this thread and the attachment in the message which I&#39;ll write to the developer mailing-list in a moment.</p><p>Briefly, this is about a request to include an embedded font within the &quot;allegro_font&quot; addon, so that it would be possible for example to display some quick debugging info without having to load an external font file.</p><p>I <b>already wrote the function</b> and adapted the font data from Allegro4 for that (see <a href="http://www.allegro.cc/files/attachment/602398">attached zip</a>, which includes the code to create the font at runtime and a modified ex_bitmap.c to demonstrate usage).</p><p><b>edit</b><br /><a href="http://www.allegro.cc/files/attachment/602420">attached</a> a new version with minor changes (fixed potentially problematic call to allegros font grabbing function (I wasn&#39;t sure whether it was safe to pass NULL for any pointer parameter and if these parameters are sanity checked (!=NULL) inside the function but now that should never happen.) and fixed a comment)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Fri, 15 Oct 2010 01:10:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Would it be better to have a function called <span class="source-code">al_load_default_font</span> that just loads the systems default font?  Or just something like a Courier or Terminal font should be fine on any system that has it.</p><p>I still like the idea of having a built-in font though...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ron Novy)</author>
		<pubDate>Fri, 15 Oct 2010 03:40:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think it would be good to have this as a standard add-on in 5.2. The function name is terrible though... Something like <span class="source-code">al_get_generic_font<span class="k2">(</span><span class="k2">)</span></span> is easier to remember. Perhaps it could take a scaling parameter.</p><p>Also, it might be beneficial to have this in the same add-on:
</p><div class="source-code snippet"><div class="inner"><pre>al_load_system_font<span class="k2">(</span> <span class="k1">int</span> family, <span class="k1">int</span> size, <span class="k1">int</span> flags <span class="k2">)</span><span class="k2">;</span>

<span class="c">// these could be hard-coded to known OS fonts</span>
ALLEGRO_FONT_MONOSPACE <span class="k2">(</span>e.g., Courier<span class="k2">)</span>
ALLEGRO_FONT_SANS_SERIF <span class="k2">(</span>e.g., Arial<span class="k2">)</span>
ALLEGRO_FONT_SERIF <span class="k2">(</span>e.g., Times New Roman<span class="k2">)</span>

<span class="c">// user fonts ... some intersection of commonly defined fonts</span>
ALLEGRO_FONT_DESKTOP
ALLEGRO_FONT_WINDOW_TITLE
</pre></div></div><p>

Alternatively:
</p><div class="source-code snippet"><div class="inner"><pre>al_load_system_font<span class="k2">(</span> <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>name, <span class="k1">int</span> size, <span class="k1">int</span> flags <span class="k2">)</span><span class="k2">;</span>

<span class="s">"Verdana, Arial, sans-serif"</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 15 Oct 2010 10:20:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, system fonts would be awesome. Could use fontconfig on linux. That&#39;d be very nice.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 15 Oct 2010 11:03:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I renamed the function to &quot;al_create_default_font&quot; and attached the new version (plus minor fixes) to the first post. I would keep the &quot;create&quot; in the function name as a hint that the user is responsible for cleaning it up in the end via &quot;al_destroy_font&quot;.</p><p>Loading system fonts would be sweet indeed. For the font family parameter there could maybe even be a parameter like ALLEGRO_FONT_SYSTEM_DEFAULT which would try to load whichever font is usually 100% certainly available on the executing platform (and maybe fall back to a built-in font if that fails).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Sat, 16 Oct 2010 15:49:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I kinda like the char* version better. This allows for CSS style font loading, like Matthew has shown.</p><p>We can use the same font families as CSS to allow specification of preferred font, backup font, and family. I think things would go smoother from an application programmer&#39;s point of view.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (furinkan)</author>
		<pubDate>Sun, 17 Oct 2010 02:03:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve figured out how to do the thing on OS X: get Library locations (usually ~/Library with fall back to /Library, but there are cocoa functions for getting this that one should use instead of hardcoding) and then look for Fonts. The non-trivial part is figuring out the filename you want, which is typically &quot;Fontname Bold Italic.ttf&quot; or &quot;FontnameBold.ttf&quot;, but could be anything really. I guess it&#39;s possible to try those first, then look at the font descriptions in each font file until the desired font is found.</p><p>Anyway, this is mainly a note to myself for how to implement this once an API is decided on and there is nothing left to do on 5.0.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 17 Oct 2010 18:03:36 +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/605306/886360#target">Evert</a> said:</div><div class="quote"><p>I&#39;ve figured out how to do the thing on OS X: get Library locations (usually ~/Library with fall back to /Library, but there are cocoa functions for getting this that one should use instead of hardcoding) and then look for Fonts. </p></div></div><p>Um, OSX should have a proper API for this. Doing it by searching for some font path is a little error prone.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 17 Oct 2010 18:27:49 +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/605306/886366#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>Um, OSX should have a proper API for this. Doing it by searching for some font path is a little error prone.
</p></div></div><p>

The alternative would be to not use Freetype at all and use OS functions to render glyphs instead (without ever knowing the font path). This would be more work to implement though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sun, 17 Oct 2010 19:12:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I suppose they could have left out a way to find fonts by attributes. That would suck though. I wonder if fontconfig works on OSX too?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 17 Oct 2010 19:18:50 +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/605306/886366#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>Um, OSX should have a proper API for this.</p></div></div><p>
Sure. If I want an NSFont. But I don&#39;t, I want an ALLEGRO_FONT, which means I want to know a path to a filename.<br />It has a proper API for drawing text too, and we&#39;re also duplicating that.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605306/886375#target">Elias</a> said:</div><div class="quote"><p>The alternative would be to not use Freetype at all and use OS functions to render glyphs instead (without ever knowing the font path). This would be more work to implement though.</p></div></div><p>
Wouldn&#39;t work with bitmap fonts and means a substantial redisign of the font addon.<br />Not something we should be doing right now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 17 Oct 2010 19:50:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is an 8x8 font really useful for 90% of the games that will be made? I understand it&#39;s good for old retro games, and maybe as a debugging aid, but even as a debugging aid, it&#39;s too small!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 17 Oct 2010 20:24:40 +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/605306/886386#target">Evert</a> said:</div><div class="quote"><p>Sure. If I want an NSFont. But I don&#39;t, I want an ALLEGRO_FONT, which means I want to know a path to a filename.</p></div></div><p>Yeah I misworded that. But it doesn&#39;t really matter, OSs like OSX and Windows really couldn&#39;t care less about apps that don&#39;t use the native toolkits.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 17 Oct 2010 20:50:17 +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/605306/886390#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>OSs like OSX and Windows really couldn&#39;t care less about apps that don&#39;t use the native toolkits.</p></div></div><p>
No, but we do. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>According to Apple&#39;s documentation for how the Library directory is laid out, Fonts is a standard location, so the method I outlined above should work fine there.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 17 Oct 2010 20:54:43 +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/605306/886391#target">Evert</a> said:</div><div class="quote"><p>According to Apple&#39;s documentation for how the Library directory is laid out, Fonts is a standard location, so the method I outlined above should work fine there.</p></div></div><p>Sure, but actually trying to search for a specific font family or other things just won&#39;t work. At best you&#39;ll be able to do is look at the file name, and thats probably not enough, unless we want to hard code font filenames. But thats not guaranteed to work <i>at all</i>.</p><p>Might be an idea to see if fontconfig works on osx and windows. It could be very useful.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 17 Oct 2010 21:49:55 +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/605306/886389#target">Trent Gamblin</a> said:</div><div class="quote"><p> Is an 8x8 font really useful for 90% of the games that will be made? I understand it&#39;s good for old retro games, and maybe as a debugging aid, but even as a debugging aid, it&#39;s too small!
</p></div></div><p>A scale parameter could be used when creating the default font. 16x16 or 32x32 should be plenty big enough.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sun, 17 Oct 2010 21:56:49 +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/605306/886403#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>Might be an idea to see if fontconfig works on osx and windows. It could be very useful.</p></div></div><p>
It&#39;s available in DarwinPorts, which gives its description as &quot;An XML-based font configuration API for X Windows&quot;, so I&#39;m guessing no native version.</p><p>This (from the port file)
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
platform macosx {<br />lappend add_fonts /Library/Fonts /Network/Library/Fonts /System/Library/Fonts ${prefix}/share/fonts<br />}
</p></div></div><p>
suggests it&#39;s almost (but not quite) looking in the same locations I posted earlier (the function we use for the native file location API on OS X will actually return an array of locations, so if you asked for Library locations it would return all of <i>Library</i>, <i>Networl/Library</i>, <i>System/Library</i>, $HOME/Library; it&#39;s important to look in all those locations, I guess).<br />But there has to be a way (using FreeType?) to get things like font family and the like from the font file? That way, we could do a good &quot;first guess&quot; for common types, then fall back to doing a brute-force search if it fails.<br />Font loading should not be time-critical code anyway.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 17 Oct 2010 22:41:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I did some time ago my function to enumerate font families and so on. Of course FreeType was used. Loading all fonts to collect font family info during application startup is time consuming task. Therefore I decided to use cache in which I store all necessary information about font face (family, style, physical file path, etc.). Such cache can be loaded and used next time. In the result I could type &quot;Times New Roman&quot; instead of &quot;times.ttf&quot;. I think also meta families could be used, like monospace, sherif, etc.</p><p>At the moment I have more than 500 font files under windows. This is fresh install with fonts from Office 2010. Collecting information about all fonts during application startup will cause ~2 second penalty in release mode.</p><p>I think it is good idea to introduce some functions to enumerate fonts installed in the system. To keep this consistent FreeType should be used to collect necessary data. That&#39;s because Windows, Mac and other OS&#39;s use different methods to handle combinations of style/face. For there are fonts: Arial, Arial Narrow and Arial Black. Font family is &#39;Arial&#39;, styles are &#39;Narrow&#39;, &#39;Black&#39;, &#39;Italic&#39;, etc. Some come from font attributes some directly from names. Windows will treat those fonts like different fonts. Adobe products will treat all three as &#39;Arial&#39; family and list &#39;Narrow&#39; and &#39;Black&#39; as styles. I&#39;m not sure how this will work on Mac OS X or Linux. But it is clear that same set of font files will lead to different list of fonts on different OS&#39;s. With FreeType Allegro can provide unified way of enumerating fonts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Mon, 18 Oct 2010 00:47:57 +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/605306/886422#target">Michał Cichoń</a> said:</div><div class="quote"><p>I did some time ago my function to enumerate font families and so on. Of course FreeType was used. Loading all fonts to collect font family info during application startup is time consuming task.</p></div></div><p>
Could do, I suppose. On the other hand, I don&#39;t think we <i>need</i> to do it if the user asks for a specific font type and we can do an educated guess first.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I&#39;m not sure how this will work on Mac OS X or Linux.</p></div></div><p>
OS X lists &quot;Arial.ttf&quot;, &quot;Arial Bold.ttf&quot;, &quot;Arial Italic.ttf&quot; and &quot;Arial Bold Italic.ttf&quot; as &quot;Family Arial&quot; with &quot;Typeface Regular, Bold, Italic, Bold Italic&quot;, but it lists &quot;Arial Narrow.ttf&quot;, &quot;Arial Narrow Bold.ttf&quot; etc. as &quot;Family Arial Narrow&quot; with &quot;Typeface Regular, Bold, Italic, Bold Italic&quot;.<br />Actually, I think the only recognised typefaces are &quot;regular&quot;, &quot;bold&quot; and &quot;italic&quot; (and the combination &quot;bold italic&quot;). Anything else is lumped into the font family.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>But it is clear that same set of font files will lead to different list of fonts on different OS&#39;s. With FreeType Allegro can provide unified way of enumerating fonts.</p></div></div><p>
Since this would sit on top of the TTF addon, which uses FreeType on all platforms, that shouldn&#39;t be a problem. Probably a good thing actually.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Mon, 18 Oct 2010 01:00:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, if user ask for specific font file, family name shouldn&#39;t be used. But still, enumerating all fonts is time consuming process. Results should be cached for example in file (memory file could be also used).</p><p>I think functions for font enumeration should be placed in font add-on. In that way debug font will also be included in result list. TTF add-on should provide sub-enumeration routine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Mon, 18 Oct 2010 01:48:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So as the function searches for a font:</p><ul><li><p>it searches its memory cache first</p><br /></li><li><p>when that fails it searches the paths, but not bothering to open any files that already have an entry in the cache</p><br /></li><li><p>every file that it finds that is not what was wanted still has its information remembered in case it is useful for later</p><br /></li><li><p>It will keep searching for the font until it has run out of locations (meaning an exhaustive search was performed and still failed, by this time all system fonts would be enumerated).</p><br /></li><li><p>It flock()s &amp; writes any new font cache entries into font cache file in temporary files (%temp% /temp or w/e) on allegro_exit (probably skip if flock fails after 3 seconds in a row or something).</p></li></ul><p>Should programmers should probably be able to specify additional search paths? Ones that would will also override system fonts if clash (i.e ./fonts relative to program executable&#39;s assumed path). Might be useful in highly user-customizable, redistributed programs.</p><p>Loading /temp/allegro-fonts.cache or w/e, should have a timestamp for each entry, should validate that each entry still exists and has not been modified since, should do this at add-on initialization.</p><p>My 2 cents
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (m c)</author>
		<pubDate>Mon, 18 Oct 2010 12:24:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The cache should probably be enabled explicitly. Something like:</p><div class="source-code snippet"><div class="inner"><pre>path <span class="k3">=</span> al_get_standard_path<span class="k2">(</span>ALLEGRO_USER_SETTINGS_PATH<span class="k2">)</span>
al_set_fontinfo_cache<span class="k2">(</span>path <span class="k3">+</span> <span class="s">"fontinfo.txt"</span><span class="k2">)</span>
</pre></div></div><p>

That way the cached info would be in ~/.config/mygame/fontinfo.txt for example (under Linux).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 18 Oct 2010 14:59:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It would better belong in temp, or data rather than settings.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Mon, 18 Oct 2010 21:43:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Probably. But this should does not matter.</p><p>I think ALLEGRO_FILE should be supported in the first place. Second, const char* may be provided not otherwise.</p><p>User may want to collect information about system fonts, game fonts or mixed. Let say something like:</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><span class="k1">enum</span> ALLEGRO_FONT_INFO_CACHE_FLAGS
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>    ALLEGRO_SYSTEM_FONTS    <span class="k3">=</span> <span class="n">0x0001</span>,
<span class="number">  4</span>    ALLEGRO_USER_FONTS      <span class="k3">=</span> <span class="n">0x0002</span>
<span class="number">  5</span><span class="k2">}</span><span class="k2">;</span>
<span class="number">  6</span><span class="k1">enum</span> ALLEGRO_FONT_META_FAMILY
<span class="number">  7</span><span class="k2">{</span>
<span class="number">  8</span>    ALLEGRO_SHERIF,
<span class="number">  9</span>    ALLEGRO_MONOSPACE,
<span class="number"> 10</span>    ...
<span class="number"> 11</span><span class="k2">}</span><span class="k2">;</span>
<span class="number"> 12</span><span class="k1">enum</span> ALLEGRO_FONT_STYLE_FLAGS
<span class="number"> 13</span><span class="k2">{</span>
<span class="number"> 14</span>    ALLEGRO_REGULAR <span class="k3">=</span> <span class="n">0x01</span>,
<span class="number"> 15</span>    ALLEGRO_ITALIC  <span class="k3">=</span> <span class="n">0x02</span>,
<span class="number"> 16</span>    ALLEGRO_BOLD    <span class="k3">=</span> <span class="n">0x04</span>
<span class="number"> 17</span><span class="k2">}</span><span class="k2">;</span>
<span class="number"> 18</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> al_font_info_cache_create<span class="k2">(</span><span class="k1">int</span> flags<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 19</span><span class="k1">void</span> al_font_info_cache_destroy<span class="k2">(</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> cache<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 20</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> al_font_info_cache_load_f<span class="k2">(</span>ALLEGRO_FILE<span class="k3">*</span> file<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span><span class="k1">void</span> al_font_info_cache_save_f<span class="k2">(</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> cache, ALLEGRO_FILE<span class="k3">*</span> file<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 22</span><span class="k1">void</span> al_font_info_cache_add_font_f<span class="k2">(</span>ALLEGRO_FILE<span class="k3">*</span> file<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 23</span>ALLEGRO_FONT_INFO<span class="k3">*</span> al_font_info_get_first<span class="k2">(</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> cache<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 24</span>ALLEGRO_FONT_INFO<span class="k3">*</span> al_font_info_get_next<span class="k2">(</span>ALLEGRO_FONT_INFO_CACHE<span class="k3">*</span> cache, ALLEGRO_FONT_INFO<span class="k3">*</span> current<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 25</span>ALLEGRO_USTR<span class="k3">*</span> al_font_info_get_familiy_name<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 26</span><span class="k1">int</span> al_font_info_get_meta_family<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 27</span><span class="k1">int</span> al_font_info_get_style_flags<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 28</span><span class="k1">bool</span> al_font_info_is_fixed_size<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 29</span><span class="k1">int</span> al_font_info_get_first_size<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 30</span><span class="k1">int</span> al_font_info_get_next_size<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info, <span class="k1">int</span> current<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 31</span>
<span class="number"> 32</span><span class="c">/* system font, user font, custom font, etc... */</span>
<span class="number"> 33</span><span class="k1">int</span> al_font_info_get_source<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info<span class="k2">)</span><span class="k2">;</span>
</div></div><p>

In my font renderer I have interfaces IFontFamily, IFont, IFontManager and IFontRenderer. Font can be created using IFontFamily, other IFont but with different style/size, literal family name. Results of my attempt to translate all those to Allegro style functions for sure is not perfect.</p><p>My intention is to introduce functions which provide all necessary (and common) information about font face.</p><p>I will think about proper interface. Any hints/requirements/wishes will be most welcome.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Tue, 19 Oct 2010 03:04:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Would this read in all system fonts?
</p><div class="source-code snippet"><div class="inner"><pre>cache <span class="k3">=</span> al_font_info_cache<span class="k2">(</span>ALLEGRO_SYSTEM_FONTS<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

And what would be the code to get an ALLEGRO_FONT once I have the ALLEGRO_FONT_INFO of the font I want?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 19 Oct 2010 15:52:01 +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/605306/886656#target">Elias</a> said:</div><div class="quote"><p>Would this read in all system fonts?</p></div></div><p>
Yes. Operation will take a few seconds.</p><div class="quote_container"><div class="title">Elias said:</div><div class="quote"><p>And what would be the code to get an ALLEGRO_FONT once I have the ALLEGRO_FONT_INFO of the font I want?</p></div></div><p>
Hm... I think this will be something like:
</p><div class="source-code snippet"><div class="inner"><pre>ALLEGRO_FONT<span class="k3">*</span> <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a> <span class="k3">=</span> al_font_load_from_info<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info, <span class="k1">int</span> size, <span class="k1">int</span> flags<span class="k2">)</span><span class="k2">;</span>
ALLEGRO_FONT<span class="k3">*</span> <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a> <span class="k3">=</span> al_font_load_from_info_with_style<span class="k2">(</span>ALLEGRO_FONT_INFO<span class="k3">*</span> info, <span class="k1">int</span> style, <span class="k1">int</span> size, <span class="k1">int</span> flags<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Lack of function overloading make those above a bit ugly, but descriptive.</p><p>Functions such:<br /><span class="source-code">ALLEGRO_FONT_INFO<span class="k3">*</span> al_font_get_info<span class="k2">(</span>ALLEGRO_FONT<span class="k3">*</span> <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a><span class="k2">)</span><span class="k2">;</span></span><br />Also should be available.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Tue, 19 Oct 2010 18:13:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How does the old allegro-dev saying go? The person who writes the code dictates the API? I think it looks fine and I would use it. I think it&#39;s a good base to work with anyway. You&#39;ll not usually hammer out an entire API and then write the code without any changes. So if you want, you could start writing this in preparation for 5.1. If anybody doesn&#39;t like it, well, they&#39;ve had a chance to say so. And if something turns out not to work well, code is always modifiable. You&#39;d still keep the underlying code in tact so no loss.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 25 Oct 2010 01:35:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I agree. And the simple builtin 8x8 font the thread originally was about is completely separate - it may still be useful to some even when we have a way to use system fonts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 25 Oct 2010 02:08:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I just noticed that rendering fonts with that font created by my function is ridiculously slow. Turned out to be a lot faster when I changed it to make it create a video bitmap instead of a memory bitmap but with a video bitmap the process of creating the font takes several seconds, so maybe there should be a parameter to the font creation function to choose the bitmap type to use.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Fri, 05 Nov 2010 12:54:03 +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/605306/888799#target">Dennis</a> said:</div><div class="quote"><p>I just noticed that rendering fonts with that font created by my function is ridiculously slow. Turned out to be a lot faster when I changed it to make it create a video bitmap instead of a memory bitmap but with a video bitmap the process of creating the font takes several seconds, so maybe there should be a parameter to the font creation function to choose the bitmap type to use.</p></div></div><p>

Try creating the initial bitmap as a memory bitmap, then set the new bitmap flags to video, and <span class="source-code">al_clone_bitmap</span> the bitmap, and use <i>that</i> bitmap for the font. Should load fairly fast, and render decently as well.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 05 Nov 2010 14:56:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think I once replaced the ALLEGRO_FONT vtable so that you could actually render the standard Allegro 4 font. The difficulty then becomes rendering the characters efficiently (didn&#39;t solve that one, I was more concerned with getting it to work, so I just used al_draw_pixel). Maybe locking and unlocking the bitmap will help there.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Fri, 05 Nov 2010 17:51:20 +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/605306/888813#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>Try creating the initial bitmap as a memory bitmap, then set the new bitmap flags to video, and al_clone_bitmap the bitmap, and use that bitmap for the font. Should load fairly fast, and render decently as well.</p></div></div><p>Yes, that did the trick. Thank you Tomasu.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Sat, 06 Nov 2010 13:09:08 +0000</pubDate>
	</item>
</rss>
