示例#1
0
        private Rect DrawIndexedGlyphRun(DrawingContext drawingContext, IndexedGlyphRun indexedrun, Point linePosition, JapaneseTextSource source, bool isVerticalWriting)
        {
            GlyphRun run;

            if (isVerticalWriting)
            {
                List <double> advanceWidths = new List <double>();
                int[]         advance2      = source.Advance;
                for (int i = 0; i < advance2.Length; i++)
                {
                    int advance = advance2[i];
                    advanceWidths.Add((double)advance);
                }
                run = new GlyphRun(indexedrun.GlyphRun.GlyphTypeface, indexedrun.GlyphRun.BidiLevel, true, indexedrun.GlyphRun.FontRenderingEmSize, source.Glyphs, linePosition, indexedrun.GlyphRun.AdvanceWidths, indexedrun.GlyphRun.GlyphOffsets, indexedrun.GlyphRun.Characters, indexedrun.GlyphRun.DeviceFontName, indexedrun.GlyphRun.ClusterMap, indexedrun.GlyphRun.CaretStops, indexedrun.GlyphRun.Language);
            }
            else
            {
                run = new GlyphRun(indexedrun.GlyphRun.GlyphTypeface, indexedrun.GlyphRun.BidiLevel, false, indexedrun.GlyphRun.FontRenderingEmSize, indexedrun.GlyphRun.GlyphIndices, linePosition, indexedrun.GlyphRun.AdvanceWidths, indexedrun.GlyphRun.GlyphOffsets, indexedrun.GlyphRun.Characters, indexedrun.GlyphRun.DeviceFontName, indexedrun.GlyphRun.ClusterMap, indexedrun.GlyphRun.CaretStops, indexedrun.GlyphRun.Language);
            }
            drawingContext.DrawGlyphRun(source.JapaneseTextRunProperties.ForegroundBrush, run);
            return(run.ComputeAlignmentBox());
        }
示例#2
0
 public void UniscribeIndexedGlyphRun(IndexedGlyphRun indexedGlyphRun)
 {
     this._glyphCount = 0;
     this._logClust   = null;
     this._charProps  = null;
     this._glyphs     = null;
     this._glyphProps = null;
     this._advance    = null;
     this._goffset    = null;
     this._abc        = null;
     if (this._itemsCount > 0)
     {
         for (int index = 0; index < this._itemsCount - 1; index++)
         {
             if (this._items[index].iCharPos <= indexedGlyphRun.TextSourceCharacterIndex && this._items[index + 1].iCharPos > indexedGlyphRun.TextSourceCharacterIndex)
             {
                 this.UniscribeScriptShapeOpenType(this.Text, index, indexedGlyphRun.TextSourceCharacterIndex, indexedGlyphRun.TextSourceLength);
                 this.UniscribeScriptPlaceOpenType(this.Text, index, indexedGlyphRun.TextSourceCharacterIndex, indexedGlyphRun.TextSourceLength);
             }
         }
         this.UniscribeScriptShapeOpenType(this.Text, this._itemsCount - 1, indexedGlyphRun.TextSourceCharacterIndex, indexedGlyphRun.TextSourceLength);
         this.UniscribeScriptPlaceOpenType(this.Text, this._itemsCount - 1, indexedGlyphRun.TextSourceCharacterIndex, indexedGlyphRun.TextSourceLength);
     }
 }