I am trying to use Code128A.ttf font to generate barcodes. I have been using the same font for years in Windows 2000 and 2003 with Delphi. However, when I try to use the font now with C# and .NET 4.5 in Windows 8.x, all of the text characters seem to work, however, the start and stop code characters do not render the same as the Windows Character Map shows them.
For example: In the Character Map, \u008A
shows a nice Code128 stop code barcode glyph in the Character Map. However, when Graphics.DrawString
renders it, the character looks like the Š
"Latin Capital S with caron". Similarly, the Code128 start code \u0087
is rendered by graphics.DrawString
as the ‡
"Double Dagger" instead of its Character Map barcode glyph.
Failed Platform = Windows.Forms, C#, .NET 4.5, Visual Studio 2013, Windows 8.1 Last known working platform was = Delphi 6 (VCL)/Nevrona RAVE, Windows Server 2003
I'm hoping I'm just missing a setting or something simple.
void On_PrintPage(object sender, PrintPageEventArgs ppea)
{
string sCodeAStart = "\u0087"; // Code128A.ttf's glyph for Start A 103
string sStopCode = "\u008A"; // Code128A.ttf's glyph for StopCode 106
int iCheckDigit = MyCheckSumFunction(103, "500014630");
string sBarcode = sCodeAStart + "500014630"
+ ((char)iCheckDigit).ToString() + sStopCode;
Font fontBarcode = new Font("Code128A", 24, FontStyle.Regular);
ppea.Graphics.DrawString(sBarcode, fontBarcode, Brushes.Black, 100, 100);
}
Code128A.ttf Character Map with Stop Character selected.
DrawString Not Rendering Start and Stop Glyphs Properly
This is what it should look like