PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Font question

Reply

Font question

 
Thread Tools Rate Thread
Old 21-12-2005, 02:33 PM   #1
Chubbly Geezer
Guest
 
Posts: n/a
Default Font question


I'm using a particular font (for credit card symbols) within a crystal
report which looks fine when I preview, however when I run the report with
real data, the font is now shown correctly. It seems to revert back to a
standard font and displays letters instead of card symbols. Any ideas.?
Can I embed a font or include one in my VB app.?

Thanks


  Reply With Quote
Old 21-12-2005, 06:31 PM   #2
=?Utf-8?B?S2VuIFR1Y2tlciBbTVZQXQ==?=
Guest
 
Posts: n/a
Default RE: Font question

Hi,

How to embed a font
http://www.bobpowell.net/embedfonts.htm

Ken
------------------------

"Chubbly Geezer" wrote:

> I'm using a particular font (for credit card symbols) within a crystal
> report which looks fine when I preview, however when I run the report with
> real data, the font is now shown correctly. It seems to revert back to a
> standard font and displays letters instead of card symbols. Any ideas.?
> Can I embed a font or include one in my VB app.?
>
> Thanks
>
>
>

  Reply With Quote
Old 22-12-2005, 10:39 AM   #3
Chubbly Geezer
Guest
 
Posts: n/a
Default Re: Font question

Thanks Ken

not quite working correctly however.

Am using the following code:
-----
Imports System.Runtime.InteropServices

Imports System.IO

Imports System.Drawing.Text



Private Sub frmCrystalViewer_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try

Dim pfc As New PrivateFontCollection()

'load the resource

Dim fontStream As Stream =
Me.GetType().Assembly.GetManifestResourceStream("WARCSubscriptionsLetterGenerator.TRPI____.PFB")

'create an unsafe memory block for the data

Dim data As System.IntPtr = Marshal.AllocCoTaskMem(fontStream.Length)

'create a buffer to read in to

Dim fontdata() As Byte

ReDim fontdata(fontStream.Length)

'fetch the font program from the resource

fontStream.Read(fontdata, 0, fontStream.Length)

'copy the bytes to the unsafe memory block

Marshal.Copy(fontdata, 0, data, fontStream.Length)

'pass the font to the font collection

pfc.AddMemoryFont(data, fontStream.Length)

'close the resource stream

fontStream.Close()

'free the unsafe memory

Marshal.FreeCoTaskMem(data)

Catch objE As Exception

MessageBox.Show(objE.Message)

End Try

End Sub

-----

I am using an Adobe *.PFB font as shown above.

The code error on

pfc.AddMemoryFont(data, fontStream.Length)

with a 'File Not Found' message.

I am running this code on the form_load of a form that contains a crystal
report viewer and the font in question is within my crystal report. Am
assuming that as long as the font is held in memory, where ever I view the
font should display correctly.

Thx



Chubbly





"Ken Tucker [MVP]" <KenTuckerMVP@discussions.microsoft.com> wrote in message
news9EC4623-4744-4CBC-A584-0A78246E00B7@microsoft.com...
> Hi,
>
> How to embed a font
> http://www.bobpowell.net/embedfonts.htm
>
> Ken
> ------------------------
>
> "Chubbly Geezer" wrote:
>
>> I'm using a particular font (for credit card symbols) within a crystal
>> report which looks fine when I preview, however when I run the report
>> with
>> real data, the font is now shown correctly. It seems to revert back to a
>> standard font and displays letters instead of card symbols. Any ideas.?
>> Can I embed a font or include one in my VB app.?
>>
>> Thanks
>>
>>
>>



  Reply With Quote
Old 23-12-2005, 03:04 AM   #4
[MSFT]
Guest
 
Posts: n/a
Default RE: Font question

For such a Crystal report related question, you may get support from:

http://support.businessobjects.com

Luke





  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off