Пример #1
0
 public JapaneseLetterFragment(
     GlueProperty beforeGlue,
     float contentLength,
     UChar content,
     TextEmphasysDot textEmphasysDot)
     : base(beforeGlue, contentLength, textEmphasysDot)
 {
     _content = content;
 }
Пример #2
0
            public void PutGroupRuby(GroupRuby @object)
            {
                var baseFragments = GenerateFragments(_currentStyle, @object.BaseObjects, _accumulatedGlue);

                _accumulatedGlue = default(GlueProperty);
                var rubyFragments = GenerateFragments(_currentStyle, @object.RubyObjects, default(GlueProperty));

                _buffer.Add(new InlineLayoutEngine.RubyFragment(baseFragments, rubyFragments));
            }
Пример #3
0
 public LatinWordPartFragment(
     GlueProperty beforeGlue,
     float contentLength,
     UString content,
     TextEmphasysDot textEmphasysDot)
     : base(beforeGlue, contentLength, textEmphasysDot)
 {
     _content = content;
 }
Пример #4
0
 public AtomicFragment(
     GlueProperty beforeGlue,
     float contentLength,
     TextEmphasysDot textEmphasysDot)
 {
     BeforeGlue       = beforeGlue;
     ContentLength    = contentLength;
     _textEmphasysDot = textEmphasysDot;
 }
Пример #5
0
            public void PutLetter(JapaneseLetter @object)
            {
                var newFragment = new InlineLayoutEngine.JapaneseLetterFragment(
                    _accumulatedGlue,
                    @object.Length,
                    @object.Letter,
                    _currentStyle.TextEmphasysDot);

                _buffer.Add(newFragment);
                _accumulatedGlue = default(GlueProperty);
            }
Пример #6
0
 public JapaneseInterletterspace(
     GlueProperty glue,
     GlueProperty glueBeforeBreak,
     float indentAfterBreak,
     bool isBreakProhibited)
 {
     Glue             = glue;
     GlueBeforeBreak  = glueBeforeBreak;
     IndentAfterBreak = indentAfterBreak;
     _penalty         = isBreakProhibited ? LineBreaking.Constants.PenaltyInfinity : 0;
 }
Пример #7
0
            public void PutLatinWordPart(LatinWord @object)
            {
                var newFragment = new InlineLayoutEngine.LatinWordPartFragment(
                    _accumulatedGlue,
                    @object.Length,
                    @object.Letters,
                    _currentStyle.TextEmphasysDot);

                _buffer.Add(newFragment);
                _accumulatedGlue = default(GlueProperty);
            }
 public JapaneseLetterFragment(
     GlueProperty beforeGlue,
     float contentLength,
     string content,
     TextEmphasysDot textEmphasysDot)
 {
     BeforeGlue       = beforeGlue;
     ContentLength    = contentLength;
     Content          = content;
     _textEmphasysDot = textEmphasysDot;
 }
Пример #9
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);
        }
Пример #10
0
        public static UnjustifiedLine Solve(
            LineBreaking.ILineConstraint constraint,
            GlueProperty startGlue,
            IEnumerable <IFormatObject> objectList,
            GlueProperty endGlue,
            float penaltyValue,
            Heading heading,
            InlineStyle style,
            out InlineStyle newStyle)
        {
            IFragment[] fragments          = ConvertToFragments(ref startGlue, objectList, ref endGlue, style, out newStyle);
            var         rubyLayoutedBuffer = LayoutRubyInLine(constraint, fragments, endGlue.Length);

            return(new UnjustifiedLine(rubyLayoutedBuffer, penaltyValue, heading));
        }
        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));
        }
Пример #12
0
 public LatinInterwordSpace(GlueProperty glue)
 {
     Glue = glue;
 }
Пример #13
0
 public JapaneseInterletterspace(
     GlueProperty glue,
     GlueProperty glueBeforeBreak,
     float indentAfterBreak,
     bool isBreakProhibited)
 {
     Glue = glue;
     GlueBeforeBreak = glueBeforeBreak;
     IndentAfterBreak = indentAfterBreak;
     _penalty = isBreakProhibited ? LineBreaking.Constants.PenaltyInfinity : 0;
 }
Пример #14
0
 public JapaneseEndOfLineSpace(GlueProperty finalGlue)
 {
     _finalGlue = finalGlue;
 }
            private static UnjustifiedLine.JapaneseLetterFragment[] GenerateFragments(InlineStyle style, IFormatObject[] objects, GlueProperty startGlue)
            {
                Context baseContext = new Context(style, objects.Length);

                baseContext.PutGlue(startGlue);
                foreach (var x in objects)
                {
                    baseContext.Put(x);
                }
                try
                {
                    return(Array.ConvertAll(baseContext.Buffer, x => (UnjustifiedLine.JapaneseLetterFragment)x));
                }
                catch (Exception ex)
                {
                    throw new NotImplementedException("texts both with formatting and with ruby is not supported", ex);
                }
            }
Пример #16
0
 public EndOfLinePsuedoFragment(GlueProperty glue)
 {
     _glue = glue;
 }
Пример #17
0
 public JapaneseEndOfLineSpace(GlueProperty finalGlue)
 {
     _finalGlue = finalGlue;
 }
Пример #18
0
 public Context(InlineStyle style, int capacity)
 {
     _buffer          = new List <InlineLayoutEngine.IFragment>(capacity);
     _accumulatedGlue = default(GlueProperty);
     _currentStyle    = style;
 }
Пример #19
0
 public LatinInterwordSpace(GlueProperty glue)
 {
     Glue = glue;
 }
 public UnjustifiedLine(IFragment[] fragmentList, GlueProperty endGlue, float penaltyValue)
 {
     _fragmentList = (IFragment[])fragmentList.Clone();
     _endGlue      = endGlue;
     _penaltyValue = penaltyValue;
 }
Пример #21
0
            private static InlineLayoutEngine.AtomicFragment[] GenerateFragments(InlineStyle style, IFormatObject[] objects, GlueProperty startGlue)
            {
                Context baseContext = new Context(style, objects.Length);

                baseContext.PutGlue(startGlue);
                foreach (var x in objects)
                {
                    baseContext.Put(x);
                }
                try
                {
                    return(baseContext._buffer.ConvertAll(x => (InlineLayoutEngine.AtomicFragment)x).ToArray());
                }
                catch (Exception ex)
                {
                    throw new NotImplementedException("texts both with formatting and with ruby is not supported", ex);
                }
            }
Пример #22
0
 public void PutGlue(GlueProperty glue)
 {
     _accumulatedGlue += glue;
 }