de.dante.extex.interpreter.primitives.register.font
Class FontPrimitive

java.lang.Object
  extended byde.dante.extex.interpreter.type.AbstractCode
      extended byde.dante.extex.interpreter.type.AbstractAssignment
          extended byde.dante.extex.interpreter.primitives.register.font.FontPrimitive
All Implemented Interfaces:
Code, FontConvertible, Localizable, LogEnabled, java.io.Serializable

public class FontPrimitive
extends AbstractAssignment
implements FontConvertible, LogEnabled

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 \myfont 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 \myfont 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: 1.44 $
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(java.lang.String name)
          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 de.dante.extex.interpreter.type.AbstractAssignment
execute
 
Methods inherited from class de.dante.extex.interpreter.type.AbstractCode
enableLocalization, getLocalizer, getName, isIf, isOuter, printable, printableControlSequence, readResolve, setName, toString
 
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(java.lang.String name)
Creates a new object.

Parameters:
name - the name for debugging
Method Detail

assign

public void assign(Flags prefix,
                   Context context,
                   TokenSource source,
                   Typesetter typesetter)
            throws InterpreterException
Description copied from class: AbstractAssignment
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:
InterpreterException - in case of an error
See Also:
Code.execute( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

convertFont

public Font convertFont(Context context,
                        TokenSource source,
                        Typesetter typesetter)
                 throws InterpreterException
Description copied from interface: FontConvertible
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:
InterpreterException - In case of an error
See Also:
FontConvertible.convertFont( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

enableLogging

public void enableLogging(java.util.logging.Logger log)
Description copied from interface: LogEnabled
Setter for the logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
log - the logger to use
See Also:
LogEnabled.enableLogging( java.util.logging.Logger)