Package com.itextpdf.tool.xml.css.apply
Class ChunkCssApplier
- java.lang.Object
-
- com.itextpdf.tool.xml.css.apply.ChunkCssApplier
-
- All Implemented Interfaces:
CssApplier<Chunk>
public class ChunkCssApplier extends java.lang.Object implements CssApplier<Chunk>
Applies CSS Rules to Chunks
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.String>BOLDFF4 and IE8 provide normal text and bold text.protected FontProviderfontProviderprotected CssUtilsutils
-
Constructor Summary
Constructors Constructor Description ChunkCssApplier()ChunkCssApplier(FontProvider fontProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Chunkapply(Chunk c, Tag t)Chunkapply(Chunk c, Tag t, MarginMemory mm, PageSizeContainable psc, HtmlPipelineContext ctx)Styles an elementFontapplyFontStyles(Tag t)voidcopyChunkStyles(Chunk source, Chunk target)Method used for copying styles from one chunk to another.FontProvidergetFontProvider()floatgetWidestWord(Chunk c)Method used for retrieving the widest word of a chunk of text.protected booleanisBoldValue(java.lang.String value)voidsetFontProvider(FontProvider fontProvider)
-
-
-
Field Detail
-
BOLD
public static final java.util.List<java.lang.String> BOLD
FF4 and IE8 provide normal text and bold text. All other values are translated to one of these 2 styles
100 - 500 and "lighter" = normal.
600 - 900 and "bolder" = bold.
-
utils
protected final CssUtils utils
-
fontProvider
protected FontProvider fontProvider
-
-
Constructor Detail
-
ChunkCssApplier
public ChunkCssApplier()
-
ChunkCssApplier
public ChunkCssApplier(FontProvider fontProvider)
-
-
Method Detail
-
apply
public Chunk apply(Chunk c, Tag t, MarginMemory mm, PageSizeContainable psc, HtmlPipelineContext ctx)
Description copied from interface:CssApplierStyles an element- Specified by:
applyin interfaceCssApplier<Chunk>- Parameters:
c- the Chunk to apply CSS to.t- the tag containing the chunk datamm- the MarginMemorypsc- the PageSizeContainablectx- the HtmlPipelineContext- Returns:
- the styled chunk
-
getWidestWord
public float getWidestWord(Chunk c)
Method used for retrieving the widest word of a chunk of text. All styles of the chunk will be taken into account when calculating the width of the words.- Parameters:
c- chunk of which the widest word is required.- Returns:
- float containing the width of the widest word.
-
copyChunkStyles
public void copyChunkStyles(Chunk source, Chunk target)
Method used for copying styles from one chunk to another. Could be deprecated if the content of a chunk can be overwritten.- Parameters:
source- chunk which contains the required styles.target- chunk which needs the required styles.
-
getFontProvider
public FontProvider getFontProvider()
-
setFontProvider
public void setFontProvider(FontProvider fontProvider)
-
isBoldValue
protected boolean isBoldValue(java.lang.String value)
-
-