Font support changed in .NET ?

M

Mika M

Hi!

I'm trying to print barcodes paper printings of my VB .NET (2003) Windows
forms application. Earlier I used Code39.TTF (True Type Font) with VB6, and
it was working fine, but now can't get barcodes with VB .NET with the same
font !? I downloaded demo .OTF-barcode font (Open Type Font), and using it
with VB.NET I can get barcode printings using Crystal Reports .rpt-files of
my application, and using Printing.PrintDocument too.

I'm using Printing.PrintDocument-object like...

Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs)
Dim fntText As New Font("Arial", 12)
Dim fntBarc As New Font("DemoFont39", 8)

'// Human readable text
e.Graphics.DrawString("READABLE", fntText, Brushes.Black,
e.MarginBounds.Left, 200)

'// Barcode
e.Graphics.DrawString("*BARCODE*", fntBarc, Brushes.Black,
e.MarginBounds.Left + 200, 200)

e.HasMorePages = False
End Sub

Is this TTF-font support changed in VB.NET or what may be reason for I can't
use it any more? Is the only possibility to use .OTF-barcode font (Open Type
Font) these days - ie. buy other type expensive barcode font because earlier
font is no more working :( ? Whick font types are supported in .NET?
 
M

Mika M

Hi Ken!

Thanks for your reply. Yes barcode font of the link seems to work, but it
converts into barcode only uppercase letters. Before I noticed this, all
lovercase content was human readable and uppercase content was barcode -
funny looking :)

-- Mika
 
M

Mika M

Hi Ken!

Thanks again of your reply and helping me. Well coding is little too high
mathematics for my skill level, especially those API's, but I can copy
coding into my application :)

Anyway application will stuck when it's executing line ...

SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)

.... and does not execute following lines below this line :(

Other question: How can I get correct Font-directory (or folder) if it not
is 'C:\Windows\Fonts'? It possible to be for example 'C:\WinNT\Fonts'.

-- Mika
 
K

Ken Tucker [MVP]

Hi,

Dim strWindows As String =
Environment.GetEnvironmentVariable("WINDIR")
Dim strPath As String = String.Format("{0}\barcoding.ttf",
fi.DirectoryName)
Dim strFont As String =
String.Format("{0}\Fonts\barcoding.ttf", strWindows)

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top