Added new pages and docs
[sdlgit/SDL-Site.git] / pages / SDL-TTF.html-inc
index 07f9114..91fdfbf 100644 (file)
@@ -4,6 +4,7 @@
 
 <ul><li><a href="#NAME">NAME</a></li>
 <li><a href="#CATEGORY">CATEGORY</a></li>
+<li><a href="#CONSTANTS">CONSTANTS</a></li>
 <li><a href="#METHODS">METHODS</a>
 <ul><li><a href="#General_methods">General methods</a>
 <ul><li><a href="#linked_version">linked_version</a></li>
@@ -92,7 +93,7 @@
 </li>
 </ul>
 </li>
-<li><a href="#AUTHOR">AUTHOR</a></li>
+<li><a href="#AUTHORS">AUTHORS</a></li>
 <li><a href="#SEE_ALSO">SEE ALSO</a>
 </li>
 </ul><hr />
 <p>TTF</p>
 
 </div>
+<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CONSTANTS_CONTENT">
+<p>The constants are exported by default. You can avoid this by doing:</p>
+<pre> use SDL::TTF ();
+
+</pre>
+<p>and access them directly:</p>
+<pre> SDL::TTF::TTF_HINTING_NORMAL;
+
+</pre>
+<p>Available constants for &quot;hinting&quot;:</p>
+<ul>
+               <li>TTF_HINTING_NORMAL  </li>
+               <li>TTF_HINTING_LIGHT   </li>
+               <li>TTF_HINTING_MONO    </li>
+               <li>TTF_HINTING_NONE</li>
+</ul>
+
+<p>Available constants for &quot;style&quot;:</p>
+<ul>
+               <li>TTF_STYLE_NORMAL    </li>
+               <li>TTF_STYLE_BOLD      </li>
+               <li>TTF_STYLE_ITALIC    </li>
+               <li>TTF_STYLE_UNDERLINE </li>
+               <li>TTF_STYLE_STRIKETHROUGH</li>
+</ul>
+
+
+</div>
 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
 <div id="METHODS_CONTENT">
 
@@ -159,8 +189,8 @@ SDL does not have to be initialized before this call.</p>
 
 </pre>
 <p>Query the initilization status of the truetype font API.
-You may, of course, use this before <a href="/SDL-TTF.html#init">SDL::TTF::init</a> to avoid initializing twice in a row. Or use this to determine if you need to call 
-<a href="/SDL-TTF.html#quit">SDL::TTF::quit</a>.</p>
+You may, of course, use this before <a href="/SDL-TTF.html#init">SDL::TTF::init</a> to avoid initializing twice in a row. Or use this to determine if you need to 
+call <a href="/SDL-TTF.html#quit">SDL::TTF::quit</a>.</p>
 
 </div>
 <h3 id="quit">quit</h3>
@@ -169,8 +199,8 @@ You may, of course, use this before <a href="/SDL-TTF.html#init">SDL::TTF::init<
 
 </pre>
 <p>Shutdown and cleanup the truetype font API.
-After calling this the SDL::TTF functions should not be used, excepting <a href="/SDL-TTF.html#was_init">SDL::TTF::was_init</a>. You may, of course, use <a href="/SDL-TTF.html#init">SDL::TTF::init</a> to 
-use the functionality again</p>
+After calling this the SDL::TTF functions should not be used, excepting <a href="/SDL-TTF.html#was_init">SDL::TTF::was_init</a>. You may, of course, use 
+<a href="/SDL-TTF.html#init">SDL::TTF::init</a> to use the functionality again</p>
 
 </div>
 <h2 id="Management_functions">Management functions</h2>
@@ -182,13 +212,13 @@ use the functionality again</p>
 <pre> my $font = SDL::TTF::open_font($font_file, $point_size);
 
 </pre>
-<p>Load file for use as a font, at the given size. This is actually <code>SDL::TTF::open_font_index(..., ..., $index = 0)</code>. This can load TTF and FON files.</p>
+<p>Load file for use as a font, at the given size. This is actually <code>SDL::TTF::open_font_index(..., ..., $index = 0)</code>. This can load TTF, OTF and FON files.</p>
 <p>Returns: a <a href="SDL-TTF-Font.html">SDL::TTF::Font</a> object. <code>undef</code> is returned on errors.</p>
 <p>Example:</p>
 <pre> use SDL::TTF;
  use SDL::TTF::Font;
 
- my $font = SDL::TTF::open_font('arial.ttf', '24);
+ my $font = SDL::TTF::open_font('arial.ttf', 24);
 
 </pre>
 
@@ -595,20 +625,20 @@ is done to get the actual width. The height returned in h is the same as you can
 version 2.3.5</p>
 <p>Example:</p>
 <pre> use SDL;
+ use SDL::Rect;
  use SDL::Video;
  use SDL::Color;
  use SDL::TTF;
  use SDL::TTF::Font;
 
  SDL::init(SDL_INIT_VIDEO);
-
+ SDL::TTF::init();
  my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- my $font    = SDL::TTF::open_font('arial.ttf', '24);
+ my $font    = SDL::TTF::open_font('somefont.ttf', '24');
+ die 'Coudnt make font '. SDL::get_error if !$font;
  my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color-&gt;new(0xFF,0xFF,0xFF));
-
  SDL::Video::blit_surface($surface, SDL::Rect-&gt;new(0, 0, 640, 480), $display, SDL::Rect-&gt;new(10, 10, 640, 480));
  SDL::Video::update_rect($display, 0, 0, 0, 0);
-
  SDL::delay(5000);
 
 </pre>
@@ -665,8 +695,10 @@ your display-surface.</p>
 
  SDL::init(SDL_INIT_VIDEO);
 
+ SDL::TTF::init();
+
  my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- my $font    = SDL::TTF::open_font('arial.ttf', '24);
+ my $font    = SDL::TTF::open_font('arial.ttf', '24');
  my $white   = SDL::Color-&gt;new(0xFF, 0xFF, 0xFF);
  my $black   = SDL::Color-&gt;new(0x00, 0x00, 0x00);
  my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', $white, $black);
@@ -726,8 +758,10 @@ your display-surface.</p>
 
  SDL::init(SDL_INIT_VIDEO);
 
+ SDL::TTF::init();
+
  my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- my $font    = SDL::TTF::open_font('arial.ttf', '24);
+ my $font    = SDL::TTF::open_font('arial.ttf', '24');
  my $surface = SDL::TTF::render_text_blended($font, 'Hallo!', SDL::Color-&gt;new(0xFF,0xFF,0xFF));
 
  SDL::Video::blit_surface($surface, SDL::Rect-&gt;new(0, 0, 640, 480), $display, SDL::Rect-&gt;new(10, 10, 640, 480));
@@ -755,9 +789,9 @@ your display-surface.</p>
 <p><strong>Note</strong>: The unicode char has to be passed exactly like for <a href="/SDL-TTF.html#size_unicode">SDL::TTF::size_unicode</a>.</p>
 
 </div>
-<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="AUTHOR_CONTENT">
-<p>Tobias Leich [FROGGS]</p>
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
 
 </div>
 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>