How do I generate glyph paths for strings containing characters that cannot be combined? #388
-
Hi. Thank you for fixing the WordBreaking.BreakAll and WrappingLength issues previously. I am currently developing a function to randomly shift and draw the code point of each character in an input string. The following is a sample of the image we would like to generate with this feature, although it is a mock-up created in After Effects. sample.mp4Stacktrace
Steps to Reproduceusing SixLabors.Fonts;
using System.Numerics;
using System.Text;
var TaiLeCharacter = new Rune(0x195C); // ᥜ
var SundaneseCharacter = new Rune(0x1B9B); // ᮛ
var TifinaghCharacter = new Rune(0x2D43); // ⵃ
var ChamCharacter = new Rune(0xAA43); // ꩃ
var LatainCharacter = new Rune(0x0041); // A
var HiraganaCharacter = new Rune(0x3042); // あ
var fontFamily = SystemFonts.Get("Yu Gothic");
var font = fontFamily.CreateFont(20.0F);
var textOption = new TextOptions(font);
// OK
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{TaiLeCharacter}{TaiLeCharacter}{TaiLeCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{SundaneseCharacter}{SundaneseCharacter}{SundaneseCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{TifinaghCharacter}{TifinaghCharacter}{TifinaghCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{ChamCharacter}{ChamCharacter}{ChamCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{LatainCharacter}{LatainCharacter}{LatainCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{HiraganaCharacter}{HiraganaCharacter}{HiraganaCharacter}", textOption);
// raise NullReferenceException
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{LatainCharacter}{TaiLeCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{HiraganaCharacter}{TaiLeCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{LatainCharacter}{SundaneseCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{HiraganaCharacter}{SundaneseCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{LatainCharacter}{TifinaghCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{HiraganaCharacter}{TifinaghCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{LatainCharacter}{ChamCharacter}", textOption);
TextRenderer.RenderTextTo(new DummyGlyphRenderer(), $"{HiraganaCharacter}{ChamCharacter}", textOption);
class DummyGlyphRenderer : IGlyphRenderer
{
public void BeginFigure() { }
public bool BeginGlyph(in FontRectangle bounds, in GlyphRendererParameters parameters) => true;
public void BeginText(in FontRectangle bounds) { }
public void CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdControlPoint, Vector2 point) { }
public TextDecorations EnabledDecorations() => new TextDecorations();
public void EndFigure() { }
public void EndGlyph() { }
public void EndText() { }
public void LineTo(Vector2 point) { }
public void MoveTo(Vector2 point) { }
public void QuadraticBezierTo(Vector2 secondControlPoint, Vector2 point) { }
public void SetDecoration(TextDecorations textDecorations, Vector2 start, Vector2 end, float thickness) { }
} System configuration
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sorry! I didn't see this at all! Looking at this and #390 now |
Beta Was this translation helpful? Give feedback.
Sorry! I didn't see this at all! Looking at this and #390 now