load true type front (ttf) from file directly

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it

Is this possible?

Thanks,
James

···

from my program.

James Bigler wrote:

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it from my program.

Is this possible?

Not with wxPython. You may be able to use a library like freetype (if they have a Python wrapper) to get info about the glyphs in the font file, and then draw the glyphs yourself.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

James Bigler wrote:

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it from my program.

Is this possible?

Not with wxPython. You may be able to use a library like freetype (if they have a Python wrapper) to get info about the glyphs in the font file, and then draw the glyphs yourself.

Thanks. I'm assuming you meant creating an image from a font character, but what about just using the font directly to "type" labels like in a wx.StaticLabel? Is there a way to get the font from a .ttf file into a wx.Font?

Thanks again.

James

James Bigler wrote:

Robin Dunn wrote:

James Bigler wrote:

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it from my program.

Is this possible?

Not with wxPython. You may be able to use a library like freetype (if they have a Python wrapper) to get info about the glyphs in the font file, and then draw the glyphs yourself.

Thanks. I'm assuming you meant creating an image from a font character, but what about just using the font directly to "type" labels like in a wx.StaticLabel? Is there a way to get the font from a .ttf file into a wx.Font?

No.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

James Bigler wrote:

Robin Dunn wrote:

James Bigler wrote:

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it from my program.

Is this possible?

Not with wxPython. You may be able to use a library like freetype (if they have a Python wrapper) to get info about the glyphs in the font file, and then draw the glyphs yourself.

Thanks. I'm assuming you meant creating an image from a font character, but what about just using the font directly to "type" labels like in a wx.StaticLabel? Is there a way to get the font from a .ttf file into a wx.Font?

No.

Drat! :wink: Thanks for the information.

James

James Bigler wrote:

I have a font with all sorts of icons stored in it (similar to wingdings). I'm trying to figure out a way to read the file directly without having to install the font in my system to give access to it from my program.

Is this possible?

I'm afraid not. wxWidgets doesn't support loading fonts directly from files. Too bad, I hope someone adds that feature some day.

In the meantime, you can kludge around it by drawing your stuff to an image with PIL (or something else), and then transferring that image to wx. There are some pages in the Wiki that talk about this kind of image manipulation.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception