Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:15:12+00:00 2026-05-31T01:15:12+00:00

I am trying to embed a font using the following code that I found

  • 0

I am trying to embed a font using the following code that I found from this site, however as I’m trying to build, I keep running into an error 'DIGITALDREAMNARROW' is not a member of 'Resources'.. Can anyone help with where I’m supposed to do this:

Even though I have the font added to a Resources folder. Is there something I’m missing?

http://zerosandtheone.com/blogs/vb/archive/2009/11/20/vb-net-include-a-font-as-an-embedded-resource-in-your-application.aspx

Imports System.Drawing.Text
Imports System.Runtime.InteropServices

Module CustomFont

'PRIVATE FONT COLLECTION TO HOLD THE DYNAMIC FONT
Private _pfc As PrivateFontCollection = Nothing


Public ReadOnly Property GetInstance(ByVal Size As Single, _
                                     ByVal style As FontStyle) As Font
    Get
        'IF THIS IS THE FIRST TIME GETTING AN INSTANCE
        'LOAD THE FONT FROM RESOURCES
        If _pfc Is Nothing Then LoadFont()

        'RETURN A NEW FONT OBJECT BASED ON THE SIZE AND STYLE PASSED IN
        Return New Font(_pfc.Families(0), Size, style)

    End Get
End Property

Private Sub LoadFont()
    Try
        'INIT THE FONT COLLECTION
        _pfc = New PrivateFontCollection

        'LOAD MEMORY POINTER FOR FONT RESOURCE
        Dim fontMemPointer As IntPtr = _
            Marshal.AllocCoTaskMem( _
            My.Resources.DIGITALDREAMNARROW.Length)

        'COPY THE DATA TO THE MEMORY LOCATION
        Marshal.Copy(My.Resources.DIGITALDREAMNARROW, _
                     0, fontMemPointer, _
                     My.Resources.DIGITALDREAMNARROW.Length)

        'LOAD THE MEMORY FONT INTO THE PRIVATE FONT COLLECTION
        _pfc.AddMemoryFont(fontMemPointer, _
                           My.Resources.DIGITALDREAMNARROW.Length)

        'FREE UNSAFE MEMORY
        Marshal.FreeCoTaskMem(fontMemPointer)
    Catch ex As Exception
        'ERROR LOADING FONT. HANDLE EXCEPTION HERE
    End Try

End Sub

End Module

I downloaded his program source code and it works fine but when I retry it on my end, I get errors. Can anyone help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:15:14+00:00Added an answer on May 31, 2026 at 1:15 am

    To add a file as a resource to your project,

    • Double-click My Project in Solution Explorer or your project Properties under the Project menu item.
    • Select the Resources tab from your project Properties. You can add the ttf file by either choosing Add Existing File… from the Add Resources drop down menu, or just drag and drop from Windows Explorer. Note: if you add the ttf resource using Add Existing File…, you will need to change the filter to show All Files (*.*).

    (reference)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to embed a font in Flex and the code I'm using looks
I'm trying to embed a flash file from my site, but for some reason
I'm trying to embed a font in my project by using url(font.ttf) rather than
I'm trying to embed SVG images on a site. I'll be using Modernizr to
Using FlashDevelop with the Flex SDK, I'm trying to embed a font in the
I'm trying to embed a font using css on in my flex project via
I am trying to embed Facebook video using the code below: <object width=400 height=224
We are currently trying to embed a swf into our page using https. That
I'm trying to embed a variable in a block of code that I'm writing
I'm trying to use the MusiSync font to embed a sharp and flat symbol

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.