HasProperty() 공개 메소드

public HasProperty ( String key ) : bool
key String
리턴 bool
예제 #1
0
        public Font GetFont(ChainedProperties props)
        {
            String face = props[ElementTags.FACE];

            if (face != null)
            {
                StringTokenizer tok = new StringTokenizer(face, ",");
                while (tok.HasMoreTokens())
                {
                    face = tok.NextToken().Trim();
                    if (face.StartsWith("\""))
                    {
                        face = face.Substring(1);
                    }
                    if (face.EndsWith("\""))
                    {
                        face = face.Substring(0, face.Length - 1);
                    }
                    if (fontImp.IsRegistered(face))
                    {
                        break;
                    }
                }
            }
            int style = 0;

            if (props.HasProperty(HtmlTags.I))
            {
                style |= Font.ITALIC;
            }
            if (props.HasProperty(HtmlTags.B))
            {
                style |= Font.BOLD;
            }
            if (props.HasProperty(HtmlTags.U))
            {
                style |= Font.UNDERLINE;
            }
            if (props.HasProperty(HtmlTags.S))
            {
                style |= Font.STRIKETHRU;
            }

            String value = props[ElementTags.SIZE];
            float  size  = 12;

            if (value != null)
            {
                size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }
            Color  color    = Markup.DecodeColor(props["color"]);
            String encoding = props["encoding"];

            if (encoding == null)
            {
                encoding = BaseFont.WINANSI;
            }
            return(fontImp.GetFont(face, encoding, true, size, style, color));
        }
예제 #2
0
 public Chunk CreateChunk(String text, ChainedProperties props) {
     Font font = GetFont(props);
     float size = font.Size;
     size /= 2;
     Chunk ck = new Chunk(text, font);
     if (props.HasProperty("sub"))
         ck.SetTextRise(-size);
     else if (props.HasProperty("sup"))
         ck.SetTextRise(size);
     ck.SetHyphenation(GetHyphenation(props));
     return ck;
 }
예제 #3
0
        public Chunk CreateChunk(String text, ChainedProperties props)
        {
            Chunk ck = new Chunk(text, GetFont(props));

            if (props.HasProperty("sub"))
            {
                ck.SetTextRise(-6);
            }
            else if (props.HasProperty("sup"))
            {
                ck.SetTextRise(6);
            }
            return(ck);
        }
예제 #4
0
        /**
         * Creates an iText Chunk
         * @param content the content of the Chunk
         * @param chain the hierarchy chain
         * @return a Chunk
         */
        virtual public Chunk CreateChunk(String content, ChainedProperties chain)
        {
            Font  font = GetFont(chain);
            Chunk ck   = new Chunk(content, font);

            if (chain.HasProperty(HtmlTags.SUB))
            {
                ck.SetTextRise(-font.Size / 2);
            }
            else if (chain.HasProperty(HtmlTags.SUP))
            {
                ck.SetTextRise(font.Size / 2);
            }
            ck.SetHyphenation(GetHyphenation(chain));
            return(ck);
        }
예제 #5
0
        public Chunk CreateChunk(String text, ChainedProperties props)
        {
            Font  font = GetFont(props);
            float size = font.Size;

            size /= 2;
            Chunk ck = new Chunk(text, font);

            if (props.HasProperty("sub"))
            {
                ck.SetTextRise(-size);
            }
            else if (props.HasProperty("sup"))
            {
                ck.SetTextRise(size);
            }
            ck.SetHyphenation(GetHyphenation(props));
            return(ck);
        }
예제 #6
0
 /**
  * Creates a Font object based on a chain of properties.
  * @param   chain   chain of properties
  * @return  an iText Font object
  */
 public Font GetFont(ChainedProperties chain) {
     
     // [1] font name
     
     String face = chain[HtmlTags.FACE];
     // try again, under the CSS key.  
     //ISSUE: If both are present, we always go with face, even if font-family was  
     //  defined more recently in our ChainedProperties.  One solution would go like this: 
     //    Map all our supported style attributes to the 'normal' tag name, so we could   
     //    look everything up under that one tag, retrieving the most current value.
     if (face == null || face.Trim().Length == 0) {
         face = chain[HtmlTags.FONTFAMILY];
     }
     // if the font consists of a comma separated list,
     // take the first font that is registered
     if (face != null) {
         StringTokenizer tok = new StringTokenizer(face, ",");
         while (tok.HasMoreTokens()) {
             face = tok.NextToken().Trim();
             if (face.StartsWith("\""))
                 face = face.Substring(1);
             if (face.EndsWith("\""))
                 face = face.Substring(0, face.Length - 1);
             if (provider.IsRegistered(face))
                 break;
         }
     }
     
     // [2] encoding
     String encoding = chain[HtmlTags.ENCODING];
     if (encoding == null)
         encoding = BaseFont.WINANSI;
     
     // [3] embedded
     
     // [4] font size
     String value = chain[HtmlTags.SIZE];
     float size = 12;
     if (value != null)
         size = float.Parse(value, CultureInfo.InvariantCulture);
     
     // [5] font style
     int style = 0;
     
     // text-decoration
     String decoration = chain[HtmlTags.TEXTDECORATION];
     if (decoration != null && decoration.Trim().Length != 0) {
       if (HtmlTags.UNDERLINE.Equals(decoration)) {
         style |= Font.UNDERLINE;
       } else if (HtmlTags.LINETHROUGH.Equals(decoration)) {
         style |= Font.STRIKETHRU;
       }
     }
     // italic
     if (chain.HasProperty(HtmlTags.I))
         style |= Font.ITALIC;
     // bold
     if (chain.HasProperty(HtmlTags.B))
         style |= Font.BOLD;
     // underline
     if (chain.HasProperty(HtmlTags.U))
         style |= Font.UNDERLINE;
     // strikethru
     if (chain.HasProperty(HtmlTags.S))
         style |= Font.STRIKETHRU;
     
     // [6] Color
     BaseColor color = HtmlUtilities.DecodeColor(chain[HtmlTags.COLOR]);
     
     // Get the font object from the provider
     return provider.GetFont(face, encoding, true, size, style, color);
 }
예제 #7
0
 /**
  * Creates an iText Chunk
  * @param content the content of the Chunk
  * @param chain the hierarchy chain
  * @return a Chunk
  */
 public Chunk CreateChunk(String content, ChainedProperties chain) {
     Font font = GetFont(chain);
     Chunk ck = new Chunk(content, font);
     if (chain.HasProperty(HtmlTags.SUB))
         ck.SetTextRise(-font.Size / 2);
     else if (chain.HasProperty(HtmlTags.SUP))
         ck.SetTextRise(font.Size / 2);
     ck.SetHyphenation(GetHyphenation(chain));
     return ck;
 }
예제 #8
0
        /**
         * Creates a Font object based on a chain of properties.
         * @param   chain   chain of properties
         * @return  an iText Font object
         */
        virtual public Font GetFont(ChainedProperties chain)
        {
            // [1] font name

            String face = chain[HtmlTags.FACE];

            // try again, under the CSS key.
            //ISSUE: If both are present, we always go with face, even if font-family was
            //  defined more recently in our ChainedProperties.  One solution would go like this:
            //    Map all our supported style attributes to the 'normal' tag name, so we could
            //    look everything up under that one tag, retrieving the most current value.
            if (face == null || face.Trim().Length == 0)
            {
                face = chain[HtmlTags.FONTFAMILY];
            }
            // if the font consists of a comma separated list,
            // take the first font that is registered
            if (face != null)
            {
                StringTokenizer tok = new StringTokenizer(face, ",");
                while (tok.HasMoreTokens())
                {
                    face = tok.NextToken().Trim();
                    if (face.StartsWith("\""))
                    {
                        face = face.Substring(1);
                    }
                    if (face.EndsWith("\""))
                    {
                        face = face.Substring(0, face.Length - 1);
                    }
                    if (provider.IsRegistered(face))
                    {
                        break;
                    }
                }
            }

            // [2] encoding
            String encoding = chain[HtmlTags.ENCODING];

            if (encoding == null)
            {
                encoding = BaseFont.WINANSI;
            }

            // [3] embedded

            // [4] font size
            String value = chain[HtmlTags.SIZE];
            float  size  = 12;

            if (value != null)
            {
                size = float.Parse(value, CultureInfo.InvariantCulture);
            }

            // [5] font style
            int style = 0;

            // text-decoration
            String decoration = chain[HtmlTags.TEXTDECORATION];

            if (decoration != null && decoration.Trim().Length != 0)
            {
                if (HtmlTags.UNDERLINE.Equals(decoration))
                {
                    style |= Font.UNDERLINE;
                }
                else if (HtmlTags.LINETHROUGH.Equals(decoration))
                {
                    style |= Font.STRIKETHRU;
                }
            }
            // italic
            if (chain.HasProperty(HtmlTags.I))
            {
                style |= Font.ITALIC;
            }
            // bold
            if (chain.HasProperty(HtmlTags.B))
            {
                style |= Font.BOLD;
            }
            // underline
            if (chain.HasProperty(HtmlTags.U))
            {
                style |= Font.UNDERLINE;
            }
            // strikethru
            if (chain.HasProperty(HtmlTags.S))
            {
                style |= Font.STRIKETHRU;
            }

            // [6] Color
            BaseColor color = HtmlUtilities.DecodeColor(chain[HtmlTags.COLOR]);

            // Get the font object from the provider
            return(provider.GetFont(face, encoding, true, size, style, color));
        }
예제 #9
0
        public Font GetFont(ChainedProperties props) {
            String face = props[ElementTags.FACE];
            // try again, under the CSS key.  
            //ISSUE: If both are present, we always go with face, even if font-family was  
            //  defined more recently in our ChainedProperties.  One solution would go like this: 
            //    Map all our supported style attributes to the 'normal' tag name, so we could   
            //    look everything up under that one tag, retrieving the most current value.
            if (face == null || face.Trim().Length == 0) {
                face = props[Markup.CSS_KEY_FONTFAMILY];
            }
            if (face != null) {
                StringTokenizer tok = new StringTokenizer(face, ",");
                while (tok.HasMoreTokens()) {
                    face = tok.NextToken().Trim();
                    if (face.StartsWith("\""))
                        face = face.Substring(1);
                    if (face.EndsWith("\""))
                        face = face.Substring(0, face.Length - 1);
                    if (fontImp.IsRegistered(face))
                        break;
                }
            }
            int style = 0;
            String textDec = props[Markup.CSS_KEY_TEXTDECORATION];
            if (textDec != null && textDec.Trim().Length != 0) {
                if (Markup.CSS_VALUE_UNDERLINE.Equals(textDec)) {
                    style |= Font.UNDERLINE;
                }
                else if (Markup.CSS_VALUE_LINETHROUGH.Equals(textDec)) {
                    style |= Font.STRIKETHRU;
                }
            }
            if (props.HasProperty(HtmlTags.I))
                style |= Font.ITALIC;
            if (props.HasProperty(HtmlTags.B))
                style |= Font.BOLD;
            if (props.HasProperty(HtmlTags.U))
                style |= Font.UNDERLINE;
            if (props.HasProperty(HtmlTags.S))
                style |= Font.STRIKETHRU ;

            String value = props[ElementTags.SIZE];
            float size = 12;
            if (value != null)
                size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            BaseColor color = Markup.DecodeColor(props["color"]);
            String encoding = props["encoding"];
            if (encoding == null)
                encoding = BaseFont.WINANSI;
            return fontImp.GetFont(face, encoding, true, size, style, color);
        }
예제 #10
0
        public Font GetFont(ChainedProperties props) {
            String face = props[ElementTags.FACE];
            if (face != null) {
                StringTokenizer tok = new StringTokenizer(face, ",");
                while (tok.HasMoreTokens()) {
                    face = tok.NextToken().Trim();
                    if (face.StartsWith("\""))
                        face = face.Substring(1);
                    if (face.EndsWith("\""))
                        face = face.Substring(0, face.Length - 1);
                    if (fontImp.IsRegistered(face))
                        break;
                }
            }
            int style = 0;
            if (props.HasProperty(HtmlTags.I))
                style |= Font.ITALIC;
            if (props.HasProperty(HtmlTags.B))
                style |= Font.BOLD;
            if (props.HasProperty(HtmlTags.U))
                style |= Font.UNDERLINE;
            if (props.HasProperty(HtmlTags.S))
                style |= Font.STRIKETHRU ;

            String value = props[ElementTags.SIZE];
            float size = 12;
            if (value != null)
                size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            BaseColor color = Markup.DecodeColor(props["color"]);
            String encoding = props["encoding"];
            if (encoding == null)
                encoding = BaseFont.WINANSI;
            return fontImp.GetFont(face, encoding, true, size, style, color);
        }
예제 #11
0
 public Chunk CreateChunk(String text, ChainedProperties props)
 {
     Chunk ck = new Chunk(text, GetFont(props));
     if (props.HasProperty("sub"))
         ck.SetTextRise(-6);
     else if (props.HasProperty("sup"))
         ck.SetTextRise(6);
     return ck;
 }
예제 #12
0
        public Font GetFont(ChainedProperties props)
        {
            String face = props[ElementTags.FACE];

            // try again, under the CSS key.
            //ISSUE: If both are present, we always go with face, even if font-family was
            //  defined more recently in our ChainedProperties.  One solution would go like this:
            //    Map all our supported style attributes to the 'normal' tag name, so we could
            //    look everything up under that one tag, retrieving the most current value.
            if (face == null || face.Trim().Length == 0)
            {
                face = props[Markup.CSS_KEY_FONTFAMILY];
            }
            if (face != null)
            {
                StringTokenizer tok = new StringTokenizer(face, ",");
                while (tok.HasMoreTokens())
                {
                    face = tok.NextToken().Trim();
                    if (face.StartsWith("\""))
                    {
                        face = face.Substring(1);
                    }
                    if (face.EndsWith("\""))
                    {
                        face = face.Substring(0, face.Length - 1);
                    }
                    if (fontImp.IsRegistered(face))
                    {
                        break;
                    }
                }
            }
            int    style   = 0;
            String textDec = props[Markup.CSS_KEY_TEXTDECORATION];

            if (textDec != null && textDec.Trim().Length != 0)
            {
                if (Markup.CSS_VALUE_UNDERLINE.Equals(textDec))
                {
                    style |= Font.UNDERLINE;
                }
                else if (Markup.CSS_VALUE_LINETHROUGH.Equals(textDec))
                {
                    style |= Font.STRIKETHRU;
                }
            }
            if (props.HasProperty(HtmlTags.I))
            {
                style |= Font.ITALIC;
            }
            if (props.HasProperty(HtmlTags.B))
            {
                style |= Font.BOLD;
            }
            if (props.HasProperty(HtmlTags.U))
            {
                style |= Font.UNDERLINE;
            }
            if (props.HasProperty(HtmlTags.S))
            {
                style |= Font.STRIKETHRU;
            }

            String value = props[ElementTags.SIZE];
            float  size  = 12;

            if (value != null)
            {
                size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
            }
            BaseColor color    = Markup.DecodeColor(props["color"]);
            String    encoding = props["encoding"];

            if (encoding == null)
            {
                encoding = BaseFont.WINANSI;
            }
            return(fontImp.GetFont(face, encoding, true, size, style, color));
        }