Yudit Design Document
=====================
Author: Gáspár Sinai <gaspar@yudit.org>
Date: 2001-03-03 Tokyo 
Modified: 2006-05-21 Tokyo 

1 Intoduction
=====================================================================
This document describes the basic design of yudit, THE unicode text 
editor. You may find a lot of things missing, I am adding things to 
this document in a priority order.

1.1 Global Overview
=====================================================================
Yudit source code contains the following library directories:
o stoolkit contains the basic toolkit. Yudit uses only c library
  and it relies solely on this toolkit. 
  You may find the following components most useful:

  SString  - a string Object
  SVector - a vector for Objects
  SBinVector - a vector for basic types, integer pointer, e.t.c.
  SHashtable -  a hashtable for Objects
  SBinhashtable - a hashtable for basic types
  SEncoder - a text conversion utility
  SEvent - platform independent event handling
  STimer - a timer 
  SIO - io classes: files, directories, pipes
  SIOStream - io interaction class, streams, readers and writers.

o swindow contains the platform independent gui library
  You may find the following components most useful:
  SCanvas  - a drawing interface to draw lines, cubic splines,
    native fonts, images.
  SGEngine - a drawing engine to implement splines for platforms
   where splices are not supported. 
  SAwt - the asbtract widget toolkit. Every platform should extend this.
  SWindow - the abstract window, implements SCanvas.  Every 
   platform should extend this.
  SFontNative - a native font. Postscript fonts are rendered with the
   drawing interface; native fonts are renderes by the platform 
   dependent window. Every platform should extend this, if native
   fonts are supported.
  SColor - a basic color object with alpha transparency
  SPen - a pen that has a color and some with.
  SPrinter  - a canvas, that renders on a printer, a SPostscript
   printer for instance.

o swidget contains high level widgets that rely on the abstract window.
  You may find the following components most useful:

  SComponent - a basic component with no window and no layout.
  SPanel - a component that has window and layout
  SFrame - a top level SPanel
  SDialog - a top level SFrame that is modal and has a parent SPanel.
  SLabel - a label to draw text and icons
  STextEdit - a text editor
  SListBox - a list
  SButton - a button
  STextTable - a multi-column list
  SIconFactory - a factory that loads icons
  SFileDialog - a file selection box.
  STextDialog - a dialog to display messages, ask questions

o tests

  This directory is normally not compiled. It has drawing tests like
  Speed.cpp - rendering speed measurement utility. You need to set
    swidget/STextView.cpp: #define DEBUG_SPEED 0 should be redefined 1
    to make speed measurements with ./speed speed.txt
  Yuko.cpp - a simple spline-draw test.
  Test.cpp - any current test

2 True Type Font Drawing
=====================================================================
 
 1. When drawing a glyph in a font, font creates a cache name using
 the glyph, actual font, fontsize (not implemented: rotation
 parameter, penwidth), well basically everything minus the
 translation component in the matrix.
 2. font tries to write itself on a canvas object using newpath(x, y,
 cachename).

 3. If newpath returns true, the rendered image is cached so nothing
 but fill(pen) is called where pen contains additional parameters
 like linewidth + fore and back colors.

 4. If newpath returns false, the canvas drawing functions are called
 to actually draw the glyph.  Then fill(pen) is called.  This may
 cache the object in canvas unless the cache name is "".
 
 The actual drawing functions I implemented in yudit are postscript
 drawing functions, as you can see in swindow/SCanvas.h.

 - swindow/SPrinter (this is a canvas too!) uses these using
 SPostscript as a printer.  (It does almost nothing but translates the
 drawing functions to strings).  In case of printer I draw the same
 text twice, once to cache all glyphs, second to use cache to do the
 actual printout.
 
 - swindow/sx11/SX11Window (this is a canvas too, and it is pluggable
 because it is SWindow) uses the swindow/SGEngine as a helper to make
 these drawing functions available in X11.  If X11 starts to support
 some of these functions (like transparency, splines etc.) then
 SGEngine would not be needed at all.
 
