nanogui: fonts, fontmapper


Previous by date: 8 Jun 2006 09:01:30 +0100 Building a WinCE application using Microwin, tan yongzai
Next by date: 8 Jun 2006 09:01:30 +0100 Re: fonts, fontmapper, Vladimir Burakoff
Previous in thread:
Next in thread: 8 Jun 2006 09:01:30 +0100 Re: fonts, fontmapper, Vladimir Burakoff

Subject: fonts, fontmapper
From: "Vladimir Burakoff" ####@####.####
Date: 8 Jun 2006 09:01:30 +0100
Message-Id:

Hi all,

 

I am trying to make use of the built-in fonts and the NanoX fontmapper and
have a problem with it. I would appreciate for any help.

The NanoX has been configured for using two built-in fonts:
"winFreeSansSerif11x13" and "x6x13". Their source files are compiled and
linked in the library build. Then I create two new fonts in the manner
below:

 

=================================================

typedef struct mwfontex

{

    PMWCOREFONT hFont;

    char *name;

 

} MWFONTEX, *PMWFONTEX;

 

// ...

 

#define ZAF_FONTNAME_SMALL       "System"

#define ZAF_FONTNAME_APPLICATION "SystemFixed"

 

    const char fontNameApplication[] = ZAF_FONTNAME_APPLICATION;

    const char fontNameSmall[] = ZAF_FONTNAME_SMALL;

 

    MWLOGFONT lFont1;

    memset(&lFont1, 0, sizeof lFont1);

 

    lFont1.lfWeight = MWLF_WEIGHT_REGULAR;

    lFont1.lfClass = MWLF_CLASS_BUILTIN;

    lFont1.lfPitch = MWLF_PITCH_DEFAULT;

    lFont1.lfOutPrecision = MWLF_TYPE_DEFAULT;

    lFont1.lfProportional = 1;

    lFont1.lfCharSet = MWLF_CHARSET_UNICODE;

    lFont1.lfCharSet = MWLF_CHARSET_ANSI;

    memcpy(lFont1.lfFaceName, "MWF,", 4);

    memcpy(lFont1.lfFaceName+4, fontNameSmall, sizeof fontNameSmall);

 

    MWLOGFONT lFont2;

    memset(&lFont2, 0, sizeof lFont2);

 

    lFont2.lfWeight = MWLF_WEIGHT_REGULAR;

    lFont2.lfClass = MWLF_CLASS_BUILTIN;

    lFont2.lfPitch = MWLF_PITCH_DEFAULT;

    lFont2.lfOutPrecision = MWLF_TYPE_DEFAULT;

    lFont2.lfSansSerif = 1;

    lFont2.lfCharSet = MWLF_CHARSET_ANSI;

    memcpy(lFont2.lfFaceName, "MWF,", 4);

    memcpy(lFont2.lfFaceName+4, fontNameApplication, sizeof
fontNameApplication);

 

    OSFont osFont = 0;

    PMWCOREFONT pFont =0;

 

    if (pFont = (PMWCOREFONT) GdCreateFont(devID, fontNameSmall, 0,
&lFont1))

    {

        osFont = new MWFONTEX;

        osFont->hFont = pFont;

        osFont->name = new char [sizeof fontNameSmall];

        memcpy(osFont->name, fontNameSmall, sizeof fontNameSmall);

        fontTable[0] = osFont;

    }

 

    if (pFont = (PMWCOREFONT) GdCreateFont(devID, fontNameApplication, 0,
&lFont2))

    {

        osFont = new MWFONTEX;

        osFont->hFont = pFont;

        osFont->name = new char [sizeof fontNameApplication];

        memcpy(osFont->name, fontNameApplication, sizeof
fontNameApplication);

        fontTable[1] = osFont;

    }

    

    GdSetFont((PMWFONT) fontTable[0]->hFont);

=================================================

 

and then try to draw a text with the created font. After these steps the
text is not displayed and something breaks in my application so that it
stops responding to the keyboard and mouse drivers messages. I suppose that
"this something" is somehow connected with memory corruption but I cannot
find the place which it happens in. Under debugger I can see that the fonts
seem to create properly and their handles are valid. This problem does not
appear if I create some fonts based on external PCF fonts for example.

 

And I see that the NanoX fontmapper only supports the TTF, Adobe and
built-in fonts types, isn't it?

 

Thank you in advance.

 

Regards,

Vladimir

 


Previous by date: 8 Jun 2006 09:01:30 +0100 Building a WinCE application using Microwin, tan yongzai
Next by date: 8 Jun 2006 09:01:30 +0100 Re: fonts, fontmapper, Vladimir Burakoff
Previous in thread:
Next in thread: 8 Jun 2006 09:01:30 +0100 Re: fonts, fontmapper, Vladimir Burakoff


Powered by ezmlm-browse 0.20.