Esempio n. 1
0
        public virtual void SubstituteOneToMany(OpenTypeFontTableReader tableReader, int[] substGlyphIds)
        {
            //sequence length shall be at least 1
            int   substCode = substGlyphIds[0];
            Glyph oldGlyph  = glyphs[idx];
            Glyph glyph     = tableReader.GetGlyph(substCode);

            glyphs[idx] = glyph;
            if (substGlyphIds.Length > 1)
            {
                IList <Glyph> additionalGlyphs = new List <Glyph>(substGlyphIds.Length - 1);
                for (int i = 1; i < substGlyphIds.Length; ++i)
                {
                    substCode = substGlyphIds[i];
                    glyph     = tableReader.GetGlyph(substCode);
                    additionalGlyphs.Add(glyph);
                }
                AddAllGlyphs(idx + 1, additionalGlyphs);
                if (null != actualText)
                {
                    if (null == actualText[idx])
                    {
                        actualText[idx] = new GlyphLine.ActualText(oldGlyph.GetUnicodeString());
                    }
                    for (int i = 0; i < additionalGlyphs.Count; i++)
                    {
                        this.actualText[idx + 1 + i] = actualText[idx];
                    }
                }
                idx += substGlyphIds.Length - 1;
                end += substGlyphIds.Length - 1;
            }
        }
Esempio n. 2
0
 public override bool Equals(Object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj == null || GetType() != obj.GetType())
     {
         return(false);
     }
     GlyphLine.ActualText other = (GlyphLine.ActualText)obj;
     return(value == null && other.value == null || value.Equals(other.value));
 }
Esempio n. 3
0
 public virtual void SetActualText(int left, int right, String text)
 {
     if (this.actualText == null)
     {
         this.actualText = new List <GlyphLine.ActualText>(glyphs.Count);
         for (int i = 0; i < glyphs.Count; i++)
         {
             this.actualText.Add(null);
         }
     }
     GlyphLine.ActualText actualText = new GlyphLine.ActualText(text);
     for (int i = left; i < right; i++)
     {
         this.actualText[i] = actualText;
     }
 }
Esempio n. 4
0
        private GlyphLine.GlyphLinePart NextGlyphLinePart(int pos)
        {
            if (pos >= glyphLine.end)
            {
                return(null);
            }
            int startPos = pos;

            GlyphLine.ActualText startActualText = glyphLine.actualText[pos];
            while (pos < glyphLine.end && glyphLine.actualText[pos] == startActualText)
            {
                pos++;
            }
            return(new GlyphLine.GlyphLinePart(startPos, pos, startActualText != null ? startActualText
                                               .value : null));
        }
Esempio n. 5
0
        public virtual void TestEquals()
        {
            Glyph glyph = new Glyph(200, 200, 200);

            GlyphLine.ActualText actualText = new GlyphLine.ActualText("-");
            GlyphLine            one        = new GlyphLine(new List <Glyph>(JavaUtil.ArraysAsList(glyph)), new List <GlyphLine.ActualText
                                                                                                                      >(JavaUtil.ArraysAsList(actualText)), 0, 1);
            GlyphLine two = new GlyphLine(new List <Glyph>(JavaUtil.ArraysAsList(glyph)), new List <GlyphLine.ActualText
                                                                                                    >(JavaUtil.ArraysAsList(actualText)), 0, 1);

            one.Add(glyph);
            two.Add(glyph);
            one.end++;
            two.end++;
            NUnit.Framework.Assert.IsTrue(one.Equals(two));
        }
Esempio n. 6
0
 public override bool Equals(Object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj == null || GetType() != obj.GetType())
     {
         return(false);
     }
     iText.IO.Font.Otf.GlyphLine other = (iText.IO.Font.Otf.GlyphLine)obj;
     if (end - start != other.end - other.start)
     {
         return(false);
     }
     if (actualText == null && other.actualText != null || actualText != null && other.actualText == null)
     {
         return(false);
     }
     for (int i = start; i < end; i++)
     {
         int   otherPos   = other.start + i - start;
         Glyph myGlyph    = Get(i);
         Glyph otherGlyph = other.Get(otherPos);
         if (myGlyph == null && otherGlyph != null || myGlyph != null && !myGlyph.Equals(otherGlyph))
         {
             return(false);
         }
         GlyphLine.ActualText myAT    = actualText == null ? null : actualText[i];
         GlyphLine.ActualText otherAT = other.actualText == null ? null : other.actualText[otherPos];
         if (myAT == null && otherAT != null || myAT != null && !myAT.Equals(otherAT))
         {
             return(false);
         }
     }
     return(true);
 }