Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Font Embedding

Font Embedding

Scheduled Pinned Locked Moved C / C++ / MFC
c++delphihelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dArK cHAriSmA
    wrote on last edited by
    #1

    Hi everyone! I'm desperly trying to make application, in Borland C++ 5.0, with my TTF fonts inside it.(I think its called Font embedding) Is there anyone who could help? I'd be gratefull:rolleyes: tanx dArK cHAriSmA

    C 1 Reply Last reply
    0
    • D dArK cHAriSmA

      Hi everyone! I'm desperly trying to make application, in Borland C++ 5.0, with my TTF fonts inside it.(I think its called Font embedding) Is there anyone who could help? I'd be gratefull:rolleyes: tanx dArK cHAriSmA

      C Offline
      C Offline
      Chris Hills
      wrote on last edited by
      #2

      I did this for an MFC application recently. I guess it’ll be similar with Borland. I created a custom resource, gave it a name, and associated it with the .TTF file. Then when I built the .exe file, I found the byte sequence for the .TTF file inside. So that’s the first step – getting the .TTF file into the .exe file. The second step is to get the byte sequence at run time. Call ::FindResource(), then ::LoadResource(), then ::LockResource(), then ::SizeofResource(). The third step is to tell Windows to use the byte sequence as a TrueType font. I haven’t found a good way of doing this. I don’t know if there is a good way. The method I use uses two indirections. Having found the byte sequence, write it out to a temporary file, then read in the file using ::AddFontResource(). Then call ::CreateFontIndirect(&lf), having set lf.lfFaceName to the name of your font, and hope that Windows chooses to use your font. Then call ::FreeResource() (I’m not sure if this is necessary, but some of the MSDN samples do it). And before your program ends, call ::RemoveFontResource(), otherwise your font will probably be in the system for ever more. HTH, Chris.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups