Menu

#45 error in parsing line-height using font shorthand

closed
nobody
parsing (2)
1
2015-01-10
2014-09-10
No

NodeData returns null values for all the font properties for the following declaration
p {
font: 200 italic 120%/120% "Times New Roman"
}

Discussion

  • Chetan Kothari

    Chetan Kothari - 2014-09-21

    Update:

    String css = "p {font: 400 italic 40px/1 \"Times New Roman\";}";
    String html = "<html><head><style>"
      + css
      + "</style></head><body><p>Hello</p></body></html> ";
    
    InputStream is = new ByteArrayInputStream(html.getBytes());
    DocumentSource docSrc = new StreamDocumentSource(is, new URL("http://localhost"), "text/html");
    DOMSource domSrc = new DefaultDOMSource(docSrc);
    Document doc = domSrc.parse();
    Element pElem = doc.createElement("p");
    StyleSheet styleSheet = CSSFactory.parse(css);
    DirectAnalyzer directAnalyser = new DirectAnalyzer(styleSheet);
    NodeData firstNodeData = directAnalyser.getElementStyle(pElem, null, "screen");
    final NodeData secondNodeData = directAnalyser.getElementStyle(pElem, null, "screen");
    
    System.out.println("First run: " + firstNodeData);
    System.out.println("Second run: " + secondNodeData);
    

    if the above snippet is run, the value of secondNodeData is null. Basically after the first call the value returned is always null.

    And if we remove /1 (line-height) form the font declaration, everything works fine.

     
  • Chetan Kothari

    Chetan Kothari - 2014-09-26

    This bug is fixed by PR

     

    Last edit: Chetan Kothari 2014-09-26
  • Chetan Kothari

    Chetan Kothari - 2014-09-26

    Tested and verified.

     
  • Radek Burget

    Radek Burget - 2014-09-26
    • status: open --> accepted
     
  • Radek Burget

    Radek Burget - 2015-01-10

    Closed in 1.19

     
  • Radek Burget

    Radek Burget - 2015-01-10
    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.