Esempio n. 1
0
		void Add(List<HexLinePart> parts, StringBuilder sb, string s, TextRunProperties textRunProperties, Brush brush) {
			var trp = new HexTextRunProperties(textRunProperties);

			if (brush != null)
				trp._ForegroundBrush = brush;

			// Merge if possible
			bool merged = false;
			if (parts.Count > 0) {
				var last = parts[parts.Count - 1];
				if (HexTextRunProperties.Equals(last.TextRunProperties, trp)) {
					last.Length += s.Length;
					merged = true;
				}
			}
			if (!merged)
				parts.Add(new HexLinePart(sb.Length, s.Length, trp));
			sb.Append(s);
		}
Esempio n. 2
0
		HexTextRunProperties CreateHexTextRunProperties() {
			var textRunProps = new HexTextRunProperties();
			textRunProps._Typeface = new Typeface((FontFamily)GetValue(FontFamilyProperty),
								(FontStyle)GetValue(FontStyleProperty),
								(FontWeight)GetValue(FontWeightProperty),
								(FontStretch)GetValue(FontStretchProperty));
			textRunProps._FontRenderingEmSize = (double)GetValue(FontSizeProperty);
			textRunProps._FontHintingEmSize = (double)GetValue(FontSizeProperty);
			textRunProps._ForegroundBrush = (Brush)GetValue(ForegroundProperty);
			textRunProps._CultureInfo = CultureInfo.CurrentUICulture;
			return textRunProps;
		}