()
| 28 | } |
| 29 | |
| 30 | func makeAttributedString() { |
| 31 | attrstr = ui.NewAttributedString( |
| 32 | "Drawing strings with package ui is done with the ui.AttributedString and ui.DrawTextLayout objects.\n" + |
| 33 | "ui.AttributedString lets you have a variety of attributes: ") |
| 34 | |
| 35 | appendWithAttributes("font family", ui.TextFamily("Courier New")) |
| 36 | attrstr.AppendUnattributed(", ") |
| 37 | |
| 38 | appendWithAttributes("font size", ui.TextSize(18)) |
| 39 | attrstr.AppendUnattributed(", ") |
| 40 | |
| 41 | appendWithAttributes("font weight", ui.TextWeightBold) |
| 42 | attrstr.AppendUnattributed(", ") |
| 43 | |
| 44 | appendWithAttributes("font italicness", ui.TextItalicItalic) |
| 45 | attrstr.AppendUnattributed(", ") |
| 46 | |
| 47 | appendWithAttributes("font stretch", ui.TextStretchCondensed) |
| 48 | attrstr.AppendUnattributed(", ") |
| 49 | |
| 50 | appendWithAttributes("text color", ui.TextColor{0.75, 0.25, 0.5, 0.75}) |
| 51 | attrstr.AppendUnattributed(", ") |
| 52 | |
| 53 | appendWithAttributes("text background color", ui.TextBackground{0.5, 0.5, 0.25, 0.5}) |
| 54 | attrstr.AppendUnattributed(", ") |
| 55 | |
| 56 | appendWithAttributes("underline style", ui.UnderlineSingle) |
| 57 | attrstr.AppendUnattributed(", ") |
| 58 | |
| 59 | attrstr.AppendUnattributed("and ") |
| 60 | appendWithAttributes("underline color", |
| 61 | ui.UnderlineDouble, |
| 62 | ui.UnderlineColorCustom{1.0, 0.0, 0.5, 1.0}) |
| 63 | attrstr.AppendUnattributed(". ") |
| 64 | |
| 65 | attrstr.AppendUnattributed("Furthermore, there are attributes allowing for ") |
| 66 | appendWithAttributes("special underlines for indicating spelling errors", |
| 67 | ui.UnderlineSuggestion, |
| 68 | ui.UnderlineColorSpelling) |
| 69 | attrstr.AppendUnattributed(" (and other types of errors) ") |
| 70 | |
| 71 | attrstr.AppendUnattributed("and control over OpenType features such as ligatures (for instance, ") |
| 72 | appendWithAttributes("afford", ui.OpenTypeFeatures{ |
| 73 | ui.ToOpenTypeTag('l', 'i', 'g', 'a'): 0, |
| 74 | }) |
| 75 | attrstr.AppendUnattributed(" vs. ") |
| 76 | appendWithAttributes("afford", ui.OpenTypeFeatures{ |
| 77 | ui.ToOpenTypeTag('l', 'i', 'g', 'a'): 1, |
| 78 | }) |
| 79 | attrstr.AppendUnattributed(").\n") |
| 80 | |
| 81 | attrstr.AppendUnattributed("Use the controls opposite to the text to control properties of the text.") |
| 82 | } |
| 83 | |
| 84 | type areaHandler struct{} |
| 85 |
no test coverage detected