SVG
SVG copied to clipboard
Could not render emojis
Description
When trying to render SVG file that includes an emoji inside text attribute, to PNG, it renders an invalid symbol. Does the library support it?
Example data
Used Versions
NET Core 3.1, Windows 10 Nuget version : Svg.Core Version: 3.0.49.2
@mrbean-bremen
strings are drawn using Graphics in this library. (GDI +) emoji are drawn using TextRenderer. (GDI)
Sample Code
var text = "😀";
var location = new Point(100, 75);
var family = FontFamily.GenericSansSerif;
var fontSize = 60;
var fontStyle = FontStyle.Regular;
using (var font = new Font(family, fontSize, fontStyle, GraphicsUnit.Pixel))
{
// Graphics -> GDI+
g.DrawString(text, font, new SolidBrush(Color.Red), location);
}
Result
Sample Code
var text = "😀";
var location = new Point(100, 75);
var family = FontFamily.GenericSansSerif;
var fontSize = 60;
var fontStyle = FontStyle.Regular;
using (var font = new Font(family, fontSize, fontStyle, GraphicsUnit.Pixel))
{
// TextRenderer -> GDI
TextRenderer.DrawText(g, text, font, location, Color.Red);
}
Result
TextRenderer is included in System.Windows.Forms, so it may not be desirable to refer to it. (Can't support various runtimes ?? :worried:)