AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
=>     R0 =     font handle
     R1 =     pointer to buffer for bounding box array, or 0 to read size
     R2 =     pointer to buffer for x width data, or 0 to read size
     R3 =     pointer to buffer for y width data, or 0 to read size
     R4 =     pointer to buffer for misc data, or 0 to read size
     R5 =     pointer to buffer for kerning data, or 0 to read size
     R6 =     pointer to buffer for new style kerning data, or 0 to read size (3.41+)
     R7 =     0

<=     R0 =     file flags
     R1 =     size of bounding box data, or 0 if not in file
     R2 =     size of x width data, or 0 if not in file
     R3 =     size of y width data, or 0 if not in file
     R4 =     size of misc data, or 0 if not in file
     R5 =     size of kerning data, or 0 if not in file
     R6 =     size of new style kerning data, or 0 if not in file
     R7 =     possibly corrupted

This SWI reads information in the font's IntMetrics file. Currently it is not permitted on fonts which have had a transformation matrix applied. All values are signed millipoints, unless specifically stated.

Width data is an array of 256 words, bounding box data an array of 256 * 4 words (x0, y0, x1, y1). This data is only returned for the first 256 characters of the font.

This call is of doubtful use for fonts with up to 2 billion characters, so you should use Font_CharBBox or Font_ScanString instead of using R1 to R3 in this call.

See PRM 3, page 477.
File flags
1     kern pairs don't have x offsets
2     kern pairs don't have y offsets
3     >255 kern pairs present
0,4-31     undefined (reserved)
Miscelaneous IntMetrics data
Offset     Value

Maximum bounding box
0     x0
2     y0
4     x1
6     y1

8     default x offset
10     default y offset
12     italic h-offset per em (-1000 * TAN (italic angle))
14     underline position (1/256 em)
15     underline thickness (1/256 em, unsigned)
16     cap height
18     X height
20     descender
22     ascender
24     0 (reserved)
Kerning data
Kerning information is found by hash table lookup, using the function
hash table index = (first letter) EOR (second letter ROR 4)
The second letter can be calculated by
second letter = (first letter EOR hash table index) ROR 4
where both rotates are perfomed 8 bits only.

Data is stored as :

Size     Value

256 * 4     hash table of offsets to first kern pair with this hash value
4     offset of end of all pairs
4     flags - meaning when bits set:
     0     no bounding boxes
     1     no x offsets
     2     no y offsets
     31     'short' kern pairs
     3-30     undefined (reserved)
?     kern pair data (stored consecutively, in hash function order)

Kern pair data is stored as :

Size     Value

4     first letter of kern pair
4     x offset (if flag bit 1 clear)
4     y offset (if flag bit 2 clear)

If bit 31 of the flags is set, the kern data is compressed by combining the first two (or only two) words:

bits 0-7     first letter of kern pair
bits 8-31     x or y offset
New kerning data
Kerning information is found by hash table lookup, using the function
hash table index = (first letter) EOR (second letter ROR 4)
where the rotate happens in 8 bits.

Data is stored as :

Size     Value

256 * 4     hash table of offsets to first kern pair with this hash value
4     offset of end of all pairs
4     flags - meaning when bits set:
     1     no x offsets
     2     no y offsets
     31     'short' kern pairs
     3-30     undefined (reserved)
?     kern pair data (stored consecutively, in hash function order)

Each kern pair consists of the internal code of the first letter of the kern pair, followed by the internal code of the second letter of the kern pair, followed by the x offset in 1/1000 em, followed by the y offset in 1/1000 em.

Note that unlike the rest of the values returned by this call, the kerning information is unscaled, and character codes are internal codes. You can use Font_EnumerateCharacters to map external codes to internal codes.

If bit 31 of the flags is clear, the kern data is stored as :

Word     Bits     Value

0     0-15     /internal/ code of first letter of kern pair
0     16-31     /internal/ code of second letter of kern pair
1     0-15     x offset
1     16-31     y offset

If bit 31 of the flag word is set, then each kern pair is held in 1 word. This can only happen if all kern pairs apply only to the first 256 characters, and kerning is only in one direction:

bits 0-7     first character code
bits 8-15     second character code
bits 16-31     x or y offset

[sh-index] Back to list of manuals