[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] fonts, fontmapper
From: "Vladimir Burakoff" ####@####.#### Date: 8 Jun 2006 10:56:22 +0100 Message-Id: Hello, I have found the cause for the drivers not responding. It is not connected with the fonts issue. And I only have the text which is not displayed now. Regards, Vladimir -----Original Message----- From: Vladimir Burakoff ####@####.#### Sent: Thursday, June 08, 2006 11:02 AM To: ####@####.#### Subject: [nanogui] fonts, fontmapper 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: ================================================= [Skipped a piece of source code] ================================================= 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] fonts, fontmapper
From: "Greg Haerr" ####@####.#### Date: 19 Jun 2006 02:58:37 +0100 Message-Id: <007e01c69343$ab0e97b0$6401a8c0@winXP> ::: if (pFont = (PMWCOREFONT) GdCreateFont(devID, fontNameSmall, 0, Since you're using the win32 API for fonts (LOGFONT, etc) you need to use the win32 CreateFont function, not GdCreateFont. All the Gdxxx functions are reserved for internal engine functions with which to implement the win32 or nano-X APIs. :: : And I see that the NanoX fontmapper only supports the TTF, Adobe and : built-in fonts types, isn't it? Basically, the nano-X fontmapper is obsolete. Instead, the filename of the TTF, Adobe, builtin, PCF or .fnt file should be specified in the GrCreateFont call. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |