Rank: Member
Groups: Guest
Joined: 1/10/2016(UTC) Posts: 15
Thanks: 7 times
|
I'm facing an issue where the Roof Art Text is failing on specific scenarios. Here is a sample code: Code:
namespace ArtTextItalic
{
class Program
{
static void Main(string[] args)
{
using (var bitmap = new Bitmap(600, 400, PixelFormat.Format24bppRgb, new RgbColor(0xff, 0xff, 0xff, 0xff)))
using (var graphics = bitmap.GetAdvancedGraphics())
{
var font = GetFont(graphics);
font.FauxItalic = true;
var brush = new SolidBrush(new RgbColor(0x41, 0x41, 0x41));
var sampleValues = new string[] { "Teste", "Testa" };
var initialY = 0;
foreach (var value in sampleValues)
{
var texts = new Text[]
{
new RoofText(value, font, brush)
{
Center = new System.Drawing.PointF(150f, 50f + initialY),
Bend = -0.5f
},
new RoofText(value, font, brush)
{
Center = new System.Drawing.PointF(150f, 150f + initialY),
Bend = -0.2f
},
new RoofText(value, font, brush)
{
Center = new System.Drawing.PointF(450f, 50f + initialY),
Bend = 0.2f
},
new RoofText(value, font, brush)
{
Center = new System.Drawing.PointF(450f, 150f + initialY),
Bend = 0.5f
},
};
foreach (var text in texts)
{
graphics.DrawText(text);
}
initialY = 200;
}
bitmap.Save("ArtText.png");
Process.Start("ArtText.png");
}
}
static Font GetFont(Graphics graphics)
{
var customFontRegistry = new CustomFontRegistry(FontRegistry.Installed);
customFontRegistry.Add("Arimo-Regular.ttf");
graphics.FontRegistry = customFontRegistry;
return graphics.CreateFont("Arimo", 33);
}
}
}
Note from the output attached that the Roof Art Text is not working only when the Bend value is positive and the word ends with "e". The font that I'm using can be downloaded from here: http://www.1001fonts.com/arimo-font.html
|