GetRunIter() приватный Метод

private GetRunIter ( ) : IEnumerable
Результат IEnumerable
Пример #1
0
 internal static CssRun GetCssRunOnLocation(CssLineBox lineBox, int x, int y)
 {
     foreach (CssRun word in lineBox.GetRunIter())
     {
         // add word spacing to word width so sentance won't have hols in it when moving the mouse
         var rect = word.Rectangle;
         //rect.Width += word.OwnerBox.ActualWordSpacing;
         if (rect.Contains(x, y))
         {
             return(word);
         }
     }
     return(null);
 }
Пример #2
0
 internal static CssRun GetCssRunOnLocation(CssLineBox lineBox, int x, int y)
 {
     foreach (CssRun word in lineBox.GetRunIter())
     {
         // add word spacing to word width so sentance won't have hols in it when moving the mouse
         var rect = word.Rectangle;
         //rect.Width += word.OwnerBox.ActualWordSpacing;
         if (rect.Contains(x, y))
         {
             return word;
         }
     }
     return null;
 }
Пример #3
0
 /// <summary>
 /// Applies right alignment to the text on the linebox
 /// </summary>
 /// <param name="g"></param>
 /// <param name="line"></param>
 static void ApplyRightAlignment(CssLineBox line)
 {
     if (line.RunCount == 0)
     {
         return;
     }
     CssRun lastRun = line.GetLastRun();
     float diff = line.OwnerBox.GetClientWidth() - line.GetLastRun().Right;
     if (diff > CSS_OFFSET_THRESHOLD)
     {
         foreach (CssRun word in line.GetRunIter())
         {
             word.Left += diff;
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Applies centered alignment to the text on the linebox
 /// </summary>
 /// <param name="g"></param>
 /// <param name="line"></param>
 static void ApplyCenterAlignment(CssLineBox line)
 {
     if (line.RunCount == 0) return;
     CssRun lastRun = line.GetLastRun();
     float diff = (line.OwnerBox.GetClientWidth() - lastRun.Right) / 2;
     if (diff > CSS_OFFSET_THRESHOLD)
     {
         foreach (CssRun word in line.GetRunIter())
         {
             word.Left += diff;
         }
         line.CachedLineContentWidth += diff;
     }
 }
Пример #5
0
        static void ApplyJustifyAlignment(CssLineBox lineBox)
        {
            if (lineBox.IsLastLine) return;
            float indent = lineBox.IsFirstLine ? lineBox.OwnerBox.ActualTextIndent : 0f;
            float runWidthSum = 0f;
            int runCount = 0;
            float availableWidth = lineBox.OwnerBox.GetClientWidth() - indent;
            // Gather text sum
            foreach (CssRun w in lineBox.GetRunIter())
            {
                runWidthSum += w.Width;
                runCount++;
            }

            if (runCount == 0) return; //Avoid Zero division
            float spaceOfEachRun = (availableWidth - runWidthSum) / runCount; //Spacing that will be used
            float cX = lineBox.OwnerBox.GetClientLeft() + indent;
            CssRun lastRun = lineBox.GetLastRun();
            foreach (CssRun run in lineBox.GetRunIter())
            {
                run.Left = cX;
                cX = run.Right + spaceOfEachRun;
                if (run == lastRun)
                {
                    run.Left = lineBox.OwnerBox.GetClientRight() - run.Width;
                }
            }
        }
Пример #6
0
 /// <summary>
 /// Applies right to left direction to words
 /// </summary>
 /// <param name="blockBox"></param>
 /// <param name="lineBox"></param>
 static void ApplyRightToLeft(CssLineBox lineBox)
 {
     if (lineBox.RunCount > 0)
     {
         float left = lineBox.GetFirstRun().Left;
         float right = lineBox.GetLastRun().Right;
         foreach (CssRun run in lineBox.GetRunIter())
         {
             float diff = run.Left - left;
             float w_right = right - diff;
             run.Left = w_right - run.Width;
         }
     }
 }