From: Henrik Vallgren on
Hi,

I use FTGL to handle font so I need to find the path for a particular
font. Looking at the wxFont or it's enumerator etc, I can't find support
for this. Am I Missing something?

Thanks in advance,
Henrik Vallgren
From: Vadim Zeitlin on
On Fri, 15 Dec 2006 15:15:42 GMT Henrik Vallgren <henrik.vallgren(a)stream-space.com> wrote:

HV> I use FTGL to handle font so I need to find the path for a particular
HV> font. Looking at the wxFont or it's enumerator etc, I can't find support
HV> for this. Am I Missing something?

I don't really know what FTGL is but wxWidgets doesn't support retrieving
the "font path" (whatever this is: under X11 you could be using a font
server) as there is nothing useful you could do with it using wx anyhow.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/


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

From: Henrik Vallgren on
Thanks Vadim,

FTGL is a library that adds font support to OpenGL. It uses freetype to
read/decode fonts.

Regars,
Henrik Vallgren

Vadim Zeitlin wrote:
> On Fri, 15 Dec 2006 15:15:42 GMT Henrik Vallgren <henrik.vallgren(a)stream-space.com> wrote:
>
> HV> I use FTGL to handle font so I need to find the path for a particular
> HV> font. Looking at the wxFont or it's enumerator etc, I can't find support
> HV> for this. Am I Missing something?
>
> I don't really know what FTGL is but wxWidgets doesn't support retrieving
> the "font path" (whatever this is: under X11 you could be using a font
> server) as there is nothing useful you could do with it using wx anyhow.
>
> Regards,
> VZ
>
From: H on
In article <YyNgh.26551$E02.11063(a)newsb.telia.net>,
Henrik Vallgren <henrik.vallgren(a)stream-space.com> wrote:

> Thanks Vadim,
>
> FTGL is a library that adds font support to OpenGL. It uses freetype to
> read/decode fonts.
>
> Regars,
> Henrik Vallgren
>
> Vadim Zeitlin wrote:
> > On Fri, 15 Dec 2006 15:15:42 GMT Henrik Vallgren
> > <henrik.vallgren(a)stream-space.com> wrote:
> >
> > HV> I use FTGL to handle font so I need to find the path for a particular
> > HV> font. Looking at the wxFont or it's enumerator etc, I can't find
> > support
> > HV> for this. Am I Missing something?
> >
> > I don't really know what FTGL is but wxWidgets doesn't support retrieving
> > the "font path" (whatever this is: under X11 you could be using a font
> > server) as there is nothing useful you could do with it using wx anyhow.
> >
> > Regards,
> > VZ
> >

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
From: Henrik Vallgren on
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