// Token: 0x06002FD3 RID: 12243 RVA: 0x000D75E4 File Offset: 0x000D57E4 private bool ReadGlyphIndex(string valueSpec, ref bool inCluster, ref int glyphClusterSize, ref int characterClusterSize, ref ushort glyphIndex) { string s = valueSpec; int num = valueSpec.IndexOf('('); if (num != -1) { for (int i = 0; i < num; i++) { if (!char.IsWhiteSpace(valueSpec[i])) { throw new ArgumentException(SR.Get("GlyphsClusterBadCharactersBeforeBracket")); } } if (inCluster) { throw new ArgumentException(SR.Get("GlyphsClusterNoNestedClusters")); } int num2 = valueSpec.IndexOf(')'); if (num2 == -1 || num2 <= num + 1) { throw new ArgumentException(SR.Get("GlyphsClusterNoMatchingBracket")); } int num3 = valueSpec.IndexOf(':'); if (num3 == -1) { string s2 = valueSpec.Substring(num + 1, num2 - (num + 1)); characterClusterSize = int.Parse(s2, CultureInfo.InvariantCulture); glyphClusterSize = 1; } else { if (num3 <= num + 1 || num3 >= num2 - 1) { throw new ArgumentException(SR.Get("GlyphsClusterMisplacedSeparator")); } string s3 = valueSpec.Substring(num + 1, num3 - (num + 1)); characterClusterSize = int.Parse(s3, CultureInfo.InvariantCulture); string s4 = valueSpec.Substring(num3 + 1, num2 - (num3 + 1)); glyphClusterSize = int.Parse(s4, CultureInfo.InvariantCulture); } inCluster = true; s = valueSpec.Substring(num2 + 1); } if (Glyphs.IsEmpty(s)) { return(false); } glyphIndex = ushort.Parse(s, CultureInfo.InvariantCulture); return(true); }
// Token: 0x06002FD7 RID: 12247 RVA: 0x000D7794 File Offset: 0x000D5994 private int ParseGlyphsProperty(GlyphTypeface fontFace, string unicodeString, bool sideways, out List <Glyphs.ParsedGlyphData> parsedGlyphs, out ushort[] clusterMap) { string indices = this.Indices; int num = 0; int i = 0; int num2 = 1; int num3 = 1; bool flag = false; int num4; if (!string.IsNullOrEmpty(unicodeString)) { clusterMap = new ushort[unicodeString.Length]; num4 = unicodeString.Length; } else { clusterMap = null; num4 = 8; } if (!string.IsNullOrEmpty(indices)) { num4 = Math.Max(num4, indices.Length / 5); } parsedGlyphs = new List <Glyphs.ParsedGlyphData>(num4); Glyphs.ParsedGlyphData parsedGlyphData = new Glyphs.ParsedGlyphData(); if (!string.IsNullOrEmpty(indices)) { int num5 = 0; int num6 = 0; for (int j = 0; j <= indices.Length; j++) { char c = (j < indices.Length) ? indices[j] : '\0'; if (c == ',' || c == ';' || j == indices.Length) { int length = j - num6; string text = indices.Substring(num6, length); switch (num5) { case 0: { bool flag2 = flag; if (!this.ReadGlyphIndex(text, ref flag, ref num3, ref num2, ref parsedGlyphData.glyphIndex)) { if (string.IsNullOrEmpty(unicodeString)) { throw new ArgumentException(SR.Get("GlyphsIndexRequiredIfNoUnicode")); } if (unicodeString.Length <= i) { throw new ArgumentException(SR.Get("GlyphsUnicodeStringIsTooShort")); } parsedGlyphData.glyphIndex = this.GetGlyphFromCharacter(fontFace, unicodeString[i]); } if (!flag2 && clusterMap != null) { if (flag) { for (int k = i; k < i + num2; k++) { Glyphs.SetClusterMapEntry(clusterMap, k, (ushort)num); } } else { Glyphs.SetClusterMapEntry(clusterMap, i, (ushort)num); } } parsedGlyphData.advanceWidth = Glyphs.GetAdvanceWidth(fontFace, parsedGlyphData.glyphIndex, sideways); break; } case 1: if (!Glyphs.IsEmpty(text)) { parsedGlyphData.advanceWidth = double.Parse(text, CultureInfo.InvariantCulture); if (parsedGlyphData.advanceWidth < 0.0) { throw new ArgumentException(SR.Get("GlyphsAdvanceWidthCannotBeNegative")); } } break; case 2: if (!Glyphs.IsEmpty(text)) { parsedGlyphData.offsetX = double.Parse(text, CultureInfo.InvariantCulture); } break; case 3: if (!Glyphs.IsEmpty(text)) { parsedGlyphData.offsetY = double.Parse(text, CultureInfo.InvariantCulture); } break; default: throw new ArgumentException(SR.Get("GlyphsTooManyCommas")); } num5++; num6 = j + 1; } if (c == ';' || j == indices.Length) { parsedGlyphs.Add(parsedGlyphData); parsedGlyphData = new Glyphs.ParsedGlyphData(); if (flag) { num3--; if (num3 == 0) { i += num2; flag = false; } } else { i++; } num++; num5 = 0; num6 = j + 1; } } } if (unicodeString != null) { while (i < unicodeString.Length) { if (flag) { throw new ArgumentException(SR.Get("GlyphsIndexRequiredWithinCluster")); } if (unicodeString.Length <= i) { throw new ArgumentException(SR.Get("GlyphsUnicodeStringIsTooShort")); } parsedGlyphData.glyphIndex = this.GetGlyphFromCharacter(fontFace, unicodeString[i]); parsedGlyphData.advanceWidth = Glyphs.GetAdvanceWidth(fontFace, parsedGlyphData.glyphIndex, sideways); parsedGlyphs.Add(parsedGlyphData); parsedGlyphData = new Glyphs.ParsedGlyphData(); Glyphs.SetClusterMapEntry(clusterMap, i, (ushort)num); i++; num++; } } return(num); }