[V3dot10] Re: Font bugs

Ralph Johnson johnson at cs.uiuc.edu
Sun Jul 22 12:16:29 UTC 2007

I discovered why we are getting recusive fonts.

"TextStyle default" starts out at Accuny12, which is based on
StrikeFont.  But it eventually gets changed to BitstreamVeraSans,
which is based on TTCFont.  If we want to avoid recursive fonts, the
default textstyle should never be based on TTCFont.

The default TextStyle  is stored in a pool variable in TextConstants,
and the variable is never assigned to except in one method that is
never called.  However, there are LOTS of places where the code is
      TextConstants at: #Varname put: somevalue
This makes it harder to find where variables get changed.  In my
opinion, it is very bad style.

So, I changed "TextConstants at: #DefaultTextStyle put: x" to
"TextStyle setDefault: x"
I also changed "TextConstants at: #DefaultTextStyle" to "TextStyle default".

There were about five places where setDefault: was called, but most of
them were from methods with no senders.  The one exception is
Preferences class>>#setSystemFontTo   This is called a lot of times.
Most of those methods explicitly set a font, often to Accuny but
sometimes to BitstreamVeraSans.   For example, Preferences
class>>setDemoFont sets the font to BitstreamVeraSans.

The test that is setting the font to BitstreamVeraSans is LangEnvBugs.
 It has one method, testIsFontAvailable, that plays with preferences
as follows:

| oldPref |
oldPref := Preferences valueOfPreference: #tinyDisplay .
Preferences enable: #tinyDisplay .
self shouldnt: [ [ ( LanguageEnvironment localeID: 'en' ) isFontAvailable ]
				ensure: [Preferences setPreference: #tinyDisplay toValue: oldPref] ]
	raise: Error.

It appears that enabling a tiny display has the side effect of setting
the default font to BitstreamVeraSans.  And, setting the preferences
back to its original value doesn't set the default font back.

So, I know a lot more than I used to, but I am not sue what to do.  Is
it OK for the defaul textstyle to be BitstreamVeraSans?  If so, how
can we prevent recursive fonts?  If not, what font should we get when
we have a tiny display?

I got this far on the basis of advice by Andreas and Jerome.


More information about the V3dot10 mailing list