The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Matching under X11

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
Matching under X11 Posted: Jan 14, 2004 9:54 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Matching under X11
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement
I just blew a day on a silly little thing. Using KDE, I had set my default font to the FreeSans font and really liked it. I decided, I wanted to see it in one of my apps. Our apps derive fonts from the #pixelDefault TextAttributes. The #pixelDefault is much easier than the #systemDefault when you want to have a common font, but just vary the pixel size from point to point. The place to edit is TextAttributes installDefault. All we should have to do is add 'freesans' to the front of the family list defined there. At this point, we can reboot to get it to take effect. The reboot means that message gets run and that the Screen's FontPolicy gets a new fontCache. It shoulda been that easy. The tough part was supposed to be worrying about how to do it without the reboot. But it wasn't. It didn't work. And I kissed off a good many hours figuring out why. It insisted on continuing to match the helvetica font. Font's are a pain to debug, because you can't put breakpoints in the font lookup/rendering code: you'll have an unusable image real fast. So you have to put conditional Transcript logs all over the place. And you have to keep flushing pieces of the cache (don't ever send flushFonts to the FontPolicy, I know it's there, but it'll hang your system high and dry, Cincom's known about this for some time).

The deal in the end boiled down to "serif-ness". The installDefault method indicates that we want a sansserif font, but setting serif: to false. You'd think that a font called freesans would be just that, huh? The problem is that when VW starts up and parses the available X11 fonts, it does not classify freesans as a sansserif font (leaves it unspecified). Why? Because it has a hard coded list of font names known to be sanserif fonts (as well as a hard coded list of serif ones). If your font name doesn't fall in this category, you get a serif unspecified font. This is wrong IMO. Who is Cincom to definitively decide who gets to be serif, who is a sans, and who isn't. The problem is that the xfont logical description doesn't provide information about what a font's "serif-ed-ness" is.

This also brings into question the FontPolicy's matching algorithms. Maybe FontPolicy should be more dynamic, based on the platform its running on. If you're on a platform, such as X11, which does not have fonts that indicate there "serif-ed-ness", then it should set the weight to 0. Platforms whose fonts do supply that information can have the weight set higher.

The amusing conclusion was that when I finally got around this (by setting the Screen's FontPolicy serifWeight to 0), it looked like crap. KDE does anti-aliasing, VW doesn't (that's a blog for another day). My freesans font looks like crap in VW without the anti-aliasing, so I ended up scrapping the whole effort.

Read: Matching under X11

Topic: Is registers for arguments pluasable? Previous Topic   Next Topic Topic: Subscribing to OPML feedlists

Sponsored Links



Google
  Web Artima.com   

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