Exemplo n.º 1
0
        private static IFragment[] ConvertToFragments(ref GlueProperty startGlue, IEnumerable <IFormatObject> objectList, ref GlueProperty endGlue, InlineStyle style, out InlineStyle newStyle)
        {
            var styleClone = style.Clone();
            var context    = new Context(styleClone, 64);

            context.PutGlue(startGlue);
            foreach (var obj in objectList)
            {
                context.Put(obj);
            }
            context.PutGlue(endGlue);
            newStyle = styleClone;
            return(context.Fragments);
        }
        public UnjustifiedLine Build(
            GlueProperty startGlue,
            IEnumerable <IFormatObject> objectList,
            GlueProperty endGlue,
            float penaltyValue,
            InlineStyle style,
            out InlineStyle newStyle)
        {
            var     styleClone = style.Clone();
            Context context    = new Context(styleClone, 64);

            context.PutGlue(startGlue);
            foreach (var obj in objectList)
            {
                context.Put(obj);
            }
            context.PutGlue(endGlue);
            var buffer = context.Buffer.ToArray();
            //TODO: この処理が同じオブジェクト列に対して繰り返し呼ばれる。もっと前段階に運搬
            var rubyLayoutedBuffer = UnjustifiedLine.LayoutRubyInLine(buffer, endGlue.Length);

            newStyle = styleClone;
            return(new UnjustifiedLine(rubyLayoutedBuffer, context.AccumulatedGlue, penaltyValue));
        }