FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / manual / advanced_topics / main.tex
blobf95692267bffba76261b8fa2d3a339b2bfcd5946
1 % $Id$ %
2 \chapter{Advanced Topics}
4 \section{\label{ref:CustomisingUI}Customising the User Interface}
5 \opt{lcd_bitmap}{
6 \subsection{\label{ref:GettingExtras}Getting Extras}
8 Rockbox supports custom fonts. A collection of fonts is available for download
9 in the font package at \url{http://www.rockbox.org/daily.shtml}.}
11 \opt{lcd_bitmap}{
12 \subsection{\label{ref:Loadingfonts}Loading Fonts}\index{Fonts}
13 Rockbox can load fonts dynamically. Simply copy the \fname{.fnt} file to the
14 \dap{} and ``play'' it in the \setting{File Browser}. If you want a font to
15 be loaded automatically every time you start up, it must be located in the
16 \fname{/.rockbox/fonts} directory and the filename must be at most 24 characters
17 long. You can browse the fonts in \fname{/.rockbox/fonts} under
18 \setting{Settings $\rightarrow$ Theme Settings $\rightarrow$ Font}
19 in the \setting{Main Menu}.\\
21 \note{Advanced Users Only: Any BDF font file up to 16 pixels high should
22 be usable with Rockbox. To convert from \fname{.bdf} to \fname{.fnt}, use
23 the \fname{convbdf} tool. This tool can be found in the \fname{tools}
24 directory of the Rockbox source code.}
27 \subsection{\label{ref:Loadinglanguages}Loading Languages}
28 \index{Language files}%
29 Rockbox can load language files at runtime. Simply copy the \fname{.lng} file
30 \emph{(do not use the .lang file)} to the \dap\ and ``play'' it in the
31 Rockbox directory browser or select \setting{Settings $\rightarrow$
32 General Settings $\rightarrow$ Language }from the \setting{Main Menu}.\\
34 \note{If you want a language to be loaded automatically every time you start
35 up, it must be located in the \fname{/.rockbox/langs} directory and the filename
36 must be a maximum of 24 characters long.\\}
38 If your language is not yet supported and you want to write your own language
39 file find the instructions on the Rockbox website:
40 \wikilink{LangFiles}
42 \opt{lcd_color}{
43 \subsection{\label{ref:ChangingFiletypeColours}Changing Filetype Colours}
44 Rockbox has the capability to modify the \setting{File Browser} to show
45 files of different types in different colours, depending on the file extension.
47 \subsubsection{Set-up}
48 There are two steps to changing the filetype colours -- creating
49 a file with the extension \fname{.colours} and then activating it using
50 a config file. The \fname{.colours} files \emph{must} be stored in
51 the \fname{/.rockbox/themes/} directory.
52 The \fname{.colours} file is just a text file, and can be edited with
53 your text editor of choice.
55 \subsubsection{Creating the .colours file}
56 The \fname{.colours} file consists of the file extension
57 (or \fname{folder}) followed by a colon and then the colour desired
58 as an RGB value in hexadecimal, as in the following example:\\*
60 \config{folder:808080}\\
61 \config{mp3:00FF00}\\
62 \config{ogg:00FF00}\\
63 \config{txt:FF0000}\\
64 \config{???:FFFFFF}\\*
66 The permissible extensions are as follows:\\*
67 \\
68 \config{folder, m3u, m3u8, cfg, wps, lng, rock, bmark, cue, colours, mpa,
69 \firmwareextension{}, %
70 \opt{swcodec}{mp1, }mp2, mp3%
71 \opt{swcodec}{, ogg, oga, wma, wmv, asf, wav, flac, ac3, a52, mpc,
72 wv, m4a, m4b, mp4, mod, shn, aif, aiff, spx, sid, adx, nsf, nsfe,
73 spc, ape, mac, sap}%
74 \opt{lcd_bitmap}{\opt{swcodec}{, mpg, mpeg}}%
75 \opt{HAVE_REMOTE_LCD}{, rwps}%
76 \opt{lcd_non-mono}{, bmp}%
77 \opt{radio}{, fmr}%
78 \opt{lcd_bitmap}{, fnt, kbd}}\\*
79 %It'd be ideal to get these from filetypes.c
81 All file extensions that are not either specifically listed in the
82 \fname{.colours} files or are not in the list above will be
83 set to the colour given by \config{???}. Extensions that
84 are in the above list but not in the \fname{.colours}
85 file will be set to the foreground colour as normal.
87 \subsubsection{Activating}
88 To activate the filetype colours, the \fname{.colours} file needs to be
89 invoked from a \fname{.cfg} configuration file. The easiest way to do
90 this is to create a new text file containing the following single
91 line:\\*
93 \config{filetype colours: /.rockbox/themes/filename.colours}\\*
95 where filename is replaced by the filename you used when creating the
96 \fname{.colours} file. Save this file as e.g. \fname{colours.cfg} in the
97 \fname{/.rockbox/themes} directory and then activate the config file
98 from the menu as normal
99 (\setting{Settings} $\rightarrow$ \setting{Theme Settings}%
100 $\rightarrow$ \setting{Browse Theme Files}).
102 \subsubsection{Editing}
103 The built-in \setting{Text Editor} (see \reference{sec:text_editor})
104 automatically understands the
105 \fname{.colours} file format, but an external text editor can
106 also be used. To edit the \fname{.colours} file using Rockbox,
107 ``play'' it in the \setting{File Browser}. The file will open in
108 the \setting{Text Editor}. Upon selecting a line, the following choices
109 will appear:\\*
111 \config{Extension}\\
112 \config{Colour}\\*
114 If \config{Extension} is selected, the \setting{virtual keyboard}
115 (see \reference{sec:virtual_keyboard}) appears,
116 allowing the file extension to be modified. If \config{Colour}
117 is selected, the colour selector screen appears. Choose the desired
118 colour, then save the \fname{.colours} file using the standard
119 \setting{Text Editor} controls.
122 \opt{lcd_non-mono}{%
123 \subsection{\label{ref:LoadingBackdrops}Loading Backdrops}
124 Rockbox supports showing an image as a backdrop in the \setting{File Browser}
125 and the menus. The backdrop image must be a \fname{.bmp} file of the exact
126 same dimensions as the display in your \dap{} (\genericimg{} with the last
127 number giving the colour depth in bits). To use an image as a backdrop browse
128 to it in the \setting{File Browser} and open the \setting{Context Menu}
129 (see \reference{ref:Contextmenu}) on it and select the option
130 \setting{Set As Backdrop}. If you want rockbox to remember your
131 backdrop the next time you start your \dap{} the backdrop must be placed in
132 the \fname{/.rockbox/backdrops} directory.
135 \section{\label{ref:ConfiguringtheWPS}Configuring the WPS}
137 \subsection{WPS -- General Info}
139 \begin{description}
140 \item[Description: ] The WPS or \setting{While Playing Screen} is the name used
141 to describe the information displayed on the \daps{} screen whilst an audio
142 track is being played. The default WPS is a relatively simple screen
143 displaying Track name, Artist, Album etc. in the default font as a purely
144 text based layout. There are a number of WPS files included in Rockbox, and
145 you can load one of these at any time by selecting it in
146 \setting{Settings $\rightarrow$ Theme Settings $\rightarrow$ While Playing Screen}.
147 \opt{HAVE_REMOTE_LCD}{There is a related option to browse \fname{.rwps}
148 files for \daps{} with LCD remote controls installed. This will load a
149 similar WPS screen for the remote.}
151 \note{``Playing'' a \fname{.wps} from the \setting{File Browser} has the same effect.}
153 \item [File Location: ]Custom WPS files may be located anywhere on the drive.
154 The only restriction is that they must end in \fname{.wps}. When you ``play''
155 a \fname{.wps} file, it will be used for future WPS screens, and if the
156 ``played'' \fname{.wps} file is located in the \fname{/.rockbox/wps} directory, it
157 will be remembered and used after reboot. The name of the \fname{.wps} file must be
158 no more than 24 characters long for it to be remembered.
159 \end{description}
161 \subsection{\label{ref:CreateYourOwnWPS}WPS -- Build Your Own}
162 Quite simply, enter the WPS code in your favourite text editor, Notepad on
163 Windows works fine. When you save it, instead of saving it as a \fname{.txt}
164 file, save it as a \fname{.wps} file. Example: Instead of \fname{Rockbox.txt},
165 save the file as \fname{Rockbox.wps}. To make sure non english characters
166 display correctly in your WPS you must save the .wps file with UTF-8 character
167 encoding. This can be done in most editors, for example Notepad in Windows 2000
168 or XP (but not in 9x/ME) can do this. See appendix \reference{ref:wps_tags} for
169 all the tags that are available.
171 \begin{itemize}
172 \item All characters not preceded by \% are displayed as typed.
173 \item Lines beginning with \# are comments and will be ignored.
174 \item Maximum file size used is
175 \opt{lcd_bitmap}{1600}
176 \opt{player}{400} bytes.
177 If you have a bigger WPS file, only the first part of it will be
178 loaded and used.
179 \end{itemize}
181 \note{Keep in mind that your \dap{} resolution is \genericimg{} (with
182 the last number giving the colour depth in bits) when
183 designing your own WPS, or if you use a WPS designed for another target.
184 \opt{HAVE_REMOTE_LCD}{The resolution of the remote is
185 \opt{h100,h300}{128x64x1}\opt{x5,m5}{128x96x2} pixels.}}
187 \subsubsection{Conditional Tags}
189 \begin{description}
190 \item[If/else: ]
191 Syntax: \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
193 If the tag specified by ``\config{xx}'' has a value, the text between the
194 ``\config{{\textless}}'' and the ``\config{{\textbar}}'' is displayed (the true
195 part), else the text between the ``\config{{\textbar}}'' and the
196 ``\config{{\textgreater}}'' is displayed (the false part).
197 The else part is optional, so the ``\config{{\textbar}}'' does not have to be
198 specified if no else part is desired. The conditionals nest, so the text in the
199 if and else part can contain all \config{\%} commands, including conditionals.
201 \item[Enumerations: ]
202 Syntax: \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
204 For tags with multiple values, like Play status, the conditional can hold a
205 list of alternatives, one for each value the tag can have.
206 Example enumeration:
207 \begin{example}
208 \%?mp{\textless}Stop{\textbar}\%Play{\textbar}Pause{\textbar}Ffwd{\textbar}Rew{\textgreater}
209 \end{example}
211 The last else part is optional, and will be displayed if the tag has no value.
212 The WPS parser will always display the last part if the tag has no value, or if
213 the list of alternatives is too short.
214 \end{description}
216 \subsubsection{Next Song Info}
217 You can display information about the next song -- the song that is
218 about to play after the one currently playing (unless you change the
219 plan).
221 If you use the upper-case versions of the
222 three tags: \config{F}, \config{I} and \config{D}, they will instead refer to
223 the next song instead of the current one. Example: \config{\%Ig} is the genre
224 name used in the next song and \config{\%Ff} is the mp3 frequency.\\
226 \note{The next song information \emph{will not} be available at all
227 times, but will most likely be available at the end of a song. We
228 suggest you use the conditional display tag a lot when displaying
229 information about the next song!}
231 \subsubsection{\label{ref:AlternatingSublines}Alternating Sublines}
233 It is possible to group items on each line into 2 or more groups or
234 ``sublines''. Each subline will be displayed in succession on the line for a
235 specified time, alternating continuously through each defined subline.
237 Items on a line are broken into sublines with the semicolon
238 '\config{;}' character. The display time for
239 each subline defaults to 2 seconds unless modified by using the
240 '\config{\%t}' tag to specify an alternate
241 time (in seconds and optional tenths of a second) for the subline to be
242 displayed.
244 Subline related special characters and tags:
245 \begin{description}
246 \item[;] Split items on a line into separate sublines
247 \item[\%t] Set the subline display time. The
248 '\config{\%t}' is followed by either integer
249 seconds (\config{\%t5}), or seconds and tenths of a second (\config{\%t3.5}).
250 \end{description}
252 Each alternating subline can still be optionally scrolled while it is
253 being displayed, and scrollable formats can be displayed on the same
254 line with non{}-scrollable formats (such as track elapsed time) as long
255 as they are separated into different sublines.
256 Example subline definition:
257 \begin{example}
258 %s%t4%ia;%s%it;%t3%pc %pr : Display id3 artist for 4 seconds,
259 Display id3 title for 2 seconds,
260 Display current and remaining track time
261 for 3 seconds,
262 repeat...
263 \end{example}
265 Conditionals can be used with sublines to display a different set and/or number
266 of sublines on the line depending on the evaluation of the conditional.
267 Example subline with conditionals:
268 \begin{example}
269 %?it{\textless}%t8%s%it{\textbar}%s%fn{\textgreater};%?ia{\textless}%t3%s%ia{\textbar}%t0{\textgreater}\\
270 \end{example}
272 The format above will do two different things depending if ID3 tags are
273 present. If the ID3 artist and title are present:
274 \begin{itemize}
275 \item Display id3 title for 8 seconds,
276 \item Display id3 artist for 3 seconds,
277 \item repeat\dots
278 \end{itemize}
279 If the ID3 artist and title are not present:
280 \begin{itemize}
281 \item Display the filename continuously.
282 \end{itemize}
283 Note that by using a subline display time of 0 in one branch of a conditional,
284 a subline can be skipped (not displayed) when that condition is met.
286 \subsubsection{Using Images}
287 You can have as many as 52 images in your WPS. There are various ways of
288 displaying images:
289 \begin{enumerate}
290 \item Load and always show the image, using the \config{\%x} tag
291 \item Preload the image with \config{\%xl} and show it with \config{\%xd}.
292 This way you can have your images displayed conditionally.
293 \nopt{archos}{%
294 \item Load an image and show as backdrop using the \config{\%X} tag. The
295 image must be of the same exact dimensions as your display.
297 \end{enumerate}
299 \optv{swcodec}{% This doesn't depend on swcodec but we don't have a \noptv
300 % command.
301 Example on background image use:
302 \begin{example}
303 %X|background.bmp|
304 \end{example}
305 The image with filename \fname{background.bmp} is loaded and used in the WPS.
308 Example on bitmap preloading and use:
309 \begin{example}
310 %x|a|static_icon.bmp|50|50|
311 %xl|b|rep\_off.bmp|16|64|
312 %xl|c|rep\_all.bmp|16|64|
313 %xl|d|rep\_one.bmp|16|64|
314 %xl|e|rep\_shuffle.bmp|16|64|
315 %?mm<%xdb|%xdc|%xdd|%xde>
316 \end{example}
317 Four images at the same x and y position are preloaded in the example. Which
318 image to display is determined by the \config{\%mm} tag (the repeat mode).
320 \subsubsection{Example File}
321 \begin{example}
322 %s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]>
323 %pb%pc/%pt
324 \end{example}
325 That is, ``tracknum -- title [artist, album]'', where most fields are only
326 displayed if available. Could also be rendered as ``filename'' or ``tracknum --
327 title [artist]''.
329 %\opt{lcd_bitmap}{
330 % \begin{verbatim}
331 % %s%?it<%?in<%in. |>%it|%fn>
332 % %s%?ia<%ia|%?d2<%d2|(root)>>
333 % %s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>
335 % %al%pc/%pt%ar[%pp:%pe]
336 % %fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>
337 % %pb
338 % %pm
339 % % \end{verbatim}
342 \section{\label{ref:manage_settings}Managing Rockbox Settings}
344 \subsection{Introduction to \fname{.cfg} Files.}
345 Rockbox allows users to store and load multiple settings through the use of
346 configuration files. A configuration file is simply a text file with the
347 extension \fname{.cfg}.
349 A configuration file may reside anywhere on the disk. Multiple
350 configuration files are permitted. So, for example, you could have
351 a \fname{car.cfg} file for the settings that you use while playing your
352 jukebox in your car, and a \fname{headphones.cfg} file to store the
353 settings that you use while listening to your \dap{} through headphones.
355 See \reference{ref:cfg_specs} below for an explanation of the format
356 for configuration files. See \reference{ref:manage_settings_menu} for an
357 explanation of how to create, edit and load configuration files.
359 \subsection{\label{ref:cfg_specs}Specifications for \fname{.cfg}
360 Files.}
362 The Rockbox configuration file is a plain text file, so once you use the
363 \setting{Save .cfg file} option to create the file, you can edit the file on
364 your computer using any text editor program. See
365 Appendix \reference{ref:config_file_options} for available settings. Configuration
366 files use the following formatting rules: %
368 \begin{enumerate}
369 \item Each setting must be on a separate line.
370 \item Each line has the format ``setting: value''.
371 \item Values must be within the ranges specified in this manual for each
372 setting.
373 \item Lines starting with \# are ignored. This lets you write comments into
374 your configuration files.
375 \end{enumerate}
377 Example of a configuration file:
378 \begin{example}
379 volume: 70
380 bass: 11
381 treble: 12
382 balance: 0
383 time format: 12hour
384 volume display: numeric
385 show files: supported
386 wps: /.rockbox/car.wps
387 lang: /.rockbox/afrikaans.lng
388 \end{example}
390 \note{As you can see from the example, configuration files do not need to
391 contain all of the Rockbox options. You can create configuration files
392 that change only certain settings. So, for example, supppose you
393 typically use the \dap{} at one volume in the car, and another when using
394 headphones. Further, suppose you like to use an inverse LCD when you are
395 in the car, and a regular LCD setting when you are using headphones. You
396 could create configuration files that control only the volume and LCD
397 settings. Create a few different files with different settings, give
398 each file a different name (such as \fname{car.cfg},
399 \fname{headphones.cfg}, etc.), and you can then use the \setting{Browse .cfg
400 files} option to quickly change settings.\\}
402 A special case configuration file can be used to force a particular setting
403 or settings every time Rockbox starts up (e.g. to set the volume to a safe
404 level). Format a new configuration file as above with the required setting(s)
405 and save it into the \fname{/.rockbox} directory with the filename
406 \fname{fixed.cfg}.
408 \subsection{\label{ref:manage_settings_menu}The \setting{Manage Settings}
409 menu} The \setting{Manage Settings} menu can be found in the \setting{Main
410 Menu}. The \setting{Manage Settings} menu allows you to save and load
411 \fname{.cfg} files.
413 \begin{description}
415 \item [Browse .cfg Files]Opens the \setting{File Browser} in the
416 \fname{/.rockbox} directory and displays all \fname{.cfg} (configuration)
417 files. Selecting a \fname{.cfg} file will cause Rockbox to load the settings
418 contained in that file. Pressing \ButtonLeft{} will exit back to the
419 \setting{Manage Settings} menu. See the \setting{Write .cfg files} option on
420 the \setting{Manage Settings} menu for details of how to save and edit a
421 configuration file.
423 \item [Reset Settings]This wipes the saved settings
424 in the \dap{} and resets all settings to their default values.
426 \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD,SANSA_C200_PAD}{
427 \note{You can also reset all settings to their default
428 values by turning off the \dap, turning it back on, and holding the
429 \ButtonRec{} button immediately after the \dap{} turns on.}
431 \opt{IRIVER_H10_PAD}{\note{You can also reset all settings to
432 their default values by turning off the \dap, and turning it back on
433 with the \ButtonHold{} button on.}
435 \opt{IPOD_4G_PAD}{\note{You can also reset all settings to their default
436 values by turning off the \dap, turning it back on, and activating the
437 \ButtonHold{} button immediately after the backlight comes on.}
439 \opt{GIGABEAT_PAD}{\note{You can also reset all settings to their default
440 values by turning off the \dap, turning it back on and pressing the
441 \ButtonA{} button immediately after the \dap{} turns on.}
444 \item [Save .cfg File]This option writes a \fname{.cfg} file to
445 your \daps{} disk. The configuration file has the \fname{.cfg}
446 extension and is used to store all of the user settings that are described
447 throughout this manual.
449 Hint: Use the \setting{Save .cfg File} feature (\setting{Main Menu
450 $\rightarrow$ Manage Settings}) to save the current settings, then
451 use a text editor to customize the settings file. See Appendix
452 \reference{ref:config_file_options} for the full reference of available
453 options.
455 \item [Save Sound Settings]This option writes a \fname{.cfg} file to
456 your \daps{} disk. The configuration file has the \fname{.cfg}
457 extension and is used to store all of the sound related settings.
459 \item [Save Theme Settings]This option writes a \fname{.cfg} file to
460 your \daps{} disk. The configuration file has the \fname{.cfg}
461 extension and is used to store all of the theme related settings.
463 \end{description}
465 \section{\label{ref:FirmwareLoading}Firmware Loading}
466 \opt{player,recorder,recorderv2fm,ondio}{
467 When your \dap{} powers on, it loads the Archos firmware in ROM, which
468 automatically checks your \daps{} root directory for a file named
469 \firmwarefilename. Note that Archos firmware can only read the first
470 ten characters of each filename in this process, so do not rename your old
471 firmware files with names like \firmwarefilename.\fname{old} and so on,
472 because it is possible that the \dap{} will load a file other than the one
473 you intended.
476 \subsection{\label{ref:using_rolo}Using ROLO (Rockbox Loader)}
477 Rockbox is able to load and start another firmware file without rebooting.
478 You just ``play'' a file with the extension %
479 \opt{recorder,recorderv2fm,ondio}{\fname{.ajz}.} %
480 \opt{player}{\fname{.mod}.} %
481 \opt{h100,h300}{\fname{.iriver}.} %
482 \opt{ipod}{\fname{.ipod}.} %
483 \opt{iaudio}{\fname{.iaudio}.} %
484 \opt{sansa,h10,h10_5gb}{\fname{.mi4}.} %
485 \opt{sansaAMS}{\fname{.sansa}.} %
486 \opt{gigabeatf,gigabeats}{\fname{.gigabeat}.} %
487 This can be used to test new firmware versions without deleting your
488 current version.
490 \opt{archos}{\input{advanced_topics/archos-flashing.tex}}