Telnet and TrueTypeTextStyle

Yoshiki.Ohshima at acm.org Yoshiki.Ohshima at acm.org
Sun May 11 17:59:45 UTC 2003


  Hello,

> Telnet's TeletypeWindow>>buildFontMenu sends #monospacedFamilyNames to
> StrikeFont and it looks in the TextConstants pool for TextStyles and
> sends #isMonospaced to each.  StrikeFont implements it but TTCFont
> (added to TextConstants by TrueTypeTextStyle (I guess)) doesn't so I got
> a walkback when I tried to use the TeletypeWindow window menu.  I pasted
> StrikeFont>>isMonospaced into TTCFont and moved on.

  Does StrikeFont implement isMonospaced?  I don't see it in 3.4
image.

> Looking at #isMonospaced, it isn't surprising that the hack worked since
> the only font-specific message in it is #widthOf:, which is a
> #subclassResponsibility in AbstractFont; both StrikeFont and TTCFont
> implement it.  And it does seem like #isMonospaced is a question that
> any font should be able to answer.

  Well, methods like #isMonospaced make sense only when the graphical
representation of a string is the concatenation of the grachics of
"characters" in it.  Also, the fonts being used for Japanese terminal
emulators are mixture of two different spacing; often called
full-width and half-width.  It should also work as expected if the
internal logic of the terminal emulator knows how to handle it.

  Also, the right thing to do in the future for a method like
#widthOf: would be to get aString, instead of aCharacter as argument.

>   Similarly, it seems like
> #monospacedFamilyNames is information any font class should be able to
> provide and its implementation doesn't rely on particular font
> characteristics.  Hence I moved the 2 to AbstractFont and removed them
> elsewhere.  So far so good, but not really brave since the only path to
> the bug in this image is via the previously mentioned menu.

  Moving them to AbstractFont sounds ok.  *Unusual* fonts can always
return false.

> I explain all this because at first it seemed like the TTCFont didn't
> implement something it should've, but I no longer think so.  Maybe
> #maxWidth is another question every font should answer.  However, I know
> almost nothing about fonts.

  #maxWidth is also tricky...  If possible, I'd recommend to avoid it.

-- Yoshiki




More information about the Squeak-dev mailing list