TeX in C
Explore TeX with modern c compiler.
PART 30: Font metric data

宏定义

#define opbyte(x)   (x.b2)
 [p199#545] 更多...
 
#define rembyte(x)   (x.b3)
 
#define stopflag   qi(128)
 [p199#545] value indicating ‘.{STOP}’ in a lig/kern program. 更多...
 
#define kernflag   qi(128)
 [p199#545] op code for a kern step. 更多...
 
#define skipbyte(x)   x.b0
 
#define nextchar(x)   x.b1
 
#define charexists(x)   ((x).b0>MIN_QUARTER_WORD)
 [p203#554] 更多...
 
#define chartag(x)   ((qo((x).b2)) % 4)
 
#define heightdepth(x)   qo(x.b1)
 [p203#554] 更多...
 
#define ligkernstart(x, y)   (ligkernbase[(x)] + rembyte(y))
 [p204#557] beginning of lig/kern program 更多...
 
#define ligkernrestart(x, y)    (ligkernbase[(x)] + opbyte(y) * 256 + rembyte(y) - kernbaseoffset + 32768L)
 [p204#557] 更多...
 
#define NON_CHAR   256
 [#549] a |halfword| code that can't match a real character} 更多...
 
#define nonaddress   0
 [p201#549] a spurious bchar label 更多...
 
#define kernbaseoffset   32768
 [p204#557] 更多...
 
#define param(x, y)   (fontinfo[(x) + parambase[y]].sc)
 [p204#558] 更多...
 
#define slant(x)   param(SLANT_CODE,x) /* slant to the right, per unit distance upward}*/
 
#define space(x)   param(SPACE_CODE,x) /* NORMAL space between words}*/
 
#define spacestretch(x)   param(SPACE_STRETCH_CODE,x) /* stretch between words}*/
 
#define spaceshrink(x)   param(SPACE_SHRINK_CODE,x) /* shrink between words}*/
 
#define xheight(x)   param(X_HEIGHT_CODE,x) /* one ex}*/
 
#define quad(x)   param(QUAD_CODE,x) /* one em}*/
 
#define extraspace(x)   param(EXTRA_SPACE_CODE,x) /* additional space at end of sentence}*/
 
#define badtfm   11
 [p205#560] 更多...
 
#define exttop(x)   x.b0 /* |top| piece in a recipe */
 [p199#564] 更多...
 
#define extmid(x)   x.b1 /* |mid| piece in a recipe */
 
#define extbot(x)   x.b2 /* |bot| piece in a recipe */
 
#define extrep(x)   x.b3 /* |rep| piece in a recipe */
 

类型定义

typedef UChar InternalFontNumber
 [#548]: [FONT_BASE, FONT_MAX] = [0, 75] 更多...
 

枚举

enum  CharTag { NO_TAG , LIG_TAG , LIST_TAG , EXT_TAG }
 [p198#544]: tag field in a char_info_word that explain how to interpret the remainder field. 更多...
 
enum  TFMParamVal {
  TFM_PARAM_MISSING , SLANT_CODE , SPACE_CODE , SPACE_STRETCH_CODE ,
  SPACE_SHRINK_CODE , X_HEIGHT_CODE , QUAD_CODE , EXTRA_SPACE_CODE
}
 [p200#547] 更多...
 

函数

Integer get_skewchar (InternalFontNumber x)
 
void set_skewchar (InternalFontNumber x, Integer c)
 
Integer get_hyphenchar (InternalFontNumber x)
 
void set_hyphenchar (InternalFontNumber x, Integer c)
 
Scaled get_fontsize (InternalFontNumber x)
 
Scaled get_fontdsize (InternalFontNumber x)
 
StrNumber get_fontname (InternalFontNumber x)
 
FourQuarters get_fontcheck (InternalFontNumber x)
 
FourQuarters charinfo (InternalFontNumber f, EightBits p)
 
Scaled charwidth (InternalFontNumber x, FourQuarters y)
 
Scaled charitalic (InternalFontNumber x, FourQuarters y)
 
Scaled charheight (InternalFontNumber x, Integer y)
 
Scaled chardepth (InternalFontNumber x, Integer y)
 
Scaled charkern (InternalFontNumber x, FourQuarters y)
 
void font_init ()
 [#551, #556] 更多...
 
void fonts_init_once (void)
 [#552] TeX always knows at least one font, namely the null font. 更多...
 
void fonts_dump ()
 [#1320] Dump the font information. 更多...
 
int fonts_undump ()
 [#1321] Undump the font information. 更多...
 
InternalFontNumber readfontinfo (Pointer u, StrNumber nom, StrNumber aire, Scaled s)
 [p205#560]: input a TFM file. 更多...
 
void scanfontident (void)
 [#577] Declare procedures that scan font-related stuff. 更多...
 
void findfontdimen (Boolean writing)
 [#578] sets cur_val to font_info location. 更多...
 
void charwarning (InternalFontNumber f, EightBits c)
 [#581] 更多...
 
HalfWord newcharacter (InternalFontNumber f, EightBits c)
 [#582] 更多...
 

变量

MemoryWord fontinfo [FONT_MEM_SIZE+1]
 the big collection of font data 更多...
 
FontIndex fmemptr
 first unused word of font info 更多...
 
InternalFontNumber fontptr
 largest internal font number in use 更多...
 
Static FourQuarters fontcheck [FONT_MAX+1]
 check sum 更多...
 
Static Scaled fontsize [FONT_MAX+1]
 "at" size 更多...
 
Static Scaled fontdsize [FONT_MAX+1]
 "design" size 更多...
 
FontIndex fontparams [FONT_MAX+1]
 how many font parameters are present 更多...
 
Static StrNumber fontname [FONT_MAX+1]
 name of the font 更多...
 
Static StrNumber fontarea [FONT_MAX+1]
 area of the font 更多...
 
EightBits fontbc [FONT_MAX+1]
 beginning (smallest) character code 更多...
 
EightBits fontec [FONT_MAX+1]
 ending (largest) character code. 更多...
 
Pointer fontglue [FONT_MAX+1]
 glue specification for interword space, null if not allocated. 更多...
 
Boolean fontused [FONT_MAX+1]
 has a character from this font actually appeared in the output? 更多...
 
Static Integer hyphenchar [FONT_MAX+1]
 current \hyphenchar values 更多...
 
Static Integer skewchar [FONT_MAX+1]
 current \skewchar values. 更多...
 
FontIndex bcharlabel [FONT_MAX+1]
 start of lig kern program for left boundary character, non address if there is none. 更多...
 
Integer fontbchar [FONT_MAX+1]
 right boundary character, non char if there is none. 更多...
 
Integer fontfalsebchar [FONT_MAX+1]
 font bchar if it doesn’t exist in the font, otherwise non char. 更多...
 
Static Integer charbase [FONT_MAX+1]
 base addresses for char info. 更多...
 
Static Integer widthbase [FONT_MAX+1]
 base addresses for widths. 更多...
 
Static Integer heightbase [FONT_MAX+1]
 base addresses for heights. 更多...
 
Static Integer depthbase [FONT_MAX+1]
 base addresses for depths. 更多...
 
Static Integer italicbase [FONT_MAX+1]
 base addresses for italic corrections. 更多...
 
Integer ligkernbase [FONT_MAX+1]
 base addresses for ligature/kerning programs. 更多...
 
Static Integer kernbase [FONT_MAX+1]
 base addresses for kerns. 更多...
 
Integer extenbase [FONT_MAX+1]
 base addresses for extensible recipes. 更多...
 
Integer parambase [FONT_MAX+1]
 base addresses for font parameters. 更多...
 
FourQuarters nullcharacter
 

详细描述

宏定义说明

◆ badtfm

#define badtfm   11

[p205#560]

◆ charexists

#define charexists (   x)    ((x).b0>MIN_QUARTER_WORD)

[p203#554]

◆ chartag

#define chartag (   x)    ((qo((x).b2)) % 4)

◆ extbot

#define extbot (   x)    x.b2 /* |bot| piece in a recipe */

◆ extmid

#define extmid (   x)    x.b1 /* |mid| piece in a recipe */

◆ extraspace

#define extraspace (   x)    param(EXTRA_SPACE_CODE,x) /* additional space at end of sentence}*/

◆ extrep

#define extrep (   x)    x.b3 /* |rep| piece in a recipe */

◆ exttop

#define exttop (   x)    x.b0 /* |top| piece in a recipe */

[p199#564]

◆ heightdepth

#define heightdepth (   x)    qo(x.b1)

[p203#554]

◆ kernbaseoffset

#define kernbaseoffset   32768

[p204#557]

◆ kernflag

#define kernflag   qi(128)

[p199#545] op code for a kern step.

◆ ligkernrestart

#define ligkernrestart (   x,
 
)     (ligkernbase[(x)] + opbyte(y) * 256 + rembyte(y) - kernbaseoffset + 32768L)

[p204#557]

◆ ligkernstart

#define ligkernstart (   x,
 
)    (ligkernbase[(x)] + rembyte(y))

[p204#557] beginning of lig/kern program

◆ nextchar

#define nextchar (   x)    x.b1

◆ NON_CHAR

#define NON_CHAR   256

[#549] a |halfword| code that can't match a real character}

◆ nonaddress

#define nonaddress   0

[p201#549] a spurious bchar label

◆ opbyte

#define opbyte (   x)    (x.b2)

[p199#545]

◆ param

#define param (   x,
 
)    (fontinfo[(x) + parambase[y]].sc)

[p204#558]

◆ quad

#define quad (   x)    param(QUAD_CODE,x) /* one em}*/

◆ rembyte

#define rembyte (   x)    (x.b3)

◆ skipbyte

#define skipbyte (   x)    x.b0

◆ slant

#define slant (   x)    param(SLANT_CODE,x) /* slant to the right, per unit distance upward}*/

◆ space

#define space (   x)    param(SPACE_CODE,x) /* NORMAL space between words}*/

◆ spaceshrink

#define spaceshrink (   x)    param(SPACE_SHRINK_CODE,x) /* shrink between words}*/

◆ spacestretch

#define spacestretch (   x)    param(SPACE_STRETCH_CODE,x) /* stretch between words}*/

◆ stopflag

#define stopflag   qi(128)

[p199#545] value indicating ‘.{STOP}’ in a lig/kern program.

◆ xheight

#define xheight (   x)    param(X_HEIGHT_CODE,x) /* one ex}*/

类型定义说明

◆ InternalFontNumber

[#548]: [FONT_BASE, FONT_MAX] = [0, 75]

枚举类型说明

◆ CharTag

enum CharTag

[p198#544]: tag field in a char_info_word that explain how to interpret the remainder field.

枚举值
NO_TAG 

vanilla character

LIG_TAG 

character has a ligature/kerning program

LIST_TAG 

character has a successor in a charlist

EXT_TAG 

character is extensible

◆ TFMParamVal

[p200#547]

枚举值
TFM_PARAM_MISSING 

TeX sets the missing parameters to zero

SLANT_CODE 
SPACE_CODE 
SPACE_STRETCH_CODE 
SPACE_SHRINK_CODE 
X_HEIGHT_CODE 
QUAD_CODE 
EXTRA_SPACE_CODE 

函数说明

◆ chardepth()

Scaled chardepth ( InternalFontNumber  x,
Integer  y 
)

◆ charheight()

Scaled charheight ( InternalFontNumber  x,
Integer  y 
)

◆ charinfo()

FourQuarters charinfo ( InternalFontNumber  f,
EightBits  p 
)

◆ charitalic()

Scaled charitalic ( InternalFontNumber  x,
FourQuarters  y 
)

◆ charkern()

Scaled charkern ( InternalFontNumber  x,
FourQuarters  y 
)

◆ charwarning()

void charwarning ( InternalFontNumber  f,
EightBits  c 
)

[#581]

◆ charwidth()

Scaled charwidth ( InternalFontNumber  x,
FourQuarters  y 
)

◆ findfontdimen()

void findfontdimen ( Boolean  writing)

[#578] sets cur_val to font_info location.

implement \\fontdimen n f. The boolean parameter writing is set true if the calling program intends to change the parameter value.

◆ font_init()

void font_init ( )

[#551, #556]

[#551]

[#556]

◆ fonts_dump()

void fonts_dump ( )

[#1320] Dump the font information.

[#1322] Dump the array info for internal font number k.

◆ fonts_init_once()

void fonts_init_once ( void  )

[#552] TeX always knows at least one font, namely the null font.

It has no characters, and its seven parameters are all equal to zero.

◆ fonts_undump()

int fonts_undump ( )

[#1321] Undump the font information.

undump fontinfo[]

[#1323] Undump the array info for internal font number k.

◆ get_fontcheck()

FourQuarters get_fontcheck ( InternalFontNumber  x)

◆ get_fontdsize()

Scaled get_fontdsize ( InternalFontNumber  x)

◆ get_fontname()

StrNumber get_fontname ( InternalFontNumber  x)

◆ get_fontsize()

Scaled get_fontsize ( InternalFontNumber  x)

◆ get_hyphenchar()

Integer get_hyphenchar ( InternalFontNumber  x)

◆ get_skewchar()

Integer get_skewchar ( InternalFontNumber  x)

◆ newcharacter()

HalfWord newcharacter ( InternalFontNumber  f,
EightBits  c 
)

[#582]

◆ readfontinfo()

InternalFontNumber readfontinfo ( Pointer  u,
StrNumber  nom,
StrNumber  aire,
Scaled  s 
)

[p205#560]: input a TFM file.

< index into font info

< was tfm file successfully opened?

#563: Open tfm file for input

#566: Use size fields to allocate font information.

#568: Read the TFM header

#569: Read character data

#571: Read box dimensions #572: Replace z by z 0 and compute α,β

#573: Read ligature/kern program

#574: Read extensible character recipes

#575: Read font parameters

◆ scanfontident()

void scanfontident ( void  )

[#577] Declare procedures that scan font-related stuff.

◆ set_hyphenchar()

void set_hyphenchar ( InternalFontNumber  x,
Integer  c 
)

◆ set_skewchar()

void set_skewchar ( InternalFontNumber  x,
Integer  c 
)

变量说明

◆ bcharlabel

FontIndex bcharlabel[FONT_MAX+1]

start of lig kern program for left boundary character, non address if there is none.

◆ charbase

Static Integer charbase[FONT_MAX+1]

base addresses for char info.

◆ depthbase

Static Integer depthbase[FONT_MAX+1]

base addresses for depths.

◆ extenbase

Integer extenbase[FONT_MAX+1]

base addresses for extensible recipes.

◆ fmemptr

FontIndex fmemptr

first unused word of font info

◆ fontarea

Static StrNumber fontarea[FONT_MAX+1]

area of the font

◆ fontbc

EightBits fontbc[FONT_MAX+1]

beginning (smallest) character code

◆ fontbchar

Integer fontbchar[FONT_MAX+1]

right boundary character, non char if there is none.

◆ fontcheck

check sum

◆ fontdsize

Static Scaled fontdsize[FONT_MAX+1]

"design" size

◆ fontec

EightBits fontec[FONT_MAX+1]

ending (largest) character code.

◆ fontfalsebchar

Integer fontfalsebchar[FONT_MAX+1]

font bchar if it doesn’t exist in the font, otherwise non char.

◆ fontglue

Pointer fontglue[FONT_MAX+1]

glue specification for interword space, null if not allocated.

◆ fontinfo

the big collection of font data

◆ fontname

Static StrNumber fontname[FONT_MAX+1]

name of the font

◆ fontparams

FontIndex fontparams[FONT_MAX+1]

how many font parameters are present

◆ fontptr

largest internal font number in use

◆ fontsize

Static Scaled fontsize[FONT_MAX+1]

"at" size

◆ fontused

Boolean fontused[FONT_MAX+1]

has a character from this font actually appeared in the output?

◆ heightbase

Static Integer heightbase[FONT_MAX+1]

base addresses for heights.

◆ hyphenchar

Static Integer hyphenchar[FONT_MAX+1]

current \hyphenchar values

◆ italicbase

Static Integer italicbase[FONT_MAX+1]

base addresses for italic corrections.

◆ kernbase

Static Integer kernbase[FONT_MAX+1]

base addresses for kerns.

◆ ligkernbase

Integer ligkernbase[FONT_MAX+1]

base addresses for ligature/kerning programs.

◆ nullcharacter

FourQuarters nullcharacter

◆ parambase

Integer parambase[FONT_MAX+1]

base addresses for font parameters.

◆ skewchar

Static Integer skewchar[FONT_MAX+1]

current \skewchar values.

◆ widthbase

Static Integer widthbase[FONT_MAX+1]

base addresses for widths.