The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Fonts and stuff - Travis Griggs

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
Fonts and stuff - Travis Griggs Posted: Jul 14, 2003 3:59 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Fonts and stuff - Travis Griggs
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
Travis Griggs talks about fonts in VisualWorks, and the problems/limitations. This talk will stick to the emphasis level - not the lower level stuff. First, you have to understand Text and runs.


  • DisplayScanner scans each run looking for changes

  • DefaultFontDescription is copied and modified

  • FontDescription - flat data structure used for finding the font to match the font policy, and renders the font for the subrange of this text.



So - 2 layers of fonts - the raw character glyphs provided by the OS. They are finite. They have to be matched to what you ask for. Second layer is Glyph decorations (SyntheticFont in VW). It wraps a DeviceFont. Not finite - can have decorations added.


To add new descriptions - patch CharacterAttributes, #newWithDefaultAttributes. Add new attributes to FontDescription and SyntheticFont.


There are lots of people mucking ariound here - PDP (Breakpoint glyphs), RB (code highlighting). What this means is that everyone who wants to change things hacks CharacterAttributes #newWithDefaultAttributes. The conflicting patches to the various requisite classes simply cannot co-exist (similar to the old problem with adding launcher menu items).


Solution - new framework, Extra Emphases in the Public Store. If you hack it, save early, save often! Only patches the base system in 2 places. Obsoletes SyntheticFont. Adds a class side registry to CharacterAttributes so that multiple changes by multiple people are possible.


Adds a new class - DecoratedFont - one subclass per font description. Each font encapsulates its own wrapping logic. The subclasses of DecoratedFont are similar to the UI wrappers - each is added to make its own changes to the base DeviceFont.


ExtraEmphases adds: ColoredFont, Underline, Strikeout, JaggedEdge, SuperScript, SubScript, TrailingInsert, LeadingInsert, Substitute, BackColor.


Now Travis is going to bail from the slides and add one of these as a demo. He's got a few scripted up, so we can see how this is done when you want to extend things. Let's see how one adds Blinking Text. In the DecoratedFont subclass, there are 3 methods you need to implement - a fourth, if you are in composite text land. Have to add two extensions to FontDescription.

Read: Fonts and stuff - Travis Griggs

Topic: This sounds way to cute Previous Topic   Next Topic Topic: nEcho Thoughts

Sponsored Links



Google
  Web Artima.com   

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