Exemplo n.º 1
0
 void InitializeFontProperties()
 {
     var textRunProps = CreateHexTextRunProperties();
     var paraProps = CreateHexTextParagraphProperties(textRunProps);
     var hexLine = new HexLine(0, 0, "O", new HexLinePart[1] { new HexLinePart(0, 1, textRunProps) });
     var hexLineTextSource = new HexLineTextSource(hexLine);
     using (var textLine = textFormatter.FormatLine(hexLineTextSource, 0, 10000, paraProps, null)) {
         characterWidth = textLine.Width;
         characterHeight = textLine.Height;
     }
 }
Exemplo n.º 2
0
        HexLine GetHexLine(ulong offset, List<HexLinePart> parts, TextRunProperties textRunProps, TextParagraphProperties paraProps, StringBuilder sb, StringBuilder sb2, double width, short[] bytesAry)
        {
            HexLine hexLine;
            if (offsetToLine.TryGetValue(offset, out hexLine))
                return hexLine;

            hexLine = CreateHexLine(offset, EndOffset, parts, textRunProps, sb, sb2, bytesAry);
            offsetToLine.Add(offset, hexLine);
            var hexLineTextSource = new HexLineTextSource(hexLine);
            var textLines = new List<TextLine>();
            int textOffset = 0;
            const int newLineLength = 1;
            TextLineBreak previousLineBreak = null;
            for (;;) {
                var textLine = textFormatter.FormatLine(hexLineTextSource, 0, width, paraProps, previousLineBreak);
                textLines.Add(textLine);
                textOffset += textLine.Length;

                if (textOffset >= hexLine.Length + newLineLength)
                    break;
                previousLineBreak = textLine.GetTextLineBreak();
            }
            hexLine.TextLines = textLines.ToArray();

            return hexLine;
        }