question: public static void addFont ( String fontKey , Font font ) { if ( fontKey != null ) { fontKey = fontKey . toLowerCase ( ) ; } else { if ( font . getCharset ( ) != null ) { throw new IllegalArgumentException ( "Font key must be non-null for bitmap fonts" ) ; } } fonts . put ( fontKey , new HTMLFont ( fontKey , font ) ) ; }
target:  Sets the given Codename One font for use with HTMLComponents. The font key can contain information about the following attributes: * The font family - i.e. Arial, Times New Roman etc. * The font size - in pixels (i.e. 12, 14 etc.) * The font style - bold, italic or both (no need to specify plain) * The font tag assignments - if this font should be used for any HTML specific tags they should be specified - i.e. h1, kbd etc. The key is just a concatenation of all attributes seperated with a dot. Examples for valid keys: arial.12 - Describes a plain font from the arial family in size 12 arial.16.bold - A bold arial font in size 16 courier.italic.bold.20 - A bold and italic courier font in size 20 arial.20.h1 - A plain arial font, size 20, that should be used for contents of the H1 tag code.kbd.samp - A font that should be used for the CODE, KBD and SAMP tags Note that the order of the attributes is not important and also that the case is ignored. This means that arial.12.bold.italic.h3 is equivalent to itALIc.H3.arial.BOLD.12 Also note that while you do not have to provide all the info for the font, but the info helps the rendering engine to reuse fonts when suitable. For example, if you have a 16px arial bold font which you want to use for H2, you can simply add it as "h2", but if you add it as "arial.16.bold.h2" then if the current font is arial.16 and the renderer encounters a B tag, it will know it can use the font you added as the bold counterpart of the current font. When adding system fonts there is no need to describe the font, the usage of setFont with system fonts is usually just to assign them for tags. The rendering engine knows to derive bold/italic/bigger/smaller fonts from other system fonts (default or tag fonts) even if not added.