Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
manual:chapter3:fonts [2019/11/22 01:19] jojo1973 |
manual:chapter3:fonts [2019/11/25 03:17] (current) jojo1973 [Fonts] |
**newRPL** fully supports font customization: each part of the [[manual:chapter2:interface#the-display-interface|display interface]] uses its own font, as well as selected environments such as the command line or the forms engine. | **newRPL** fully supports font customization: each part of the [[manual:chapter2:interface#the-display-interface|display interface]] uses its own font, as well as selected environments such as the command line or the forms engine. |
| |
Since text support in **newRPL** is based on [[http://home.unicode.org|Unicode 10.0]], fonts support up to 65536 different glyphs and represent up to 1048576 different code points. Fonts can be of any size and be fixed-width or proportional. | Since text support in **newRPL** is based on [[http://home.unicode.org|Unicode 10.0]], fonts support up to 65536 different glyphs and represent up to 1048576 different code points. Fonts can be any size and be fixed-width or proportional. |
| |
A font object is represented on the stack as ''FONTDATA xx yyy...'', where ''yyy...'' is a string of characters (''A''-''Z'', ''a''-''z'', ''$'' and ''#'') encoding the glyphs and the translation table that associates glyphs to Unicode code points while ''xx'' is the length (padded to a multiple of 4 bytes) of the aforementioned block, expressed in nibbles. | A font object is represented on the stack as ''FONTDATA xx yyy...'', where ''yyy...'' is a string of characters (''A''-''Z'', ''a''-''z'', ''$'' and ''#'') encoding the glyphs and the translation table that associates glyphs to Unicode code points while ''xx'' is the length (padded to a multiple of 4 bytes) of the aforementioned block, expressed in nibbles. |
| |
To install a font on the system it must be stored into a variable, whose name will become the name of the font. The command ''[[manual:chapter6:fonts:cmd_fntsto|FNTSTO]]'' is used to finalize the installation of the font. A font object can be recalled by the ''[[manual:chapter6:fonts:cmd_fntrcl|FNTRCL]]'' command and uninstalled by the ''[[manual:chapter6:fonts:cmd_fntpg|FNTPG]]'' command. | The installation of a font on the system is performed by storing the font object into a special variable, whose name will become the name of the font. The command ''[[manual:chapter6:fonts:cmd_fntsto|FNTSTO]]'' executes this operation. A font object can be recalled to the stack by the ''[[manual:chapter6:fonts:cmd_fntrcl|FNTRCL]]'' command and uninstalled using the ''[[manual:chapter6:fonts:cmd_fntpg|FNTPG]]'' command. |
| |
**newRPL** already provides 11 system fonts which are always available and can't be uninstalled. Smaller sizes are suited for soft keys, while larger sizes are preferable for stack display; however nothing prevents using large sizes for soft keys and small sizes for stack display. | **newRPL** already provides 11 system fonts which are always available and can't be uninstalled. Smaller sizes are suited for soft keys, while larger sizes are preferable for stack display; however nothing prevents using large sizes for soft keys and small sizes for stack display. |
{{page>manual:chapter6:fonts&nofooter&noeditbtn&inline}} | {{page>manual:chapter6:fonts&nofooter&noeditbtn&inline}} |
| |
==== Building user-defined fonts ==== | |
| |
To build a custom font is not difficult at all. Necessary tools are: | |
| |
- a graphic editor capable of saving images in .bmp format (monochrome or 256-color) to draw the glyphs; | |
- a text file providing the association between the glyphs and Unicode code points; | |
- the ''bmp2font'' tool, whose source code is avilable in ''newrpl/tools/fonts/bmp2font/''. Instructions about how to compile an executable are [[manual:chapter1:buildfromsource#bmp2font|here]]. | |
| |
FIXME | |