Exemple #1
0
        // constructors

        /**
         * Constructs a <CODE>PdfChunk</CODE>-object.
         *
         * @param string the content of the <CODE>PdfChunk</CODE>-object
         * @param font the <CODE>PdfFont</CODE>
         * @param attributes the metrics attributes
         * @param noStroke the non metric attributes
         */

        internal PdfChunk(string str, PdfChunk other)
        {
            thisChunk[0]    = this;
            value           = str;
            this.font       = other.font;
            this.attributes = other.attributes;
            this.noStroke   = other.noStroke;
            this.baseFont   = other.baseFont;
            Object[] obj = null;
            if (attributes.ContainsKey(Chunk.IMAGE))
            {
                obj = (Object[])attributes[Chunk.IMAGE];
            }
            if (obj == null)
            {
                image = null;
            }
            else
            {
                image         = (Image)obj[0];
                offsetX       = (float)obj[1];
                offsetY       = (float)obj[2];
                changeLeading = (bool)obj[3];
            }
            encoding = font.Font.Encoding;
            if (noStroke.ContainsKey(Chunk.SPLITCHARACTER))
            {
                splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
            }
            else
            {
                splitCharacter = DefaultSplitCharacter.DEFAULT;
            }
        }
        /// <summary>
        /// membervariables
        /// </summary>
        /// <summary>
        /// constructors
        /// </summary>

        /// <summary>
        /// Constructs a  PdfChunk -object.
        /// </summary>
        internal PdfChunk(string str, PdfChunk other)
        {
            _thisChunk[0] = this;
            value         = str;
            font          = other.font;
            Attributes    = other.Attributes;
            NoStroke      = other.NoStroke;
            BaseFont      = other.BaseFont;
            object[] obj = (object[])Attributes[Chunk.IMAGE];
            if (obj == null)
            {
                image = null;
            }
            else
            {
                image         = (Image)obj[0];
                OffsetX       = (float)obj[1];
                OffsetY       = (float)obj[2];
                changeLeading = (bool)obj[3];
            }
            encoding       = font.Font.Encoding;
            SplitCharacter = (ISplitCharacter)NoStroke[Chunk.SPLITCHARACTER];
            if (SplitCharacter == null)
            {
                SplitCharacter = DefaultSplitCharacter.Default;
            }
        }
Exemple #3
0
        // constructors

        /**
         * Constructs a <CODE>PdfChunk</CODE>-object.
         *
         * @param string the content of the <CODE>PdfChunk</CODE>-object
         * @param font the <CODE>PdfFont</CODE>
         * @param attributes the metrics attributes
         * @param noStroke the non metric attributes
         */

        internal PdfChunk(string str, PdfChunk other)
        {
            value           = str;
            this.font       = other.font;
            this.attributes = other.attributes;
            this.noStroke   = other.noStroke;
            Object[] obj = (Object[])attributes[Chunk.IMAGE];
            if (obj == null)
            {
                image = null;
            }
            else
            {
                image         = (Image)obj[0];
                offsetX       = ((float)obj[1]);
                offsetY       = ((float)obj[2]);
                changeLeading = bool.Parse(obj[3].ToString());
            }
            encoding       = font.Font.Encoding;
            splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
            if (splitCharacter == null)
            {
                splitCharacter = this;
            }
        }
Exemple #4
0
      /**
       * Constructs a <CODE>PdfChunk</CODE>-object.
       *
       * @param chunk the original <CODE>Chunk</CODE>-object
       * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE>
       */
 
      internal PdfChunk(Chunk chunk, PdfAction action) {
          thisChunk[0] = this;
          value = chunk.Content;
      
          Font f = chunk.Font;
          float size = f.Size;
          if (size == iTextSharp.text.Font.UNDEFINED)
              size = 12;
          baseFont = f.BaseFont;
          BaseFont bf = f.BaseFont;
          int style = f.Style;
          if (style == iTextSharp.text.Font.UNDEFINED) {
              style = iTextSharp.text.Font.NORMAL;
          }
          if (baseFont == null) {
              // translation of the font-family to a PDF font-family
              baseFont = f.GetCalculatedBaseFont(false);
          }
          else{
              // bold simulation
              if ((style & iTextSharp.text.Font.BOLD) != 0)
                  attributes[Chunk.TEXTRENDERMODE] = new Object[]{PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, size / 30f, null};
              // italic simulation
              if ((style & iTextSharp.text.Font.ITALIC) != 0)
                  attributes[Chunk.SKEW] = new float[]{0, ITALIC_ANGLE};
          }
          font = new PdfFont(baseFont, size);
          // other style possibilities
          Dictionary<string,object> attr = chunk.Attributes;
          if (attr != null) {
              foreach (KeyValuePair<string,object> entry in attr) {
                  string name = entry.Key;
                  if (keysAttributes.ContainsKey(name)) {
                      attributes[name] = entry.Value;
                  }
                  else if (keysNoStroke.ContainsKey(name)) {
                      noStroke[name] = entry.Value;
                  }
              }
              if (attr.ContainsKey(Chunk.GENERICTAG) && "".Equals(attr[Chunk.GENERICTAG])) {
                  attributes[Chunk.GENERICTAG] = chunk.Content;
              }
          }
          if (f.IsUnderlined()) {
              Object[] obj = {null, new float[]{0, 1f / 15, 0, -1f / 3, 0}};
              Object[][] obja = null;
              if (attributes.ContainsKey(Chunk.UNDERLINE))
                  obja = (Object[][])attributes[Chunk.UNDERLINE];
              Object[][] unders = Utilities.AddToArray(obja, obj);
              attributes[Chunk.UNDERLINE] = unders;
          }
          if (f.IsStrikethru()) {
              Object[] obj = {null, new float[]{0, 1f / 15, 0, 1f / 3, 0}};
              Object[][] obja = null;
              if (attributes.ContainsKey(Chunk.UNDERLINE))
                  obja = (Object[][])attributes[Chunk.UNDERLINE];
              Object[][] unders = Utilities.AddToArray(obja, obj);
              attributes[Chunk.UNDERLINE] = unders;
          }
          if (action != null)
              attributes[Chunk.ACTION] = action;
          // the color can't be stored in a PdfFont
          noStroke[Chunk.COLOR] = f.Color;
          noStroke[Chunk.ENCODING] = font.Font.Encoding;
          Object[] obj2 = null;
          if (attributes.ContainsKey(Chunk.IMAGE))
              obj2 = (Object[])attributes[Chunk.IMAGE];
          if (obj2 == null)
              image = null;
          else {
              attributes.Remove(Chunk.HSCALE); // images are scaled in other ways
              image = (Image)obj2[0];
              offsetX = ((float)obj2[1]);
              offsetY = ((float)obj2[2]);
              changeLeading = (bool)obj2[3];
          }
          font.Image = image;
          object hs;
          attributes.TryGetValue(Chunk.HSCALE, out hs);
          if (hs != null)
              font.HorizontalScaling = (float)hs;
          encoding = font.Font.Encoding;
          if (noStroke.ContainsKey(Chunk.SPLITCHARACTER))
              splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
          else
              splitCharacter = DefaultSplitCharacter.DEFAULT;
      }
Exemple #5
0
     // constructors
 
     /**
      * Constructs a <CODE>PdfChunk</CODE>-object.
      *
      * @param string the content of the <CODE>PdfChunk</CODE>-object
      * @param font the <CODE>PdfFont</CODE>
      * @param attributes the metrics attributes
      * @param noStroke the non metric attributes
      */
 
     internal PdfChunk(string str, PdfChunk other) {
         thisChunk[0] = this;
         value = str;
         this.font = other.font;
         this.attributes = other.attributes;
         this.noStroke = other.noStroke;
         this.baseFont = other.baseFont;
         Object[] obj = null;
         if (attributes.ContainsKey(Chunk.IMAGE))
             obj = (Object[])attributes[Chunk.IMAGE];
         if (obj == null)
             image = null;
         else {
             image = (Image)obj[0];
             offsetX = (float)obj[1];
             offsetY = (float)obj[2];
             changeLeading = (bool)obj[3];
         }
         encoding = font.Font.Encoding;
         if (noStroke.ContainsKey(Chunk.SPLITCHARACTER))
             splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
         else
             splitCharacter = DefaultSplitCharacter.DEFAULT;
     }
        /**
         * Constructs a <CODE>PdfChunk</CODE>-object.
         *
         * @param chunk the original <CODE>Chunk</CODE>-object
         * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE>
         */

        internal PdfChunk(Chunk chunk, PdfAction action)
        {
            value = chunk.Content;

            Font  f    = chunk.Font;
            float size = f.Size;

            if (size == iTextSharp.text.Font.UNDEFINED)
            {
                size = 12;
            }
            baseFont = f.BaseFont;
            //BaseFont bf = f.BaseFont;
            int style = f.Style;

            if (style == iTextSharp.text.Font.UNDEFINED)
            {
                style = iTextSharp.text.Font.NORMAL;
            }
            if (baseFont == null)
            {
                // translation of the font-family to a PDF font-family
                baseFont = f.GetCalculatedBaseFont(false);
            }
            else
            {
                // bold simulation
                if ((style & iTextSharp.text.Font.BOLD) != 0)
                {
                    attributes[Chunk.TEXTRENDERMODE] = new Object[] { PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, size / 30f, null }
                }
                ;
                // italic simulation
                if ((style & iTextSharp.text.Font.ITALIC) != 0)
                {
                    attributes[Chunk.SKEW] = new float[] { 0, ITALIC_ANGLE }
                }
                ;
            }
            font = new PdfFont(baseFont, size);
            // other style possibilities
            Dictionary <string, object> attr = chunk.Attributes;

            if (attr != null)
            {
                foreach (KeyValuePair <string, object> entry in attr)
                {
                    string name = entry.Key;
                    if (keysAttributes.ContainsKey(name))
                    {
                        attributes[name] = entry.Value;
                    }
                    else if (keysNoStroke.ContainsKey(name))
                    {
                        noStroke[name] = entry.Value;
                    }
                }
                if (attr.ContainsKey(Chunk.GENERICTAG) && "".Equals(attr[Chunk.GENERICTAG]))
                {
                    attributes[Chunk.GENERICTAG] = chunk.Content;
                }
            }
            if (f.IsUnderlined())
            {
                Object[]   obj  = { null, new float[] { 0, UNDERLINE_THICKNESS, 0, UNDERLINE_OFFSET, 0 } };
                Object[][] obja = null;
                if (attributes.ContainsKey(Chunk.UNDERLINE))
                {
                    obja = (Object[][])attributes[Chunk.UNDERLINE];
                }
                Object[][] unders = Utilities.AddToArray(obja, obj);
                attributes[Chunk.UNDERLINE] = unders;
            }
            if (f.IsStrikethru())
            {
                Object[]   obj  = { null, new float[] { 0, 1f / 15, 0, 1f / 3, 0 } };
                Object[][] obja = null;
                if (attributes.ContainsKey(Chunk.UNDERLINE))
                {
                    obja = (Object[][])attributes[Chunk.UNDERLINE];
                }
                Object[][] unders = Utilities.AddToArray(obja, obj);
                attributes[Chunk.UNDERLINE] = unders;
            }
            if (action != null)
            {
                attributes[Chunk.ACTION] = action;
            }
            // the color can't be stored in a PdfFont
            noStroke[Chunk.COLOR]    = f.Color;
            noStroke[Chunk.ENCODING] = font.Font.Encoding;
            Object lh;

            if (attributes.TryGetValue(Chunk.LINEHEIGHT, out lh))
            {
                changeLeading = true;
                leading       = (float)lh;
            }

            Object[] obj2 = null;
            if (attributes.ContainsKey(Chunk.IMAGE))
            {
                obj2 = (Object[])attributes[Chunk.IMAGE];
            }
            if (obj2 == null)
            {
                image = null;
            }
            else
            {
                attributes.Remove(Chunk.HSCALE); // images are scaled in other ways
                image         = (Image)obj2[0];
                offsetX       = ((float)obj2[1]);
                offsetY       = ((float)obj2[2]);
                changeLeading = (bool)obj2[3];
            }
            object hs;

            if (attributes.TryGetValue(Chunk.HSCALE, out hs))
            {
                font.HorizontalScaling = (float)hs;
            }
            encoding = font.Font.Encoding;
            if (noStroke.ContainsKey(Chunk.SPLITCHARACTER))
            {
                splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
            }
            else
            {
                splitCharacter = DefaultSplitCharacter.DEFAULT;
            }
            accessibleElement = chunk;
        }
Exemple #7
0
 /// <summary>
 /// Sets the split characters.
 /// </summary>
 /// <param name="splitCharacter">the SplitCharacter interface</param>
 /// <returns>this Chunk</returns>
 public Chunk SetSplitCharacter(ISplitCharacter splitCharacter) {
     return SetAttribute(SPLITCHARACTER, splitCharacter);
 }
Exemple #8
0
 /// <summary>
 /// Sets the split characters.
 /// </summary>
 /// <param name="splitCharacter">the SplitCharacter interface</param>
 /// <returns>this Chunk</returns>
 virtual public Chunk SetSplitCharacter(ISplitCharacter splitCharacter)
 {
     return(SetAttribute(SPLITCHARACTER, splitCharacter));
 }
        /// <summary>
        /// Constructs a  PdfChunk -object.
        /// </summary>
        /// <param name="chunk">the original  Chunk -object</param>
        /// <param name="action">the  PdfAction  if the  Chunk  comes from an  Anchor </param>

        internal PdfChunk(Chunk chunk, PdfAction action)
        {
            _thisChunk[0] = this;
            value         = chunk.Content;

            Font  f    = chunk.Font;
            float size = f.Size;

            if (size.ApproxEquals(text.Font.UNDEFINED))
            {
                size = 12;
            }
            BaseFont = f.BaseFont;
            BaseFont bf    = f.BaseFont;
            int      style = f.Style;

            if (style == text.Font.UNDEFINED)
            {
                style = text.Font.NORMAL;
            }
            if (BaseFont == null)
            {
                // translation of the font-family to a PDF font-family
                BaseFont = f.GetCalculatedBaseFont(false);
            }
            else
            {
                // bold simulation
                if ((style & text.Font.BOLD) != 0)
                {
                    Attributes[Chunk.TEXTRENDERMODE] = new object[] { PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, size / 30f, null }
                }
                ;
                // italic simulation
                if ((style & text.Font.ITALIC) != 0)
                {
                    Attributes[Chunk.SKEW] = new[] { 0, ItalicAngle }
                }
                ;
            }
            font = new PdfFont(BaseFont, size);
            // other style possibilities
            Hashtable attr = chunk.Attributes;

            if (attr != null)
            {
                foreach (DictionaryEntry entry in attr)
                {
                    string name = (string)entry.Key;
                    if (_keysAttributes.ContainsKey(name))
                    {
                        Attributes[name] = entry.Value;
                    }
                    else if (_keysNoStroke.ContainsKey(name))
                    {
                        NoStroke[name] = entry.Value;
                    }
                }
                if ("".Equals(attr[Chunk.GENERICTAG]))
                {
                    Attributes[Chunk.GENERICTAG] = chunk.Content;
                }
            }
            if (f.IsUnderlined())
            {
                object[]   obj    = { null, new[] { 0, 1f / 15, 0, -1f / 3, 0 } };
                object[][] unders = Utilities.AddToArray((object[][])Attributes[Chunk.UNDERLINE], obj);
                Attributes[Chunk.UNDERLINE] = unders;
            }
            if (f.IsStrikethru())
            {
                object[]   obj    = { null, new[] { 0, 1f / 15, 0, 1f / 3, 0 } };
                object[][] unders = Utilities.AddToArray((object[][])Attributes[Chunk.UNDERLINE], obj);
                Attributes[Chunk.UNDERLINE] = unders;
            }
            if (action != null)
            {
                Attributes[Chunk.ACTION] = action;
            }
            // the color can't be stored in a PdfFont
            NoStroke[Chunk.COLOR]    = f.Color;
            NoStroke[Chunk.ENCODING] = font.Font.Encoding;
            object[] obj2 = (object[])Attributes[Chunk.IMAGE];
            if (obj2 == null)
            {
                image = null;
            }
            else
            {
                Attributes.Remove(Chunk.HSCALE); // images are scaled in other ways
                image         = (Image)obj2[0];
                OffsetX       = ((float)obj2[1]);
                OffsetY       = ((float)obj2[2]);
                changeLeading = (bool)obj2[3];
            }
            font.Image = image;
            object hs = Attributes[Chunk.HSCALE];

            if (hs != null)
            {
                font.HorizontalScaling = (float)hs;
            }
            encoding       = font.Font.Encoding;
            SplitCharacter = (ISplitCharacter)NoStroke[Chunk.SPLITCHARACTER];
            if (SplitCharacter == null)
            {
                SplitCharacter = DefaultSplitCharacter.Default;
            }
        }
Exemple #10
0
        /**
         * Constructs a <CODE>PdfChunk</CODE>-object.
         *
         * @param chunk the original <CODE>Chunk</CODE>-object
         * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE>
         */

        internal PdfChunk(Chunk chunk, PdfAction action)
        {
            value = chunk.Content;

            iTextSharp.text.Font f = chunk.Font;
            float size             = f.Size;

            if (size == iTextSharp.text.Font.UNDEFINED)
            {
                size = 12;
            }
            BaseFont bf = f.BaseFont;
            int      family;
            int      style = f.Style;

            if (bf == null)
            {
                // translation of the font-family to a PDF font-family
                if (style == iTextSharp.text.Font.UNDEFINED)
                {
                    style = iTextSharp.text.Font.NORMAL;
                }
                switch (f.Family)
                {
                case iTextSharp.text.Font.COURIER:
                    switch (style & iTextSharp.text.Font.BOLDITALIC)
                    {
                    case iTextSharp.text.Font.BOLD:
                        family = PdfFont.COURIER_BOLD;
                        break;

                    case iTextSharp.text.Font.ITALIC:
                        family = PdfFont.COURIER_OBLIQUE;
                        break;

                    case iTextSharp.text.Font.BOLDITALIC:
                        family = PdfFont.COURIER_BOLDOBLIQUE;
                        break;

                    default:
                    case iTextSharp.text.Font.NORMAL:
                        family = PdfFont.COURIER;
                        break;
                    }
                    break;

                case iTextSharp.text.Font.TIMES_NEW_ROMAN:
                    switch (style & iTextSharp.text.Font.BOLDITALIC)
                    {
                    case iTextSharp.text.Font.BOLD:
                        family = PdfFont.TIMES_BOLD;
                        break;

                    case iTextSharp.text.Font.ITALIC:
                        family = PdfFont.TIMES_ITALIC;
                        break;

                    case iTextSharp.text.Font.BOLDITALIC:
                        family = PdfFont.TIMES_BOLDITALIC;
                        break;

                    default:
                    case iTextSharp.text.Font.NORMAL:
                        family = PdfFont.TIMES_ROMAN;
                        break;
                    }
                    break;

                case iTextSharp.text.Font.SYMBOL:
                    family = PdfFont.SYMBOL;
                    break;

                case iTextSharp.text.Font.ZAPFDINGBATS:
                    family = PdfFont.ZAPFDINGBATS;
                    break;

                default:
                case iTextSharp.text.Font.HELVETICA:
                    switch (style & iTextSharp.text.Font.BOLDITALIC)
                    {
                    case iTextSharp.text.Font.BOLD:
                        family = PdfFont.HELVETICA_BOLD;
                        break;

                    case iTextSharp.text.Font.ITALIC:
                        family = PdfFont.HELVETICA_OBLIQUE;
                        break;

                    case iTextSharp.text.Font.BOLDITALIC:
                        family = PdfFont.HELVETICA_BOLDOBLIQUE;
                        break;

                    default:
                    case iTextSharp.text.Font.NORMAL:
                        family = PdfFont.HELVETICA;
                        break;
                    }
                    break;
                }
                // creation of the PdfFont with the right size
                font = new PdfFont(family, size);
            }
            else
            {
                // bold simulation
                if ((style & iTextSharp.text.Font.BOLD) != 0)
                {
                    attributes.Add(Chunk.TEXTRENDERMODE, new Object[] { PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, size / 30f, null });
                }
                // italic simulation
                if ((style & iTextSharp.text.Font.ITALIC) != 0)
                {
                    attributes.Add(Chunk.SKEW, new float[] { 0, ITALIC_ANGLE });
                }

                font = new PdfFont(bf, size);
            }



            // other style possibilities
            Hashmap attr = chunk.Attributes;

            if (attr != null)
            {
                foreach (string name in attr.Keys)
                {
                    if (keysAttributes.ContainsKey(name))
                    {
                        attributes.Add(name, attr[name]);
                    }
                    else if (keysNoStroke.ContainsKey(name))
                    {
                        noStroke.Add(name, attr[name]);
                    }
                }
                if ("".Equals(attr[Chunk.GENERICTAG]))
                {
                    attributes.Add(Chunk.GENERICTAG, chunk.Content);
                }
            }
            if (f.isUnderlined())
            {
                attributes.Add(Chunk.UNDERLINE, null);
            }
            if (f.isStrikethru())
            {
                attributes.Add(Chunk.STRIKETHRU, null);
            }
            if (action != null)
            {
                attributes.Add(Chunk.ACTION, action);
            }
            // the color can't be stored in a PdfFont
            noStroke.Add(Chunk.COLOR, f.Color);
            noStroke.Add(Chunk.ENCODING, font.Font.Encoding);
            Object[] obj = (Object[])attributes[Chunk.IMAGE];
            if (obj == null)
            {
                image = null;
            }
            else
            {
                image         = (Image)obj[0];
                offsetX       = ((float)obj[1]);
                offsetY       = ((float)obj[2]);
                changeLeading = bool.Parse(obj[3].ToString());
            }
            font.Image     = image;
            encoding       = font.Font.Encoding;
            splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
            if (splitCharacter == null)
            {
                splitCharacter = this;
            }
        }
Exemple #11
0
        /**
         * Constructs a <CODE>PdfChunk</CODE>-object.
         *
         * @param chunk the original <CODE>Chunk</CODE>-object
         * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE>
         */

        internal PdfChunk(Chunk chunk, PdfAction action)
        {
            thisChunk[0] = this;
            value        = chunk.Content;

            Font  f    = chunk.Font;
            float size = f.Size;

            if (size == iTextSharp.text.Font.UNDEFINED)
            {
                size = 12;
            }
            baseFont = f.BaseFont;
            BaseFont bf    = f.BaseFont;
            int      style = f.Style;

            if (style == iTextSharp.text.Font.UNDEFINED)
            {
                style = iTextSharp.text.Font.NORMAL;
            }
            if (baseFont == null)
            {
                // translation of the font-family to a PDF font-family
                baseFont = f.GetCalculatedBaseFont(false);
            }
            else
            {
                // bold simulation
                if ((style & iTextSharp.text.Font.BOLD) != 0)
                {
                    attributes[Chunk.TEXTRENDERMODE] = new Object[] { PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, size / 30f, null }
                }
                ;
                // italic simulation
                if ((style & iTextSharp.text.Font.ITALIC) != 0)
                {
                    attributes[Chunk.SKEW] = new float[] { 0, ITALIC_ANGLE }
                }
                ;
            }
            font = new PdfFont(baseFont, size);
            // other style possibilities
            Hashtable attr = chunk.Attributes;

            if (attr != null)
            {
                foreach (string name in attr.Keys)
                {
                    if (keysAttributes.ContainsKey(name))
                    {
                        attributes[name] = attr[name];
                    }
                    else if (keysNoStroke.ContainsKey(name))
                    {
                        noStroke[name] = attr[name];
                    }
                }
                if ("".Equals(attr[Chunk.GENERICTAG]))
                {
                    attributes[Chunk.GENERICTAG] = chunk.Content;
                }
            }
            if (f.IsUnderlined())
            {
                Object[]   obj    = { null, new float[] { 0, 1f / 15, 0, -1f / 3, 0 } };
                Object[][] unders = Chunk.AddToArray((Object[][])attributes[Chunk.UNDERLINE], obj);
                attributes[Chunk.UNDERLINE] = unders;
            }
            if (f.IsStrikethru())
            {
                Object[]   obj    = { null, new float[] { 0, 1f / 15, 0, 1f / 3, 0 } };
                Object[][] unders = Chunk.AddToArray((Object[][])attributes[Chunk.UNDERLINE], obj);
                attributes[Chunk.UNDERLINE] = unders;
            }
            if (action != null)
            {
                attributes[Chunk.ACTION] = action;
            }
            // the color can't be stored in a PdfFont
            noStroke[Chunk.COLOR]    = f.Color;
            noStroke[Chunk.ENCODING] = font.Font.Encoding;
            Object[] obj2 = (Object[])attributes[Chunk.IMAGE];
            if (obj2 == null)
            {
                image = null;
            }
            else
            {
                attributes.Remove(Chunk.HSCALE); // images are scaled in other ways
                image         = (Image)obj2[0];
                offsetX       = ((float)obj2[1]);
                offsetY       = ((float)obj2[2]);
                changeLeading = (bool)obj2[3];
            }
            font.Image = image;
            object hs = attributes[Chunk.HSCALE];

            if (hs != null)
            {
                font.HorizontalScaling = (float)hs;
            }
            encoding       = font.Font.Encoding;
            splitCharacter = (ISplitCharacter)noStroke[Chunk.SPLITCHARACTER];
            if (splitCharacter == null)
            {
                splitCharacter = this;
            }
        }