From: H on
In article <Ibehh.26697$E02.11006(a)newsb.telia.net>,
Henrik Vallgren <henrik.vallgren(a)stream-space.com> wrote:

> Thanks a lot Hartwig!
>
> I'm porting from windows so it's already been solved there. Running on
> the Mac is the reason I'm porting to wxWindows.
>
> Best Regards,
> Henrik Vallgren
>
> > Hi Henrik,
> >
> > as the code you are looking for does not exist in wxWidgets you have to
> > write your own one as Vadim mentioned.
> >
> > Here is a piece of code that does the job on MacOSX when passing a font
> > to the function:
> >
> > #include <sys/syslimits.h>
> > #include "wx/font.h"
> >
> > char* GetFontFilename(wxFont const& Font)
> > {
> > char* FullFontFilename;
> >
> > FSRef FileReference;
> >
> > FSSpec FileSpecification;
> >
> >
> >
> > wxCHECK_MSG(::ATSFontGetFileSpecification(::FMGetATSFontRefFromFont(Font.
> > MacGetATSUFontID()),&FileSpecification) ==
> > noErr,NULL,wxString(wxT("Typeface '")) << Font.GetFaceName() << wxT("'
> > not found"));
> > wxCHECK_MSG(::FSpMakeFSRef(&FileSpecification,&FileReference) ==
> > noErr,NULL,wxString(wxT("File reference conversion failed")));
> > FullFontFilename = new char[PATH_MAX];
> > if (::FSRefMakePath(&FileReference,reinterpret_cast<unsigned
> > char*>(FullFontFilename),PATH_MAX) == noErr)
> > return FullFontFilename;
> > else
> > {
> > delete[] FullFontFilename;
> > return NULL;
> > } /* if */
> > } /* GetFontFilename(wxFont const&) */
> >
> > Hartwig

Hi Henrik,

can you post the code for the windows version?

Hartwig
From: Henrik Vallgren on
Hi Hartwig,

It's not as elegant as the code that you posted: I use a special
function to get the font directory and then enumerate those fonts. Let
me get back to you once it's been rewritten.

Henrik


> Hi Henrik,
>
> can you post the code for the windows version?
>
> Hartwig
From: "Stefan Csomor" on
Hi

> It's not as elegant as the code that you posted: I use a special
> function to get the font directory and then enumerate those fonts.
> Let
> me get back to you once it's been rewritten.
>
> Henrik

I've done the same thing, in order to play nicely with the font name
offered from font enumerating methods, you need some code that reads the
ttf header, as I used it in conjunction with libharu, so all I had to do
was extend their ttf reading code a little bit, but I'm sure there are
smaller snippets around that do the job

Best

Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org