public class SharedContext
extends java.lang.Object
Constructor and Description |
---|
SharedContext(UserAgentCallback uac)
Constructor for the Context object
|
Modifier and Type | Method and Description |
---|---|
void |
addBoxId(java.lang.String id,
Box box) |
boolean |
debugDrawBoxes()
Description of the Method
|
boolean |
debugDrawFontMetrics() |
boolean |
debugDrawInlineBoxes()
Description of the Method
|
boolean |
debugDrawLineBoxes()
Description of the Method
|
void |
flushFonts() |
java.lang.String |
getBaseURL()
Gets the baseURL attribute of the RenderingContext object
|
Box |
getBoxById(java.lang.String id) |
RootPanel |
getCanvas() |
StyleReference |
getCss() |
int |
getDotsPerPixel() |
float |
getDPI()
Gets the dPI attribute of the RenderingContext object
|
java.awt.Rectangle |
getFixedRectangle() |
FSFont |
getFont(FontSpecification spec) |
FontResolver |
getFontResolver()
Gets the fontResolver attribute of the Context object
|
java.util.Map |
getIdMap() |
java.lang.String |
getMedia()
The media for this context
|
float |
getMmPerPx()
Gets the dPI attribute in a more useful form of the RenderingContext object
|
NamespaceHandler |
getNamespaceHandler() |
ReplacedElementFactory |
getReplacedElementFactory() |
CalculatedStyle |
getStyle(org.w3c.dom.Element e) |
CalculatedStyle |
getStyle(org.w3c.dom.Element e,
boolean restyle) |
TextRenderer |
getTextRenderer() |
UserAgentCallback |
getUac()
Gets the uac attribute of the RenderingContext object
|
UserAgentCallback |
getUserAgentCallback() |
float |
getXHeight(FontContext fontContext,
FontSpecification fs) |
boolean |
isInteractive() |
boolean |
isPaged()
Returns true if the currently set media type is paged.
|
boolean |
isPrint() |
LayoutContext |
newLayoutContextInstance() |
RenderingContext |
newRenderingContextInstance() |
void |
removeBoxId(java.lang.String id) |
void |
removeElementReferences(org.w3c.dom.Element e) |
void |
reset() |
void |
set_TempCanvas(java.awt.Rectangle rect) |
void |
setBaseURL(java.lang.String url)
Sets the baseURL attribute of the RenderingContext object
|
void |
setCanvas(RootPanel canvas) |
void |
setCss(StyleReference css) |
void |
setDebug_draw_boxes(boolean debug_draw_boxes) |
void |
setDebug_draw_font_metrics(boolean debug_draw_font_metrics) |
void |
setDebug_draw_inline_boxes(boolean debug_draw_inline_boxes) |
void |
setDebug_draw_line_boxes(boolean debug_draw_line_boxes) |
void |
setDotsPerPixel(int pixelsPerDot) |
void |
setDPI(float dpi)
Sets the effective DPI (Dots Per Inch) of the screen.
|
void |
setFontMapping(java.lang.String name,
java.awt.Font font)
Adds or overrides a font mapping, meaning you can associate a particular
font with a particular string.
|
void |
setFontResolver(FontResolver resolver) |
void |
setFormSubmissionListener(FormSubmissionListener fsl) |
void |
setInteractive(boolean interactive) |
void |
setMedia(java.lang.String media)
Set the current media type.
|
void |
setNamespaceHandler(NamespaceHandler nh) |
void |
setPrint(boolean print) |
void |
setReplacedElementFactory(ReplacedElementFactory ref) |
void |
setTextRenderer(TextRenderer text_renderer)
Sets the textRenderer attribute of the RenderingContext object
|
void |
setUserAgentCallback(UserAgentCallback userAgentCallback) |
public SharedContext(UserAgentCallback uac)
public void setFormSubmissionListener(FormSubmissionListener fsl)
public LayoutContext newLayoutContextInstance()
public RenderingContext newRenderingContextInstance()
public FontResolver getFontResolver()
public void flushFonts()
public java.lang.String getMedia()
public TextRenderer getTextRenderer()
public boolean debugDrawBoxes()
public boolean debugDrawLineBoxes()
public boolean debugDrawInlineBoxes()
public boolean debugDrawFontMetrics()
public void setDebug_draw_boxes(boolean debug_draw_boxes)
public void setDebug_draw_line_boxes(boolean debug_draw_line_boxes)
public void setDebug_draw_inline_boxes(boolean debug_draw_inline_boxes)
public void setDebug_draw_font_metrics(boolean debug_draw_font_metrics)
public StyleReference getCss()
public void setCss(StyleReference css)
public RootPanel getCanvas()
public void setCanvas(RootPanel canvas)
public void set_TempCanvas(java.awt.Rectangle rect)
public java.awt.Rectangle getFixedRectangle()
public void setNamespaceHandler(NamespaceHandler nh)
public NamespaceHandler getNamespaceHandler()
public void addBoxId(java.lang.String id, Box box)
public Box getBoxById(java.lang.String id)
public void removeBoxId(java.lang.String id)
public java.util.Map getIdMap()
public void setTextRenderer(TextRenderer text_renderer)
text_renderer
- The new textRenderer valuepublic void setMedia(java.lang.String media)
media
- The new media valuepublic UserAgentCallback getUac()
public UserAgentCallback getUserAgentCallback()
public void setUserAgentCallback(UserAgentCallback userAgentCallback)
public float getDPI()
public void setDPI(float dpi)
Toolkit.getDefaultToolkit().getScreenResolution()
. You can override the value if you want to scale the fonts for
accessibility or printing purposes. Currently the DPI setting only
affects font sizing.dpi
- The new dPI valuepublic float getMmPerPx()
public FSFont getFont(FontSpecification spec)
public float getXHeight(FontContext fontContext, FontSpecification fs)
public java.lang.String getBaseURL()
public void setBaseURL(java.lang.String url)
url
- The new baseURL valuepublic boolean isPaged()
public boolean isInteractive()
public void setInteractive(boolean interactive)
public boolean isPrint()
public void setPrint(boolean print)
public void setFontMapping(java.lang.String name, java.awt.Font font)
Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream("cool.ttf"); setFontMapping("CoolFont", font);You could then put the following css in your page
p { font-family: CoolFont Arial sans-serif; }You can also override existing font mappings, like replacing Arial with Helvetica.
name
- The new font namefont
- The actual Font to mappublic void setFontResolver(FontResolver resolver)
public int getDotsPerPixel()
public void setDotsPerPixel(int pixelsPerDot)
public CalculatedStyle getStyle(org.w3c.dom.Element e)
public CalculatedStyle getStyle(org.w3c.dom.Element e, boolean restyle)
public void reset()
public ReplacedElementFactory getReplacedElementFactory()
public void setReplacedElementFactory(ReplacedElementFactory ref)
public void removeElementReferences(org.w3c.dom.Element e)