discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font fallback mechanism


From: Yen-Ju Chen
Subject: Re: Font fallback mechanism
Date: Mon, 19 Aug 2002 10:15:57 -0400

From: Fred Kiefer <FredKiefer@gmx.de>
To: Yen-Ju Chen <yjchenx@hotmail.com>
CC: discuss-gnustep@gnu.org
Subject: Re: Font fallback mechanism
Date: Sat, 17 Aug 2002 16:14:21 +0200


I appreciate the idea behind this, we really need a better support for different scripts in GNUstep. What I doubt is, if the way you suggest to solve this would be possible to implement and if so, if it would help at all.

OpenStep has its own solution for the problem, but currently GNUstep does not implement it: Here the method fixFontAttributeInRange: on NSAttributedString is used to redefine the used font to one that offers the needed characters. So the easiest way to achive what you suggest, would be to implement this method. The order in which fonts are checked for the replacement would be defined by the preferredFontNames of NSFont, perhaps this would be the place where your font list could be used. I don't know how MacOSX handles this, as the fix... methods seem to be gone there.

Cheers
Fred

 Here is what I thought:
 There are two situations which font fallback will be useful.
 The simple one is that every NSString contain only one kind of script,
but the whole application (or different applications) contain different script.
 The other one is that every NSString might contain more than one script.

 For the first situation, since preferredFontNames is a class methods,
maybe user can add a NSPrefferedFont = (Times, MingTi); in .GNUstepDefaults.
 Then in drawRun: of NSStringDrawing, it will try to use
 the specified font (NSFont, NSUserFont, ...) to convert
 the encoding strictly (using GSUniStrict flag instead).
If it won't work, it will try every preferredFontName with GSUniStrict flag.
 If all of them won't work, it will go back to use the specified font again
 without GSUniStrict as what it does right now.
 This should be easy to implement but involve several classes.
 As long as the list of preferredFont is short
 and the majority of strings are the same script,
 it should work efficiently.

For the second one, Apple move the fixFontAttributeInRange: into NSMutableAttributedString in AppKit. It needs to scan the whole string, seperate the script, and specify the correct font for each script (use preferredFont, too).
 This might need a lot of work to make it efficient,
 but once it works, it should works perfectly with the present GNUstep.
The programmers should remember that every time they set up a NSAttributedString,
 use fixFontAttributeInRange: to support multiple scripts.

 Yen-Ju


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]