I'm actually glad someone gravedug this thread.
It gives me a chance to cross reference this font installation thread
as well as
cross reference the Karl Petersen "Preview Uninstalled Fonts" code
used by robertg in that thread,
which zelg37 gave a link to in this post
(which also has a link for a nice vbAccelerator article dealing with LogFont structures and creating
"a GDI font from first principles using the API call CreateFontIndirect").
Specifically for mathprof (whom I helped out earlier giving him a code example of an exploding slice pie chart in this thread
I'll also add a little bit more about APIs for using "private" fonts and using "custom" type resources.
First of all is it possible
to embed a font as a resource?
According to this MSDN KB article Q171731
not using the VB6 IDE:
In the Microsoft Visual Basic Language Reference and in the online Help,
the LoadResData function reference incorrectly describes
which resource formats can be returned.
The syntax of the LoadResData function is:
The Index and Format parameters are required values that are used to identify the resource ID and the resource formats respectively. The documentation lists the following resource formats:
1 Cursor resource
2 Bitmap resource
3 Icon resource
4 Menu resource
5 Dialog box
6 String resource
7 Font directory resource
8 Font resource
9 Accelerator table
10 User-defined resource
12 Group cursor
14 Group icon
However, formats 4, 5, 7, 8, 9, and 10 are not supported in Microsoft Visual Basic.
All is not lost however..there are some APIs that might be helpful.
and reading through this CodeProject article "How-to-Use-a-Font-Without-Installing-it
", gives a good list.
If the conversion from C++ proves to be unwieldy I throw out another MSDN support article at you (#194409
which has download link for "resfile.exe".
It's actually a zip file and once you extract/uncompress it,
there is a VB6 project that features "resfile.bas" that has the code for
Public Function SaveResItemToDisk, which basically takes "custom" resources,
(even those not normally supported by the VB6 Resource Editor) and saves them to a binary file.
Personally if I wanted to display text with a custom font inside a VB6 application
I would convert the fonts to vector graphics using the GetGlyphOutline API (aka Peter Wilson's Compufont8 code
Note: It's based on the oh-so-obscure MSDN article 87115:
"How To GetGlyphOutline() Native Buffer Format" which summarizes ttf font glyph outlining data structures as follows:
A glyph outline is a series of contours that describe the glyph. Each contour is defined by a TTPOLYGONHEADER data structure, which is followed by as many TTPOLYCURVE data structures as are required to describe the contour.
Each position is described by a POINTFX data structure, which represents an absolute position, not a relative position. The starting and ending point for the glyph is given by the pfxStart member of the TTPOLYGONHEADER data structure.
The TTPOLYCURVE data structures fall into two types: a TT_PRIM_LINE record or a TT_PRIM_QSPLINE record. A TT_PRIM_LINE record is a series of points; lines drawn between the points describe the outline of the glyph. A TT_PRIM_QSPLINE record is a series of points defining the quadratic splines (q-splines) required to describe the outline of the character.
In TrueType, a q-spline is defined by three points (A, B, and C), where points A and C are on the curve and point B is off the curve. The equation for each q-spline is as follows (xA represents the x-coordinate of point A, yA represents the y-coordinate of point A, and so on)
x(t) = (xA-2xB+xC)*t^2 + (2xB-2xA)*t + xA
y(t) = (yA-2yB+yC)*t^2 + (2yB-2yA)*t + yA
where t varies from 0.0 to 1.0.
Anyway..then instead of using a textbox you use a picturebox to "draw" the text (using a memDC backbuffer
if you want to compose the paragraph off-screen using MoveToEx and LineTo commands to shape the curved font outlines using very small closely=spaced lines as shown in the beziers attachment to this post
I generally prefer mono-spaced fonts for this technique - the kerning (and subsequent line calculations), can be a little tricky otherwise.