Exemplo n.º 1
0
        /// <summary>
        /// Generate components for the paragraph.  fChars, fBidi should have been
        /// initialized already.
        /// </summary>
        private void GenerateComponents(int startingAt, int endingAt)
        {
            if (CollectStats)
            {
                FormattedChars += (endingAt - startingAt);
            }
            int layoutFlags          = 0;    // no extra info yet, bidi determines run and line direction
            TextLabelFactory factory = new TextLabelFactory(FFrc, FChars, FBidi, layoutFlags);

            int[] charsLtoV = null;

            if (FBidi != null)
            {
                FLevels = BidiUtils.getLevels(FBidi);
                int[] charsVtoL = BidiUtils.createVisualToLogicalMap(FLevels);
                charsLtoV       = BidiUtils.createInverseMap(charsVtoL);
                FIsDirectionLTR = FBidi.BaseIsLeftToRight();
            }
            else
            {
                FLevels         = null;
                FIsDirectionLTR = true;
            }

            try
            {
                FComponents = TextLine.GetComponents(FParagraph, FChars, startingAt, endingAt, charsLtoV, FLevels, factory);
            }
            catch (IllegalArgumentException e)
            {
                System.Console.WriteLine("startingAt=" + startingAt + "; endingAt=" + endingAt);
                System.Console.WriteLine("fComponentLimit=" + FComponentLimit);
                throw e;
            }

            FComponentStart = startingAt;
            FComponentLimit = endingAt;
            //debugFormatCount += (endingAt-startingAt);
        }