public TexRunShapeData(TextRun run, bool storeGlyph)
 {
     if (storeGlyph && run.GlyphData != null)
     {
         this.m_glyphData = run.GlyphData.GlyphScriptShapeData;
     }
     this.m_analysis         = run.SCRIPT_ANALYSIS;
     this.m_scriptLogAttr    = run.ScriptLogAttr;
     this.m_cachedFont       = run.CachedFont;
     this.m_runState         = run.State;
     this.m_itemizedScriptId = run.ItemizedScriptId;
 }
Exemplo n.º 2
0
        private void SetUndefinedScript()
        {
            ScriptAnalysis scriptAnalysis = this.ScriptAnalysis;

            if (scriptAnalysis.eScript != 0)
            {
                this.m_itemizedScriptId = scriptAnalysis.eScript;
                scriptAnalysis.eScript  = 0;
                this.SCRIPT_ANALYSIS    = scriptAnalysis.GetAs_SCRIPT_ANALYSIS();
                this.m_scriptAnalysis   = null;
            }
        }
Exemplo n.º 3
0
        public TextRun(string text, TextRun textRun, SCRIPT_LOGATTR[] scriptLogAttr)
            : this(text, textRun)
        {
            this.SCRIPT_ANALYSIS    = textRun.SCRIPT_ANALYSIS;
            this.ScriptLogAttr      = scriptLogAttr;
            this.m_cachedFont       = textRun.CachedFont;
            this.m_itemizedScriptId = textRun.ItemizedScriptId;
            bool hasEastAsianChars = this.HasEastAsianChars;

            this.m_runState        = textRun.State;
            this.HasEastAsianChars = hasEastAsianChars;
        }
Exemplo n.º 4
0
 public TextRun(string text, ITextRunProps props, TexRunShapeData shapeData)
     : this(text, props)
 {
     if (shapeData != null)
     {
         this.SCRIPT_ANALYSIS    = shapeData.Analysis;
         this.ScriptLogAttr      = shapeData.ScriptLogAttr;
         this.m_cachedFont       = shapeData.Font;
         this.m_itemizedScriptId = shapeData.ItemizedScriptId;
         this.m_runState         = shapeData.State;
         if (shapeData.GlyphData != null)
         {
             this.m_cachedGlyphData = new GlyphData(shapeData.GlyphData);
         }
     }
 }
Exemplo n.º 5
0
 private static void AnalyzeForBreakPositions(List <TextRun> itemRuns, string itemsText)
 {
     if (itemsText.Length != 0)
     {
         SCRIPT_ANALYSIS  sCRIPT_ANALYSIS = itemRuns[0].SCRIPT_ANALYSIS;
         SCRIPT_LOGATTR[] array           = new SCRIPT_LOGATTR[itemsText.Length];
         int num = Win32.ScriptBreak(itemsText, itemsText.Length, ref sCRIPT_ANALYSIS, array);
         if (Win32.Failed(num))
         {
             Marshal.ThrowExceptionForHR(num);
         }
         int num2 = 0;
         for (int i = 0; i < itemRuns.Count; i++)
         {
             TextRun          textRun = itemRuns[i];
             int              length  = textRun.Text.Length;
             SCRIPT_LOGATTR[] array2  = new SCRIPT_LOGATTR[length];
             Array.Copy(array, num2, array2, 0, length);
             textRun.ScriptLogAttr = array2;
             num2 += length;
         }
     }
 }
Exemplo n.º 6
0
        private List <TextRun> ExtractRuns(int startingParaCharIndex, int endingParaCharIndex, SCRIPT_ANALYSIS analysis)
        {
            List <TextRun> list          = new List <TextRun>();
            StringBuilder  stringBuilder = new StringBuilder();
            int            num           = 0;
            int            num2          = 0;
            TextRun        textRun       = null;

            for (int i = 0; i < this.m_runs.Count; i++)
            {
                TextRun textRun2 = this.m_runs[i];
                num2 = num + textRun2.CharacterCount - 1;
                int num3 = -1;
                if (startingParaCharIndex <= num)
                {
                    num3 = 0;
                }
                else if (startingParaCharIndex <= num2)
                {
                    num3 = startingParaCharIndex - num;
                }
                if (num3 >= 0)
                {
                    if (endingParaCharIndex <= num2)
                    {
                        int num4 = endingParaCharIndex - num - num3 + 1;
                        textRun = textRun2.GetSubRun(num3, num4);
                        textRun.SCRIPT_ANALYSIS = analysis;
                        stringBuilder.Append(textRun.Text);
                        list.Add(textRun);
                        if (endingParaCharIndex == num2 && num4 == 1 && i == this.m_runs.Count - 1 && textRun.Text[0] == '\n')
                        {
                            textRun = textRun2.GetSubRun(num3 + 1, 0);
                            textRun.SCRIPT_ANALYSIS = analysis;
                            list.Add(textRun);
                        }
                        Paragraph.AnalyzeForBreakPositions(list, stringBuilder.ToString());
                        return(list);
                    }
                    textRun = textRun2.GetSubRun(num3);
                    textRun.SCRIPT_ANALYSIS = analysis;
                    stringBuilder.Append(textRun.Text);
                    list.Add(textRun);
                }
                num = num2 + 1;
            }
            Paragraph.AnalyzeForBreakPositions(list, stringBuilder.ToString());
            return(list);
        }
Exemplo n.º 7
0
 public static extern int ScriptTextOut(Win32DCSafeHandle hdc, ref ScriptCacheSafeHandle psc, int x, int y, uint fuOptions, IntPtr lprc, ref SCRIPT_ANALYSIS psa, IntPtr pwcReserved, int iReserved, [MarshalAs(UnmanagedType.LPArray)] short[] pwGlyphs, int cGlyphs, [MarshalAs(UnmanagedType.LPArray)] int[] piAdvance, [MarshalAs(UnmanagedType.LPArray)] int[] piJustify, [MarshalAs(UnmanagedType.LPArray)] GOFFSET[] pGoffset);
Exemplo n.º 8
0
 public static extern int ScriptPlace(Win32DCSafeHandle hdc, ref ScriptCacheSafeHandle psc, [MarshalAs(UnmanagedType.LPArray)] short[] pwGlyphs, int cGlyphs, [MarshalAs(UnmanagedType.LPArray)] SCRIPT_VISATTR[] psva, ref SCRIPT_ANALYSIS psa, [MarshalAs(UnmanagedType.LPArray)] int[] piAdvance, [Out][MarshalAs(UnmanagedType.LPArray)] GOFFSET[] pGoffset, ref ABC pABC);
Exemplo n.º 9
0
 public static extern int ScriptShape(Win32DCSafeHandle hdc, ref ScriptCacheSafeHandle psc, [MarshalAs(UnmanagedType.LPWStr)] string pwcChars, int cChars, int cMaxGlyphs, ref SCRIPT_ANALYSIS psa, [Out][MarshalAs(UnmanagedType.LPArray)] short[] pwOutGlyphs, [Out][MarshalAs(UnmanagedType.LPArray)] short[] pwLogClust, [Out][MarshalAs(UnmanagedType.LPArray)] SCRIPT_VISATTR[] psva, ref int pcGlyphs);
Exemplo n.º 10
0
 public static extern int ScriptBreak([MarshalAs(UnmanagedType.LPWStr)] string pwcChars, int cChars, ref SCRIPT_ANALYSIS psa, [Out][MarshalAs(UnmanagedType.LPArray)] SCRIPT_LOGATTR[] psla);
Exemplo n.º 11
0
 public static extern int ScriptGetLogicalWidths(ref SCRIPT_ANALYSIS psa, int cChars, int cGlyphs, int[] piGlyphWidth, short[] pwLogClust, SCRIPT_VISATTR[] psva, [Out][MarshalAs(UnmanagedType.LPArray)] int[] piDx);
Exemplo n.º 12
0
 public static extern int ScriptCPtoX(int iCP, bool fTrailing, int cChars, int cGlyphs, [MarshalAs(UnmanagedType.LPArray)] short[] pwLogClust, [MarshalAs(UnmanagedType.LPArray)] SCRIPT_VISATTR[] psva, [MarshalAs(UnmanagedType.LPArray)] int[] piAdvance, ref SCRIPT_ANALYSIS psa, ref int piX);