iTextSharp.text.pdf.ArabicLigaturizer.Shape C# (CSharp) Метод

Shape() статический приватный Метод

static private Shape ( char text, StringBuilder str, int level ) : void
text char
str StringBuilder
level int
Результат void
        internal static void Shape(char[] text, StringBuilder str, int level)
        {
            /* string is assumed to be empty and big enough.
            * text is the original text.
            * This routine does the basic arabic reshaping.
            * *len the number of non-null characters.
            *
            * Note: We have to unshape each character first!
            */
            int join;
            int which;
            char nextletter;

            int p = 0;                     /* initialize for output */
            Charstruct oldchar = new Charstruct();
            Charstruct curchar = new Charstruct();
            while (p < text.Length) {
                nextletter = text[p++];
                //nextletter = unshape (nextletter);

                join = Ligature(nextletter, curchar);
                if (join == 0) {                       /* shape curchar */
                    int nc = Shapecount(nextletter);
                    //(*len)++;
                    if (nc == 1) {
                        which = 0;        /* final or isolated */
                    }
                    else {
                        which = 2;        /* medial or initial */
                    }
                    if (Connects_to_left(oldchar)) {
                        which++;
                    }

                    which = which % (curchar.numshapes);
                    curchar.basechar = Charshape(curchar.basechar, which);

                    /* get rid of oldchar */
                    Copycstostring(str, oldchar, level);
                    oldchar = curchar;    /* new values in oldchar */

                    /* init new curchar */
                    curchar = new Charstruct();
                    curchar.basechar = nextletter;
                    curchar.numshapes = nc;
                    curchar.lignum++;
                    //          (*len) += unligature (&curchar, level);
                }
                else if (join == 1) {
                }
                //      else
                //        {
                //          (*len) += unligature (&curchar, level);
                //        }
                //      p = g_utf8_next_char (p);
            }

            /* Handle last char */
            if (Connects_to_left(oldchar))
                which = 1;
            else
                which = 0;
            which = which % (curchar.numshapes);
            curchar.basechar = Charshape(curchar.basechar, which);

            /* get rid of oldchar */
            Copycstostring(str, oldchar, level);
            Copycstostring(str, curchar, level);
        }