org.extex.unit.base.register.font
Class FontPrimitive

java.lang.Object
  extended by org.extex.interpreter.type.AbstractCode
      extended by org.extex.interpreter.type.AbstractAssignment
          extended by org.extex.unit.base.register.font.FontPrimitive
All Implemented Interfaces:
java.io.Serializable, Code, FontConvertible

public class FontPrimitive
extends AbstractAssignment
implements FontConvertible

This class provides an implementation for the primitive \font.

The Primitive \font

The primitive \font can be used to load a font with some specified properties and assign it to a control sequence. The primary option is the specification of a size for the font. If no size is given then the font is loaded at its design size.

An exact size can be specified with the at keyword. The dimension following this keyword determines the size of the font.

The design size can be multiplied by a scale factor. This scale factor is given as number after the keyword scaled. The value given is 1000 times the scale factor to be used.

TODO missing documentation of the extensions

This primitive is an assignment.

Syntax

The formal description of this primitive is the following:
    ⟨font⟩
      → ⟨prefix⟩ \font ⟨control sequence⟩ ⟨equals⟩ ⟨font name⟩ ⟨options⟩

    ⟨prefix⟩
      →
       |  \global

    ⟨options⟩
      → ⟨option⟩
       |  ⟨option⟩ ⟨options⟩

    ⟨option⟩
      → [scaled] ⟨number⟩
       | [at] ⟨size⟩
       | [noligatures]
       | [nokerning]
       | [letterspaced]  

Examples

In the following example the font cmr12 is loaded at its design size. The macro \myfont is bound to this font.

   \font\myfont=cmr12  

In the following example the font cmr12 is loaded at the size 15pt. The macro \myfont is bound to this font.

   \font\myfont=cmr12 at 15pt  

In the following example the font cmr12 is loaded at the double design size. The scale factor 2000 is divided by 1000 to get the effective scaling factor. The macro \magnifiedfiverm is bound to this font.

   \font\magnifiedfiverm=cmr5 scaled 2000  

In the following example the font cmr10 is loaded at the size of 12 true pt. The macro \second is bound to this font.

   \font\second=cmr10 at 12truept  

Possible Extension

Example

 \font\myfont=cmr12 at 15pt letterspaced 10sp plus 3sp minus 2sp
 \font\myfont=cmr12 at 15pt letterspaced 10sp plus 3sp minus 2sp noligatures
 \font\myfont=cmr12 at 15pt noligatures
 \font\myfont=cmr12 at 15pt noligatures nokerning
 

Version:
$Revision:4431 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Constructor Summary
FontPrimitive(CodeToken token)
          Creates a new object.
 
Method Summary
 void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          The method assign is the core of the functionality of execute().
 Font convertFont(Context context, TokenSource source, Typesetter typesetter)
          Convert some primitive value into a font.
 void enableLogging(java.util.logging.Logger log)
          Setter for the logger.
 
Methods inherited from class org.extex.interpreter.type.AbstractAssignment
execute
 
Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

FontPrimitive

public FontPrimitive(CodeToken token)
Creates a new object.

Parameters:
token - the initial token for the primitive
Method Detail

assign

public void assign(Flags prefix,
                   Context context,
                   TokenSource source,
                   Typesetter typesetter)
            throws HelpingException,
                   TypesetterException
The method assign is the core of the functionality of execute(). This method is preferable to execute() since the execute() method provided in this class takes care of \afterassignment and \globaldefs as well.

Specified by:
assign in class AbstractAssignment
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
ConfigurationException - in case of an configuration error
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
AbstractAssignment.assign( org.extex.interpreter.Flags, org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)

convertFont

public Font convertFont(Context context,
                        TokenSource source,
                        Typesetter typesetter)
                 throws HelpingException,
                        TypesetterException
Convert some primitive value into a font.

Specified by:
convertFont in interface FontConvertible
Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Returns:
the converted value
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
FontConvertible.convertFont( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)

enableLogging

public void enableLogging(java.util.logging.Logger log)
Setter for the logger.

Parameters:
log - the logger to use
See Also:
org.extex.framework.logger.LogEnabled#enableLogging( java.util.logging.Logger)