1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META http-equiv="Content-Style-Type" content="text/css">
6<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
7<TITLE>ROM Font - Introduction</TITLE>
8</HEAD>
9<BODY>
10<H1>ROM Font</H1>
11<P><a href="ansi0020.html">ANSI</a> <a href="font0020.html">0020</a> <a href="font8140.html"> 8140</a> <a href="font8340.html"> 8340</a> <a href="font8540.html"> 8540</a> <a href="font8740.html"> 8740</a> <a href="font8940.html"> 8940</a> <a href="font8b40.html"> 8b40</a> <a href="font8d40.html"> 8d40</a> <a href="font8f40.html"> 8f40</a> <a href="font8f40.html"> 9140</a> <a href="font9340.html"> 9340</a> <a href="font9540.html"> 9540</a> <a href="font9740.html"> 9740</a></P>
12
13<H2>Introduction</H2>
14<P>The Wii console comes with European and Kanji ROM fonts that are compatible with the Nintendo GameCube.</P>
15<P>The Western language ROM font is based on the ANSI (Windows Latin 1) character set. The European ROM font can be used with US, European, and other non-Japanese Wii consoles. To see the included character images, click <a href="ansi0020.html">here</a>.</P>
16<P>The Japanese ROM font is based on the Shift-JIS (Japan Industry Standard) character set. The actual character images installed include those for ASCII characters (<CODE>0x20</CODE> - <CODE>0x7f</CODE>), half-width kana characters (<CODE>0xa0</CODE> - <CODE>0xdf</CODE>), and double-byte characters from <CODE>0x8140</CODE> through <CODE>0x9872</CODE>, incorporating the JIS Level 1 Kanji (<CODE>0x889f</CODE> - <CODE>0x9872</CODE>). Kanji ROM fonts can be used on Japanese Wii consoles. Click <A href="font0020.html">here</A> or click the Shift-JIS character hex codes at the top of this page to see the character images that are included.</P>
17
18<P><strong>Note:</strong>The Kanji ROM font does not include JIS level 2 Kanji.</P>
19
20<H2>Using ROM Fonts</H2>
21<P>The ROM font types that can be used on a Wii console can be checked with the <A href="OSGetFontEncode.html"><CODE>OSGetFontEncode</CODE></A> function.</P>
22<P>ROM fonts are compressed and kept in the Wii ROM / RTC. ROM fonts must be expanded in the main memory before use. The fonts can be stored as I2 (4 intensity levels) or I4 (16 intensity levels) format in main memory.</P>
23
24<H3>I2 Format</H3>
25<P>To expand fonts to main memory in I2 format, call the <A href="OSLoadFont.html"><CODE>OSLoadFont</CODE></A> function. Although the <A href="../../gx/Structures/GXTexObj.html"><CODE>GXTexObj</CODE></A> structure does not accept the I2 format as texture image data, the <A href="OSGetFontTexel.html"><CODE>OSGetFontTexel</CODE></A> function can be called to expand specified character font images to any location in a given I4-formatted texture image.</P>
26
27<H3>I4 Format</H3>
28<P>To expand fonts to main memory in I4 format, call the <A href="OSInitFont.html"><CODE>OSInitFont</CODE></A> function. Image data is divided into multiple texture images (sheets) having the same size when expanded. The ANSI font consists of a single texture image sheet. The Kanji font consists of nine texture image sheets. A texture image sheet can be used as-is as the texture image data stored in the structure <A href="../../gx/Structures/GXTexObj.html"><CODE>GXTexObj</CODE></A>. The <a href="OSGetFontTexture.html"><code>OSGetFontTexture</code></a> function returns the pointer to the sheet that includes the specified character and the character position inside the sheet.</P>
29<P><strong>Note:</strong>The buffer addresses passed to the <a href="OSLoadFont.html"><code>OSLoadFont</code></a> and <a href="OSInitFont.html"><code>OSInitFont</code></a> functions must be 32-byte aligned.</P>
30
31<H3>Character width</H3>
32<P>The Wii ROM fonts are variable pitch (proportional) fonts. The width of each font  (in number of texels) can be obtained using the <a href="OSGetFontTexel.html"><code>OSGetFontTexel</code></a>, <a href="OSGetFontTexture.html"><code>OSGetFontTexture</code></a>, or <code><a href="OSGetFontWidth.html">OSGetFontWidth</a></code> function.</P>
33<P><strong>Note:</strong>ASCII text characters in Japanese ROM font are fixed pitch. Please use full-width text characters for proportional pitch font.</P>
34
35<H3><code>OSFontHeader</code> structure</H3>
36<P>Both <a href="OSLoadFont.html"><code>OSLoadFont</code></a> and&nbsp; <a href="OSInitFont.html"><code>OSInitFont</code></a> expand the <code>OSFontHeader</code> structure at the head of the specified font data buffer. Some members of this structure are used only in the OS library, but the following members can be referenced from an application program.</P>
37<TABLE class="arguments" border="1" >
38  <TBODY>
39    <TR>
40<TD bgcolor="#C0C0C0"><STRONG>Members</STRONG></TD>
41<TD bgcolor="#C0C0C0"><STRONG>Description</STRONG></TD>
42<TD bgcolor="#C0C0C0"><STRONG>Value</STRONG></TD>
43    </TR>
44    <TR>
45<TH>ascent</TH>
46<TD>The character ascent (texels above the base line).</TD>
47      <TD><CODE>24</CODE></TD>
48    </TR>
49    <TR>
50<TH>descent</TH>
51<TD>The character descent (texels below the base line).</TD>
52      <TD><CODE>0</CODE></TD>
53    </TR>
54    <TR>
55<TH>leading</TH>
56<TD>The spacing between lines (leading).</TD>
57      <TD><CODE>28</CODE></TD>
58    </TR>
59    <TR>
60<TH>width</TH>
61<TD>The number of texels in the widest text character.</TD>
62      <TD><CODE>24</CODE></TD>
63    </TR>
64    <TR>
65<TH>sheet Width</TH>
66<TD>Width of the texture image sheet.</TD>
67      <TD><CODE>512</CODE></TD>
68    </TR>
69    <TR>
70<TH>sheetHeight</TH>
71<TD>Height of the texture image sheet.</TD>
72      <TD><CODE>512</CODE></TD>
73    </TR>
74    <TR>
75<TH>cellWidth</TH>
76<TD>The cell (a single text character) width within a sheet.</TD>
77      <TD><CODE>24</CODE></TD>
78    </TR>
79    <TR>
80<TH>cellHeight</TH>
81<TD>The cell (a single character) height within a sheet.</TD>
82      <TD><CODE>24</CODE></TD>
83    </TR>
84  </TBODY>
85</TABLE>
86
87<H2>Reference</H2>
88<TABLE class="demo_list" border="1" >
89  <TBODY>
90    <TR>
91<TD bgcolor="#C0C0C0"><STRONG>File</STRONG></TD>
92<TD bgcolor="#C0C0C0"><STRONG>Description</STRONG></TD>
93    </TR>
94    <TR>
95<TH>libraries/demo/src/DEMOPuts.c</TH>
96<TD>Contains implementations of utility functions such as <CODE>DEMOInitROMFont</CODE>, <CODE>DEMOSetROMFontSize</CODE>, and <CODE>DEMORFPrintf</CODE>, which actually display ROM fonts using GX functions.</TD>
97    </TR>
98    <TR>
99<TH>osdemo/src/fontdemo1.c</TH>
100<TD>Illustrates the use of <a href="OSInitFont.html"><code>OSInitFont</code></a> and <a href="OSGetFontTexture.html"><code>OSGetFontTexture</code></a>.</TD>
101    </TR>
102    <TR>
103<TH>osdemo/src/fontdemo2.c</TH>
104<TD>Illustrates the use of the <A href="OSLoadFont.html"><CODE>OSLoadFont</CODE></A> and <A href="OSGetFontTexel.html"><CODE>OSGetFontTexel</CODE></A> functions.</TD>
105    </TR>
106  </TBODY>
107</TABLE>
108
109<H2>Revision History</H2>
110<P>
1112006/03/01 Initial version.
112</P>
113
114<hr><p>CONFIDENTIAL</p></body>
115</HTML>