use of com.google.gwt.dom.client.StyleElement in project rstudio by rstudio.
the class FontSizer method injectStylesIntoDocument.
public static void injectStylesIntoDocument(Document doc) {
StyleElement style = doc.createStyleElement();
style.setType("text/css");
style.setInnerText(styles.getText());
doc.getBody().appendChild(style);
}
use of com.google.gwt.dom.client.StyleElement in project rstudio by rstudio.
the class FontSizer method setNormalFontSize.
public static void setNormalFontSize(Document document, double size) {
// our resource class
if (document == null || styles == null)
return;
size = size + BrowseCap.getFontSkew();
final String STYLE_EL_ID = "__rstudio_normal_size";
Element oldStyle = document.getElementById(STYLE_EL_ID);
StyleElement style = document.createStyleElement();
if (style == null)
return;
style.setAttribute("type", "text/css");
style.setInnerText("." + styles.normalSize() + ", " + "." + styles.normalSize() + " td, " + "." + styles.normalSize() + " pre" + " {font-size:" + size + "pt !important;}");
BodyElement body = document.getBody();
if (body == null)
return;
body.appendChild(style);
if (oldStyle != null)
oldStyle.removeFromParent();
style.setId(STYLE_EL_ID);
}
Aggregations