private void SetUndefinedScript() { ScriptAnalysis scriptAnalysis = ScriptAnalysis; if (scriptAnalysis.eScript != 0) { m_itemizedScriptId = scriptAnalysis.eScript; scriptAnalysis.eScript = 0; SCRIPT_ANALYSIS = scriptAnalysis.GetAs_SCRIPT_ANALYSIS(); m_scriptAnalysis = null; } }
internal TexRunShapeData(TextRun run, bool storeGlyph) { if (storeGlyph && run.GlyphData != null) { m_glyphData = run.GlyphData.GlyphScriptShapeData; } m_analysis = run.SCRIPT_ANALYSIS; m_scriptLogAttr = run.ScriptLogAttr; m_cachedFont = run.CachedFont; m_runState = run.State; m_itemizedScriptId = run.ItemizedScriptId; }
internal TextRun(string text, TextRun textRun, SCRIPT_LOGATTR[] scriptLogAttr) : this(text, textRun) { SCRIPT_ANALYSIS = textRun.SCRIPT_ANALYSIS; ScriptLogAttr = scriptLogAttr; m_cachedFont = textRun.CachedFont; m_itemizedScriptId = textRun.ItemizedScriptId; bool hasEastAsianChars = HasEastAsianChars; m_runState = textRun.State; HasEastAsianChars = hasEastAsianChars; }
internal TextRun(string text, ITextRunProps props, TexRunShapeData shapeData) : this(text, props) { if (shapeData != null) { SCRIPT_ANALYSIS = shapeData.Analysis; ScriptLogAttr = shapeData.ScriptLogAttr; m_cachedFont = shapeData.Font; m_itemizedScriptId = shapeData.ItemizedScriptId; m_runState = shapeData.State; if (shapeData.GlyphData != null) { m_cachedGlyphData = new GlyphData(shapeData.GlyphData); } } }
private static void AnalyzeForBreakPositions(List <TextRun> itemRuns, string itemsText) { if (itemsText.Length != 0) { SCRIPT_ANALYSIS psa = itemRuns[0].SCRIPT_ANALYSIS; SCRIPT_LOGATTR[] array = new SCRIPT_LOGATTR[itemsText.Length]; int num = Win32.ScriptBreak(itemsText, itemsText.Length, ref psa, 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; } } }
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 < m_runs.Count; i++) { TextRun textRun2 = 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 == m_runs.Count - 1 && textRun.Text[0] == '\n') { textRun = textRun2.GetSubRun(num3 + 1, 0); textRun.SCRIPT_ANALYSIS = analysis; list.Add(textRun); } AnalyzeForBreakPositions(list, stringBuilder.ToString()); return(list); } textRun = textRun2.GetSubRun(num3); textRun.SCRIPT_ANALYSIS = analysis; stringBuilder.Append(textRun.Text); list.Add(textRun); } num = num2 + 1; } AnalyzeForBreakPositions(list, stringBuilder.ToString()); return(list); }
internal 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);
internal 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);
internal 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);
internal static extern int ScriptBreak([MarshalAs(UnmanagedType.LPWStr)] string pwcChars, int cChars, ref SCRIPT_ANALYSIS psa, [Out][MarshalAs(UnmanagedType.LPArray)] SCRIPT_LOGATTR[] psla);
internal 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);
internal 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);