From: Maurice L. <mj...@ga...> - 2002-09-18 00:34:02
|
Alan W. Irwin writes: > (2) Now that I have looked at the logic, I believe it needs changing some > more. I think Joao's system may be typical; a "parent" path to get to the > area where fonts occur with subdirectories/font files you would like to try. > The current logic (once some additional bogus logic is fixed) says if there > is a slash *anywhere* in the font file environment variable than treat it as > a complete path plus file name and ignore the font path altogether. Instead, > at least for the Unix side of things I would prefer to concatanate the font > path and font name string *always* except for the one narrow exception where > there is a *leading* slash on the font name. This way you can comfortably > and flexibly deal with subdirectories in the font name, but if you really > want to specify absolute path+font file name, you are allowed to do so. Agreed. I vaguely noted that the current solution wasn't optimal, but like you was trying to just get it working so I could play with it. Having access to an alternate font rendering engine is really nice, and is helping me debug something I've been wanting to add for a long time -- storing strings as strings in the metafile. Then in principle you can do all kinds of cool things with them in the renderer. > Note, I am right at the bleeding edge of my C skills here about dealing > with pointers for the > > if (strchr(a,'/')!=NULL && *strchr(a,'/')==0) > > statement so please correct that if wrong. The point is that test should > succeed only if there is a leading "/" for the environment variable string, > a. The only thing I have done to the DJGPP and MSDOS logic is replace the > FT->font_name[i] which has not been assigned a value, yet with the > environment variable string, a. The second test won't ever succeed since the pointer value can't be zero. But you could do pointer arithmetic: if ( strchr(a,'/') && ( (strchr(a,'/') - a) == 0 ) ) (subtracting pointers is safe). Also note it's good style (arguable but most agree) to omit the test against NULL in the first expression. But even simpler would be: if (a[0] == '/') :) > (3) What is the Unix standard for file name length when you are potentially > dealing with the complete path + file name? I am uncomfortable with the > small (80-character) size of FT->font_name at the moment, and would like to > change it to something much larger and preferably the standard if somebody > could tell me what that is. 80 chars is way too short. A limit like 1024 chars is much more appropriate. -- Maurice LeBrun mj...@ga... Research Organization for Information Science and Technology of Japan (RIST) |