Example #1
0
        public LineArea(FontState fontState, int lineHeight, int halfLeading,
                        int allocationWidth, int startIndent, int endIndent,
                        LineArea prevLineArea)
            : base(fontState)
        {
            this.currentFontState   = fontState;
            this.lineHeight         = lineHeight;
            this.nominalFontSize    = fontState.FontSize;
            this.nominalGlyphHeight = fontState.Ascender - fontState.Descender;

            this.placementOffset       = fontState.Ascender;
            this.contentRectangleWidth = allocationWidth - startIndent
                                         - endIndent;
            this.fontState = fontState;

            this.allocationHeight = this.nominalGlyphHeight;
            this.halfLeading      = this.lineHeight - this.allocationHeight;

            this.startIndent = startIndent;
            this.endIndent   = endIndent;

            if (prevLineArea != null)
            {
                IEnumerator e            = prevLineArea.pendingAreas.GetEnumerator();
                Box         b            = null;
                bool        eatMoreSpace = true;
                int         eatenWidth   = 0;

                while (eatMoreSpace)
                {
                    if (e.MoveNext())
                    {
                        b = (Box)e.Current;
                        if (b is InlineSpace)
                        {
                            InlineSpace isp = (InlineSpace)b;
                            if (isp.isEatable())
                            {
                                eatenWidth += isp.getSize();
                            }
                            else
                            {
                                eatMoreSpace = false;
                            }
                        }
                        else
                        {
                            eatMoreSpace = false;
                        }
                    }
                    else
                    {
                        eatMoreSpace = false;
                        b            = null;
                    }
                }

                while (b != null)
                {
                    pendingAreas.Add(b);
                    if (e.MoveNext())
                    {
                        b = (Box)e.Current;
                    }
                    else
                    {
                        b = null;
                    }
                }
                pendingWidth = prevLineArea.getPendingWidth() - eatenWidth;
            }
        }
Example #2
0
        public LineArea(FontState fontState, int lineHeight, int halfLeading,
                        int allocationWidth, int startIndent, int endIndent,
                        LineArea prevLineArea)
            : base(fontState)
        {
            this.currentFontState = fontState;
            this.lineHeight = lineHeight;
            this.nominalFontSize = fontState.FontSize;
            this.nominalGlyphHeight = fontState.Ascender - fontState.Descender;

            this.placementOffset = fontState.Ascender;
            this.contentRectangleWidth = allocationWidth - startIndent
                - endIndent;
            this.fontState = fontState;

            this.allocationHeight = this.nominalGlyphHeight;
            this.halfLeading = this.lineHeight - this.allocationHeight;

            this.startIndent = startIndent;
            this.endIndent = endIndent;

            if (prevLineArea != null)
            {
                IEnumerator e = prevLineArea.pendingAreas.GetEnumerator();
                Box b = null;
                bool eatMoreSpace = true;
                int eatenWidth = 0;

                while (eatMoreSpace)
                {
                    if (e.MoveNext())
                    {
                        b = (Box)e.Current;
                        if (b is InlineSpace)
                        {
                            InlineSpace isp = (InlineSpace)b;
                            if (isp.isEatable())
                            {
                                eatenWidth += isp.getSize();
                            }
                            else
                            {
                                eatMoreSpace = false;
                            }
                        }
                        else
                        {
                            eatMoreSpace = false;
                        }
                    }
                    else
                    {
                        eatMoreSpace = false;
                        b = null;
                    }
                }

                while (b != null)
                {
                    pendingAreas.Add(b);
                    if (e.MoveNext())
                    {
                        b = (Box)e.Current;
                    }
                    else
                    {
                        b = null;
                    }
                }
                pendingWidth = prevLineArea.getPendingWidth() - eatenWidth;
            }
        }