///////////////////////////////////////////////////////////////////////////////
//                             Lisaac Example                                //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////
Section Header
  
  + name      := TEXT;

  - copyright := "2003-2008 Sonntag Benoit";

  - author    := "Sonntag Benoit (sonntag@icps.u-strasbg.fr)";

Section Inherit

  + parent_form:Expanded FORM;

Section Public
  
  + justify:UINTEGER_8;
  + size:REAL_32;
  + inter_letter:REAL_32;
  + inter_word:REAL_32;
  + inter_line:REAL_32;
  
  + fontname:STRING;
  + text:STRING;
  
  //
  // Creation.
  //

  - create (px,py:INTEGER_32) text txt:STRING
  font font_n:STRING
  justify justif:UINTEGER_8
  size sz:REAL_32   
  inter_letter i_letter:REAL_32
  inter_word i_word:REAL_32
  inter_line i_line:REAL_32
  color_border c_border:UINTEGER_32 
  color_fill c_fill:UINTEGER_32 :SELF <-
  ( + result:SELF;
    result := clone;
    result.make (x0,y0) text txt font font_n
    justify justif size sz inter_letter i_letter
    inter_word i_word inter_line i_line 
    color_border c_border color_fill c_fill;
    result
  );

  - make (x0,y0:INTEGER_32) text txt:STRING
  font font_n:STRING
  justify justif:UINTEGER_8
  size sz:REAL_32   
  inter_letter i_letter:REAL_32
  inter_word i_word:REAL_32
  inter_line i_line:REAL_32 
  color_border c_border:UINTEGER_32 
  color_fill c_fill:UINTEGER_32 <-
  ( 
    color_border := c_border;
    color_fill   := c_fill;
    justify      := justif;
    size         := sz;
    inter_letter := i_letter;
    inter_word   := i_word;
    inter_line   := i_line;
    fontname     := font_n;
    text         := txt;
    points := LINKED_LIST(POINT).create;
  );
  
  //
  // File.
  //
  
  - make_with buf:FAST_ARRAY(UINTEGER_8) at ps:INTEGER :INTEGER <-
  ( + pos:INTEGER;
    
    pos := ps;
    justify      := buf.item pos;
    pos          := pos + 1;
    size         := read_real_32 buf at pos;
    pos          := pos + 4;
    inter_letter := read_real_32 buf at pos;
    pos          := pos + 4;
    inter_word   := read_real_32 buf at pos;
    pos          := pos + 4;
    inter_line   := read_real_32 buf at pos;
    pos          := pos + 4;    
    fontname     := read_string buf at pos; 
    pos          := pos + fontname.count + 1;
    text         := read_string buf at pos; 
    pos          := pos + text.count + 1;    
    parent_form.make_with buf at pos
  );
