示例#1
0
        void JustifyLine(CanvasTextAnalyzer textAnalyzer, LayoutBox layoutBox)
        {
            CanvasGlyph[] allGlyphs;
            var           justificationOpportunities = GetJustificationOpportunities(textAnalyzer, layoutBox, out allGlyphs);

            CanvasGlyph[] justifiedGlyphs = textAnalyzer.ApplyJustificationOpportunities(
                (float)layoutBox.Rectangle.Width,
                justificationOpportunities,
                allGlyphs);

            bool needsJustificationCharacters = layoutBox.GlyphRuns[0].FormattingSpan.NeedsAdditionalJustificationCharacters;

            SplitJustifiedGlyphsIntoRuns(textAnalyzer, layoutBox, justifiedGlyphs, needsJustificationCharacters);
        }
示例#2
0
        void JustifyLine(CanvasTextAnalyzer textAnalyzer, List <GlyphRun> glyphRuns, int startingGlyphRunIndex, int endingGlyphRunIndex, float layoutWidth, int glyphCountForLine)
        {
            CanvasGlyph[] allGlyphs;
            var           justificationOpportunities = GetJustificationOpportunities(textAnalyzer, startingGlyphRunIndex, endingGlyphRunIndex, glyphCountForLine, out allGlyphs);

            CanvasGlyph[] justifiedGlyphs = textAnalyzer.ApplyJustificationOpportunities(
                layoutWidth,
                justificationOpportunities,
                allGlyphs);

            bool needsJustificationCharacters = glyphRuns[startingGlyphRunIndex].FormattingSpan.NeedsAdditionalJustificationCharacters;

            SplitJustifiedGlyphsIntoRuns(textAnalyzer, startingGlyphRunIndex, endingGlyphRunIndex, justifiedGlyphs, needsJustificationCharacters);
        }