Example for using CSS Styles Filter
Oxygen general issues.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Example for using CSS Styles Filter
Hi Dylan,
See an example below:
Basically you first check what class is expected for the value which you want to set by calling the getter for that property and then you can overwrite the property with the new value.
Regards,
Radu
See an example below:
Code: Select all
/**
* @see ro.sync.ecss.extensions.api.StylesFilter#filter(ro.sync.ecss.css.Styles, ro.sync.ecss.extensions.api.node.AuthorNode)
*/
public ro.sync.ecss.css.Styles filter(Styles styles, AuthorNode authorNode) {
//Use font size of 8 for "para"
if(authorNode.getName().equals("para")) {
ro.sync.exml.view.graphics.Font original = styles.getFont();
ro.sync.exml.view.graphics.Font modified = new ro.sync.exml.view.graphics.Font(original.getName(), original.getStyle(), 8);
styles.setProperty(Styles.KEY_FONT, modified);
}
//Use foreground color red for "bold"
if(authorNode.getName().equals("bold")) {
ro.sync.exml.view.graphics.Color red = ro.sync.exml.view.graphics.Color.COLOR_RED;
styles.setProperty(Styles.KEY_FOREGROUND_COLOR, red);
}
//Use left border width of 5 pixels for "italic"
if(authorNode.getName().equals("italic")) {
styles.setProperty(Styles.KEY_BORDER_LEFT_WIDTH, new Integer(5));
}
return styles;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Example for using CSS Styles Filter
Hi Dylan,
Indeed, the package is obfuscated in 10.2 and you cannot access the Font or Color.
We'll correct this and contact you for more details.
Regards,
Radu
Indeed, the package is obfuscated in 10.2 and you cannot access the Font or Color.
We'll correct this and contact you for more details.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service