FontMap module

Introduction

The FontMap module provides a means by which font names can be translated between different formats. Primarily this is used by the DrawFile SVG conversion code but may be used by other clients as necessary.

Technical Details

Font details

In order to perform the translations between different schemes the module uses a number of features of the fonts to determine compatibility together with a mapping file provided by the user. Because the mapping between font types is expected to be inexact the closest suitable matches will be returned wherever possible.

There are four major features which are used to determine the fonts. The most obvious of these is the name. The name can be used to provide information about other features of the font, for example through the use of 'Italic' or 'Bold' as part of the name.

The other three features are the use of 'italic', the 'weight' of the font, and its 'stretch'.

The FontMap module does not attempt to match specialist or symbolic fonts. Other, more complex, schemes such as Panose may provide more accurate font matching than the FontMap module provides. In the absence of Panose categorisations of RISC OS fonts the FontMap provides a simplified, yet functional, mapping system.

SWI Calls

FontMap_TranslateSWI &57F00
Translate a font name between formats
R0=Flags:
Bit(s)Meaning
0-2Source font format:
ValueMeaning
0RISC OS font name
1Windows font name
3Reserved for future expansion of source format
4-6Destination font format (values as for the source font format)
7Reserved for future expansion of destination format
8-31Reserved for future expansion
R1=Pointer to source font name
R2=Italic type:
ValueMeaning
0Unspecified
1No italic
2Italic, or oblique
R3=Weight type:
ValueMeaning
0Unspecified
100Thin
200Extra-light
300Light
400Regular
500Medium
600Semi-bold
700Bold
800Extra-bold
900Black
R4=Stretch type:
ValueMeaning
0Unspecified
100Ultra-condensed
200Extra-condensed
300Condensed
400Semi-condensed
500Normal
600Semi-expanded
700Expanded
800Extra-expanded
900Ultra-expanded
R5=Pointer to destination buffer to fill in, or 0 to request length required
R6=Size of destination buffer
R2=Italic type of destination (see values above)
R3=Weight type of destination (see values above)
R4=Stretch type of destination (see values above)
R6=Length of name, or buffer required
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI is used to translate between different font types. In addition, it may be used to apply features to RISC OS fonts by specifying 'RISC OS' as the source and destination and selecting the relevant features in the input feature fields (R2-R4). Similarly, by specifying 'unspecified' values within the RISC OS fields, the features of the font are given by the returned registers (R2-R4 on exit).