示例#1
0
        private TextLine MakeTextLineOnRange(int startPos, int limitPos)
        {
            int[]   charsLtoV  = null;
            sbyte[] charLevels = null;

            if (FBidi != null)
            {
                Bidi lineBidi = FBidi.CreateLineBidi(startPos, limitPos);
                charLevels = BidiUtils.getLevels(lineBidi);
                int[] charsVtoL = BidiUtils.createVisualToLogicalMap(charLevels);
                charsLtoV = BidiUtils.createInverseMap(charsVtoL);
            }

            TextLineComponent[] components = MakeComponentsOnRange(startPos, limitPos);

            return(new TextLine(FFrc, components, FBaselineOffsets, FChars, startPos, limitPos, charsLtoV, charLevels, FIsDirectionLTR));
        }
示例#2
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);
        }