Top Description Fields Constructors Methods
de.undercouch.citeproc.csl.internal.behavior

public Class FormattingAttributes

extends Object
Class Inheritance
Imports
de.undercouch.citeproc.helper.NodeHelper, org.w3c.dom.Node

A class providing static methods to create formatting attributes. Each attribute is encoded using two bits of an integer as follows:

            VA  |  TD  |  FW  |  FV  |  FS
BIT 31 ... 9  8 | 7  6 | 5  4 | 3  2 | 1  0

FS = Font style
FV = Font variant
FW = Font weight
TD = Text decoration
VA = Vertical alignment

The values of each attribute are as follows:

FS: 00 - UNDEFINED
    01 - NORMAL
    10 - ITALIC
    11 - OBLIQUE

FV: 00 - UNDEFINED
    01 - NORMAL
    10 - SMALL_CAPS

FW: 00 - UNDEFINED
    01 - NORMAL
    10 - BOLD
    11 - LIGHT

TD: 00 - UNDEFINED
    01 - NONE
    10 - UNDERLINE

VA: 00 - UNDEFINED
    01 - BASELINE
    10 - SUP
    11 - SUB
Author
Michel Kraemer

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
FS_NORMAL

Font style values

public static final int
private static final int
FS_SHIFT

The number of bits to shift for each formatting attribute

public static final int
FV_NORMAL

Font variant values

private static final int
public static final int
public static final int
public static final int
public static final int
FW_NORMAL

Font weight values

private static final int
public static final int
public static final int
TD_NONE

Text decoration values

private static final int
public static final int
public static final int
public static final int
VA_BASELINE

Vertical alignment values

private static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
private
FormattingAttributes()

Hidden constructor.

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the font style
getFontStyle
(int
the integer
attributes
)

Get the font style from an integer

public static int

Returns:

the font variant
getFontVariant
(int
the integer
attributes
)

Get the font variant from an integer

public static int

Returns:

the font weight
getFontWeight
(int
the integer
attributes
)

Get the font weight from an integer

public static int

Returns:

the text decoration
getTextDecoration
(int
the integer
attributes
)

Get the text decoration from an integer

public static int

Returns:

the vertical alignment
getVerticalAlign
(int
the integer
attributes
)

Get the vertical alignment from an integer

public static int

Returns:

the merged formatting attributes
merge
(int
the set to merge into
a
,
int
the set to merge (overwrites attributes from a)
b
)

Merge two sets of formatting attributes

public static int

Returns:

the formatting attributes (will equal 0 if the XML node did not contain any values)
of
(Node
the XML node to parse
node
)

Create formatting attributes from an XML node

public static int

Returns:

the formatting attributes
ofFontStyle
(int
the font style (one of FS_NORMAL, FS_ITALIC, FS_OBLIQUE)
fontStyle
)

Create formatting attributes from the given font style

public static int

Returns:

the formatting attributes
ofFontVariant
(int
the font variant (one of FV_NORMAL, FV_SMALLCAPS)
fontVariant
)

Create formatting attributes from the given font variant

public static int

Returns:

the formatting attributes
ofFontWeight
(int
the font weight (one of FW_NORMAL, FW_BOLD, FW_LIGHT)
fontWeight
)

Create formatting attributes from the given font weight

public static int

Returns:

the formatting attributes
ofTextDecoration
(int
the text decoration (one of TD_NONE, TD_UNDERLINE)
textDecoration
)

Create formatting attributes from the given text decoration

public static int

Returns:

the formatting attributes
ofVerticalAlign
(int
the vertical align (one of VA_BASELINE, VA_SUP, VA_SUB)
verticalAlign
)

Create formatting attributes from the given vertical align

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FS_ITALICback to summary
public static final int FS_ITALIC
FS_NORMALback to summary
public static final int FS_NORMAL

Font style values

FS_OBLIQUEback to summary
public static final int FS_OBLIQUE
FS_SHIFTback to summary
private static final int FS_SHIFT

The number of bits to shift for each formatting attribute

FV_NORMALback to summary
public static final int FV_NORMAL

Font variant values

FV_SHIFTback to summary
private static final int FV_SHIFT
FV_SMALLCAPSback to summary
public static final int FV_SMALLCAPS
FW_BOLDback to summary
public static final int FW_BOLD
FW_LIGHTback to summary
public static final int FW_LIGHT
FW_NORMALback to summary
public static final int FW_NORMAL

Font weight values

FW_SHIFTback to summary
private static final int FW_SHIFT
NORMALback to summary
public static final int NORMAL
TD_NONEback to summary
public static final int TD_NONE

Text decoration values

TD_SHIFTback to summary
private static final int TD_SHIFT
TD_UNDERLINEback to summary
public static final int TD_UNDERLINE
UNDEFINEDback to summary
public static final int UNDEFINED
VA_BASELINEback to summary
public static final int VA_BASELINE

Vertical alignment values

VA_SHIFTback to summary
private static final int VA_SHIFT
VA_SUBback to summary
public static final int VA_SUB
VA_SUPback to summary
public static final int VA_SUP

Constructor Detail

FormattingAttributesback to summary
private FormattingAttributes()

Hidden constructor. Use of(Node) instead.

Method Detail

getFontStyleback to summary
public static int getFontStyle(int attributes)

Get the font style from an integer

Parameters
attributes:int

the integer

Returns:int

the font style

getFontVariantback to summary
public static int getFontVariant(int attributes)

Get the font variant from an integer

Parameters
attributes:int

the integer

Returns:int

the font variant

getFontWeightback to summary
public static int getFontWeight(int attributes)

Get the font weight from an integer

Parameters
attributes:int

the integer

Returns:int

the font weight

getTextDecorationback to summary
public static int getTextDecoration(int attributes)

Get the text decoration from an integer

Parameters
attributes:int

the integer

Returns:int

the text decoration

getVerticalAlignback to summary
public static int getVerticalAlign(int attributes)

Get the vertical alignment from an integer

Parameters
attributes:int

the integer

Returns:int

the vertical alignment

mergeback to summary
public static int merge(int a, int b)

Merge two sets of formatting attributes

Parameters
a:int

the set to merge into

b:int

the set to merge (overwrites attributes from a)

Returns:int

the merged formatting attributes

ofback to summary
public static int of(Node node)

Create formatting attributes from an XML node

Parameters
node:Node

the XML node to parse

Returns:int

the formatting attributes (will equal 0 if the XML node did not contain any values)

ofFontStyleback to summary
public static int ofFontStyle(int fontStyle)

Create formatting attributes from the given font style

Parameters
fontStyle:int

the font style (one of FS_NORMAL, FS_ITALIC, FS_OBLIQUE)

Returns:int

the formatting attributes

ofFontVariantback to summary
public static int ofFontVariant(int fontVariant)

Create formatting attributes from the given font variant

Parameters
fontVariant:int

the font variant (one of FV_NORMAL, FV_SMALLCAPS)

Returns:int

the formatting attributes

ofFontWeightback to summary
public static int ofFontWeight(int fontWeight)

Create formatting attributes from the given font weight

Parameters
fontWeight:int

the font weight (one of FW_NORMAL, FW_BOLD, FW_LIGHT)

Returns:int

the formatting attributes

ofTextDecorationback to summary
public static int ofTextDecoration(int textDecoration)

Create formatting attributes from the given text decoration

Parameters
textDecoration:int

the text decoration (one of TD_NONE, TD_UNDERLINE)

Returns:int

the formatting attributes

ofVerticalAlignback to summary
public static int ofVerticalAlign(int verticalAlign)

Create formatting attributes from the given vertical align

Parameters
verticalAlign:int

the vertical align (one of VA_BASELINE, VA_SUP, VA_SUB)

Returns:int

the formatting attributes