The Artima Developer Community
Sponsored Link

Agile Buzz Forum
One Font, Two Font, Red Font, Blue Font

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
One Font, Two Font, Red Font, Blue Font Posted: Jul 24, 2003 10:02 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: One Font, Two Font, Red Font, Blue Font
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement
Via Niall Ross:
One Font, Two Font, Red Font, Blue Font, Travis Griggs, Key Technology

Travis overviewed emphases and runs in VW currently and looked at problems. He stressed he was not addressing the pixel font-unmatched issue (mention was made of a magical factor 1.14 that solved this).

He showed a simple script that wrote text, changing its size, colour and font en route. There are lots of classes and methods you encounter before you get the job done:

  • Display Scanner scans for each run change
  • default FontDescription is copied and modified: it has a dual role as the description of what you want and a description of what there is (can be)

There are two kinds of Fonts. There are raw character glyphs. These are finite in number; you describe a font and it must find the nearest match. The other kind is glyph decoration (SyntheticFont in current architecture). These wrap the device font and are potentially infinite in number.

Travis got into this years ago when he added super and subscripts while working for an engineering firm. It worked by asking for super/subscripts in the FontDescription, then (via a case statement) the synthetic font asked the FontDescription if it must super/subscript, etc. and acted appropriately. Then, developing the PDP tool, Travis wanted to put breakpoints in the text, not on the side like other debugging tools. Hence PDP wanted to add emphases too, to show where its probes are. Then along came the RB highlighter and it added emphases too. The RB subclassed rather than extending, otherwise the approach was very similar. Travis felt this was approaching 'path criticality'.

Everyone was hacking the same method:

CharacterAttributes>>newWithDefaultAttributes

and you couldn't load all the utilities because the patches overwrote each other. There were also conflicting patches to SyntheticFont and lots of boolean slots being added. Travis therefore created ExtraEmphases. While doing this work, he learned to save his image often (every method) since on every error debuggers came at him at lightning speed.

The package is in the open repository. There are only two base overrides. SyntheticFont is obsoleted.

He solves the newWithDefaultAttributes issue with a class side properties dictionary and one line of code in the method that checks and acts on it. He solves SyntheticFont overload with a new class DecoratedFont (a third layer, the other two being adorned font and warped font). Each font encapsulates its own logic: it decides whether it should apply itself to the underlying font or not. FontPolicy>>findFont: was changed from a case statement to an (I assume; I didn't actually hear him use this word but it sounded like it) visitor pattern that traversed the subclass tree and asked each class if the visitor wanted it. ExtendedFont's properties dictionary works like that of AnnotatedMethod. Currently there are 10 special fonts implemented: coloured, jagged, back colour (colour square behind e.g. number in cell, ...), leading / trailing insert, substitute (e.g. replace smiley's text with smiley graphic), underline, strikeout, etc. Travis ran a script that applied random emphases, producing some pretty (unreadable :-)) examples that changed every time he ran the script (just to show it was all real).

Travis then invited us to choose an example font to add from a list (but not the asterisked ones as he found a bug in the width-handling last night he will fix). We chose blink and created a Blink class with a 'colours' Array. After some coding, example text in the font iterated through the colours based on the millisecond clock value when sent the blink method. (The behaviour ran off a loop since, as he remarked, forked animation in a totally event-driven system is hard to do without a high-level loop for everything else to run off, c.f. most games programs, Squeak's high-level loop, etc.)

Q. Composite fonts? Needed when two or more glyph sets must be used to build up the text. He has done nothing with composite fonts as he's not convinced of their sanity. "Maybe they make sense in Japan."

Q. Is this integrated with all else in open repository? With PDP and RB highlighting, yes. He can't comment about anything else.

Q. Could this be used to e.g. hide comments, move them to the side of page, make them hyperlinks, etc.? Yes, it could be so used. (Sames: Pollock will support hyperlinks).

Read: One Font, Two Font, Red Font, Blue Font

Topic: Ambrai Smalltalk for Mac OS X Previous Topic   Next Topic Topic: Restore O/R Framework

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use