private void ConvertStringToTextRuns(DefineEditTextTag tag, List<TextRun> runs) { string s = (tag.InitialText == null) ? "" : tag.InitialText; string[] sts = s.Split('\r'); // seems to be the only gen'd linebreak string fontName = ""; if (swf.Fonts.ContainsKey(tag.FontID)) { fontName = swf.Fonts[tag.FontID].FontName; } Color c = ParseRGBA(tag.TextColor); bool isMultiline = sts.Length > 1; for (int i = 0; i < sts.Length; i++) { TextRun tr = new TextRun(); tr.isEditable = true; tr.isSelectable = true; tr.Color = c; tr.isMultiline = isMultiline; if(tag.HasFont) { tr.FontName = fontName; } tr.FontSize = tag.FontHeight / 20; tr.Text = sts[i]; runs.Add(tr); } }
private void ParseEditText(DefineEditTextTag tag) { Text t = new Text(v.NextId()); t.Id = tag.CharacterID; t.StrokeBounds = ParseRect(tag.Bounds); t.Matrix = Vex.Matrix.Identity; ConvertStringToTextRuns(tag, t.TextRuns); v.Definitions.Add(t.Id, t); }