You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
I'm looking toward hiding part of a line, similarly to visually replacing a text with passwords char (• or *).
What is the best way to do that? Here's my "base code" so far:
publicclassTokenMasker:DocumentColorizingTransformer{protectedoverridevoidColorizeLine(DocumentLineline){if(!line.IsDeleted){varlineText= CurrentContext.Document.GetText(line).TrimStart();if(!lineText.StartsWith("token: "))return;varstart= line.Offset + lineText.IndexOf("token: ");
ChangeLinePart(start, line.EndOffset, ApplyChanges);}}privatevoidApplyChanges(VisualLineElementelement){// what to apply here?
element.TextRunProperties.SetTypeface(...);// this do not work, see below}}
I tried using a custom font, to use in TextRunProperties.SetTypeface (with only dots glyph), but Avalonia is dumb when we have to load a font dynamically (as I cannot do it another way), and it simply doesn't work
Is there a way to visually replace the text of the line? (without changing its actual content)
Can I create my decorations somehow, to override the drawing characters?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there!
I'm looking toward hiding part of a line, similarly to visually replacing a text with passwords char (• or *).
What is the best way to do that? Here's my "base code" so far:
TextRunProperties.SetTypeface
(with only dots glyph), but Avalonia is dumb when we have to load a font dynamically (as I cannot do it another way), and it simply doesn't workI appreciate any help you can provide :)
Beta Was this translation helpful? Give feedback.
All reactions