Difference between revisions of "Gb.display.setFont"

From Gamebuino Wiki
Jump to: navigation, search
m (syntax)
m (Fixed link to font editor)
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
== Description ==
 
== Description ==
 
Change the font used in <code>gb.display.print</code> and <code>gb.display.drawChar</code>
 
Change the font used in <code>gb.display.print</code> and <code>gb.display.drawChar</code>
 +
 +
The font can be either one of the default fonts or a custom font. The tools to create your own are on [https://github.com/Rodot/Gamebuino-Font GitHub].
 +
 +
To be able to use one of the default fonts, don't forget to add <code>extern const byte font3x3[];</code> at the beginning of your sketch  (see example below).
 +
 +
{| class="wikitable" style="text-align: center;"
 +
|+Default fonts
 +
|[[File:Font3x3.png]]
 +
|[[File:Font3x5.png]]
 +
|[[File:Font5x7.png]]
 +
|-
 +
|font3x3
 +
|font3x5
 +
|font5x7
 +
|}
  
 
== Syntax ==
 
== Syntax ==
<pre>gb.setFont(font);</pre>
+
<pre>gb.display.setFont(font);</pre>
  
 
== Parameters ==
 
== Parameters ==
* font: the font you want to use. It can be either a default font (font3x5 or font5x7) or a custom font embedded in the game. You can tools to edit the default fonts and create your own on [https://github.com/Rodot/Gamebuino Gamebuino's GitHub] in /utilities/font/font_editor.
+
* font: the font you want to use.
  
 
== Returns ==
 
== Returns ==
Line 14: Line 29:
  
 
== Example ==
 
== Example ==
<gistit>https://github.com/Rodot/Gamebuino/blob/master/libraries/Gamebuino/examples/5.Reference/display/setFont/setFont.ino</gistit>
+
<gistit>https://github.com/Rodot/Gamebuino/blob/master/examples/5.Reference/display/setFont/setFont.ino</gistit>
  
 
== See also ==
 
== See also ==
 
* [[gb.display.print]]
 
* [[gb.display.print]]
 
* [[gb.display.setTextSize]]
 
* [[gb.display.setTextSize]]

Latest revision as of 2016-12-31T10:12:41

Description

Change the font used in gb.display.print and gb.display.drawChar

The font can be either one of the default fonts or a custom font. The tools to create your own are on GitHub.

To be able to use one of the default fonts, don't forget to add extern const byte font3x3[]; at the beginning of your sketch (see example below).

Default fonts
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
font3x3 font3x5 font5x7

Syntax

gb.display.setFont(font);

Parameters

  • font: the font you want to use.

Returns

none

Example

See also