Coverage Report - org.crosswire.jsword.book.filter.thml.FontTag
 
Classes in this File Line Coverage Branch Coverage Complexity
FontTag
0%
0/22
0%
0/8
3
 
 1  
 /**
 2  
  * Distribution License:
 3  
  * JSword is free software; you can redistribute it and/or modify it under
 4  
  * the terms of the GNU Lesser General Public License, version 2.1 or later
 5  
  * as published by the Free Software Foundation. This program is distributed
 6  
  * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 7  
  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 8  
  * See the GNU Lesser General Public License for more details.
 9  
  *
 10  
  * The License is available on the internet at:
 11  
  *      http://www.gnu.org/copyleft/lgpl.html
 12  
  * or by writing to:
 13  
  *      Free Software Foundation, Inc.
 14  
  *      59 Temple Place - Suite 330
 15  
  *      Boston, MA 02111-1307, USA
 16  
  *
 17  
  * © CrossWire Bible Society, 2005 - 2016
 18  
  *
 19  
  */
 20  
 package org.crosswire.jsword.book.filter.thml;
 21  
 
 22  
 import org.crosswire.common.xml.XMLUtil;
 23  
 import org.crosswire.jsword.book.Book;
 24  
 import org.crosswire.jsword.book.DataPolice;
 25  
 import org.crosswire.jsword.book.OSISUtil;
 26  
 import org.crosswire.jsword.passage.Key;
 27  
 import org.jdom2.Element;
 28  
 import org.xml.sax.Attributes;
 29  
 
 30  
 /**
 31  
  * THML Tag to process the font element.
 32  
  * 
 33  
  * @see gnu.lgpl.License The GNU Lesser General Public License for details.
 34  
  * @author Joe Walker
 35  
  */
 36  0
 public class FontTag extends AbstractTag {
 37  
     /* (non-Javadoc)
 38  
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
 39  
      */
 40  
     public String getTagName() {
 41  0
         return "font";
 42  
     }
 43  
 
 44  
     @Override
 45  
     public Element processTag(Book book, Key key, Element ele, Attributes attrs) {
 46  0
         Element seg = OSISUtil.factory().createSeg();
 47  0
         StringBuilder buf = new StringBuilder();
 48  
 
 49  0
         String color = attrs.getValue("color");
 50  0
         if (color != null) {
 51  0
             buf.append(OSISUtil.SEG_COLORPREFIX);
 52  0
             buf.append(color);
 53  0
             buf.append(';');
 54  
         }
 55  
 
 56  0
         String size = attrs.getValue("size");
 57  0
         if (size != null) {
 58  0
             buf.append(OSISUtil.SEG_SIZEPREFIX);
 59  0
             buf.append(size);
 60  0
             buf.append(';');
 61  
         }
 62  
 
 63  0
         String type = buf.toString();
 64  0
         if (type.length() > 0) {
 65  0
             seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE, type);
 66  
         } else {
 67  0
             DataPolice.report(book, key, "Missing color/size attribute.");
 68  0
             XMLUtil.debugSAXAttributes(attrs);
 69  
         }
 70  
 
 71  0
         if (ele != null) {
 72  0
             ele.addContent(seg);
 73  
         }
 74  
 
 75  0
         return seg;
 76  
     }
 77  
 }