Ttengine.library

From Freepascal Amiga wiki
Revision as of 18:10, 17 October 2014 by Molly (talk | contribs) (Added initial content)
Jump to navigation Jump to search

TTEngine is a AmigaOS friendly TrueType render engine library which can open a TrueType font by itself and renders high quality glyphs directly.


Description

TTEngine can render text directly into an AmigaOS rastport using FreeType font(s) and is also available for AROS [1]

The render engine of the library is based on FreeType2 project [2].

The library expands FreeType functionality making usage of TrueType fonts easy and comfortable. Below you can find key features:

  • renders whole strings (not single glyphs) with kerning.
  • antialiasing to any (not neccesarily uniform color) background.
  • system compatible output to any (including planar) RastPort.
  • supports JAM1. JAM2, INVERSVID, COMPLEMENT RastPort modes.
  • supports 8-bit to Unicode mapping with "ENV:ttfcodepage" table
  • compatible with ttf.library.
  • allows for direct 16-bit Unicode string rendering.
  • easy to use, taglist based API almost identical to graphics.library font API.
  • efficient system-wide glyph cache system.

For more information, please refer to the official SDK.


Usage

The TTEngine library uses its own caching system and uses a special crafted ttengine.database (the latter keeps track of the truetype font(s) that the end-user has configured in his/her system).

Be aware that some of the example are designed in such a way that they depend on a proper truetype configuration.

To configure your truetype fonts, please use TTManager first. In practise that seems to boil down to adding and configuring your fonts and needing a restart of the the OS before changes taking place.

Do note, that creation of the caching file and font database are not mandatory. It simply depends on which functionality enduser's code relies.

For more information about the caching system and the font database, please refer to the official SDK.


Examples

Example: Display family-list font information

This example will display information in the shell about the truetype-fonts available (read: configured) in the system.

Please note, that in order for this example to work correctly that it is required to configure truetype fonts first by using the accompanied font manager from the archive.

( Original c-source code is available in the distribution archive of ttengine )

program familylist;

{$MODE OBJFPC}{$H+}

(*
  Pascalized version of familylist.c, part of ttengine library examples
  Only works correctly when env:ttengine.database is present
*)

Uses
  exec,
  utility,
  aros_ttengine;



Function SetAndTest(var a: Pointer; b: Pointer): boolean;
begin
  a := b;
  result := (a <> nil);
end;



Function Main: Integer;
var
  family_list : PSTRPTR;
  p           : PSTRPTR;
begin
  if (TTEngineBase <> nil) then
  begin
    Writeln('Listing all available font families:');
    writeln('-------------------------------------');

    If SetAndTest(family_list, TT_ObtainFamilyListA(nil)) then
    begin
      p := family_list;
      while (p^ <> nil) do
      begin
        writeln(p^);
        inc(p);
      end;
      TT_FreeFamilyList(family_list);
    end;
  
    writeln;
    writeln('Listing monospaced font families:');
    writeln('-------------------------------------');

    if SetAndTest(family_list, TT_ObtainFamilyList([TTRQ_FixedWidthOnly, LTRUE, TAG_END])) then
    begin
      p := family_list;
      while (p^ <> nil) do
      begin
        writeln(p^);
        inc(p);
      end;
      TT_FreeFamilyList(family_list);
    end;
    // CloseLibrary(TTEngineBase);
  end;
  result := 0;
end;


begin
  writeln('enter');
  exitcode := Main;
  writeln('leave');
end.


Example: Engine test

An example of testing the engine.

Amongst others, it shows how to setup the ttengine system, render text, how to apply individual attributes and even includes a case of rendering an UTF-16 encoded text.

Please note, that in order for this example to work correctly that it is required to configure truetype fonts first by using the accompanied font manager from the archive.

( Original c-source code is available in the distribution archive of ttengine )

program test;

{$MODE OBJFPC}{$H+}

(*
  Pascalized version of plain test.c, part of ttengine library examples
  Only works correctly when env:ttengine.database is present
*)

Uses
  exec,
  amigados,
  agraphics,
  utility,
  intuition,
  asl,
  aros_ttengine,
  sysutils;



Type
  TMatrix = record
    xx : ULONG;
    xy : ULONG;
    yx : ULONG;
    yy : ULONG;
  end;


var
  tx : Pwidechar = (#$FEFF'Test 16-bit '#$03a3' Unicode string.'#$0000);
  // added litle extra test -> feff03a3 = sigma


Function Main: Integer;
var
  win       : PWindow;
//  fontname  : STRPTR;
  font      : APTR;
var
  fontattrs : PTagItem;
  requester : APTR;
  sigmask, 
  signals   : ULONG;
  running   : boolean = TRUE;  
  rp        : PRastPort;
  tmt       : TMatrix = (xx: $00010000; xy: $00000000; yx: $00000000; yy: $00008000);
  red, 
  grn, 
  blu       : ULONG;
  imsg      : PIntuiMessage;
  
begin
  if (GfxBase <> nil) then
  begin
    if (AOS_utilitybase <> nil) then
    begin
      if (IntuitionBase <> nil) then
      begin
        if (TTEngineBase <> nil) then
        begin
          requester := TT_AllocRequest();
          writeln(format('requester = $%p', [requester]));

          fontattrs :=  TT_Request(requester,
          [
            TTRQ_DoSizes   , LFALSE,
            TTRQ_DoWeight  , LTRUE,
            TTRQ_DoStyle   , LTRUE,
            TTRQ_DoPreview , LTRUE,
            TAG_END
          ]);
          if (fontattrs <> nil) then
          begin
            win := OpenWindowTags(nil,
            [
              LongInt(WA_Top)        , 25,
              LongInt(WA_Left)       , 0,
              LongInt(WA_Width)      , 640,
              LongInt(WA_Height)     , 350,
              LongInt(WA_CloseGadget), LTRUE,
              LongInt(WA_DragBar)    , LTRUE,
              LongInt(WA_DepthGadget), LTRUE,
              LongInt(WA_IDCMP)      , IDCMP_CLOSEWINDOW,
              LongInt(WA_Title)      , pchar('ttengine.library test'),
              TAG_END
            ]);
            If (win <> nil) then
            begin
              running := true;
              rp := win^.RPort;              
//// 1
              font := TT_OpenFont(
              [
                TT_FamilyTable  , GetTagData(TT_FamilyTable, ULONG(Nil), fontattrs),
                TT_FontStyle    , GetTagData(TT_FontStyle, 0, fontattrs),
                TT_FontWeight   , GetTagData(TT_FontWeight, TT_FontWeight_Normal, fontattrs),
                TT_FontSize     , 24,
                // TT_FontTransform, (ULONG)&tmt,
                TAG_END
              ]);
              if (font <> nil) then
              begin
                if (TT_SetFont(rp, font) <> 0) then
                begin
                  TT_SetAttrs(rp,
                  [
                    TT_Window, ULONG(win),
                    TAG_END
                  ]);

                  SetAPen(rp, 2);
                  SetDrMd(rp, JAM1);
                  GfxMove(rp, 10, 50);
                  TT_Text(rp, pchar('This is a text printed with TT_Text()."'), 38);

                  TT_SetAttrs(rp,
                  [
                    TT_Antialias , TT_Antialias_Off,
                    TT_Encoding  , TT_Encoding_UTF16,
                    TAG_END
                  ]);

                  SetDrMd(rp, JAM2);
                  SetBPen(rp, 3);
                  GfxMove(rp, 10, 74);
                  TT_Text(rp, tx, 28);
                end
                else Writeln('TT_SetFont() failed.');
                TT_CloseFont(font);
              end
              else Writeln('Font open failed.');
//// 2
              font := TT_OpenFont(
              [
                TT_FamilyTable  , GetTagData(TT_FamilyTable, ULONG(Nil), fontattrs),
                TT_FontStyle    , GetTagData(TT_FontStyle, 0, fontattrs),
                TT_FontWeight   , GetTagData(TT_FontWeight, TT_FontWeight_Normal, fontattrs),
                TT_FontSize     , 36,
                TAG_END
              ]);
              if (font <> nil) then
              begin
                if (TT_SetFont(rp, font) <> 0) then
                begin
                  TT_SetAttrs(rp,
                  [
                    TT_Encoding  , TT_Encoding_Default,
                    TT_Antialias , TT_Antialias_On,
                    TT_Window    , ULONG(win),
                    TAG_END
                  ]);

                  SetAPen(rp, 1);
                  SetBPen(rp, 2);
                  
                  SetDrMd(rp, JAM2);
                  GfxMove(rp, 10, 120);
                  TT_Text(rp, pchar('Antialias with 36 points size.'), 30);
                end
                else Writeln('TT_SetFont() failed.');
                TT_CloseFont(font);
              end
              else Writeln('Font open failed.');
//// 3
              font := TT_OpenFont(
              [
                TT_FamilyTable  , GetTagData(TT_FamilyTable, ULONG(Nil), fontattrs),
                TT_FontStyle    , GetTagData(TT_FontStyle, 0, fontattrs),
                TT_FontWeight   , GetTagData(TT_FontWeight, TT_FontWeight_Normal, fontattrs),
                TT_FontSize     , 16,
                TAG_END
              ]);
              if (font <> nil) then
              begin
                if (TT_SetFont(rp, font) <> 0) then
                begin
                  TT_SetAttrs(rp,
                  [
                    TT_Encoding  , TT_Encoding_Default,
                    TT_Antialias , TT_Antialias_On,
                    TT_Window    , ULONG(win),
                    TAG_END
                  ]);

                  SetAPen(rp, 1);
                  SetDrMd(rp, JAM1);
                  GfxMove(rp, 10, 140);
                  TT_Text(rp, pchar('Antialias with 16 points size.'), 30);

                  SetAPen(rp, 2);
                  GfxMove(rp, 10, 156);
                  TT_Text(rp, pchar('Antialias with 16 points size.'), 30);
                  
                  SetAPen(rp, 3);
                  GfxMove(rp, 10, 172);
                  TT_Text(rp, pchar('Antialias with 16 points size.'), 30);
                  
                end
                else Writeln('TT_SetFont() failed.');
                TT_CloseFont(font);
              end
              else Writeln('Font open failed.');
//// 4
              //* antialias on different backgrounds */
              font := TT_OpenFont(
              [
                TT_FamilyTable  , GetTagData(TT_FamilyTable, ULONG(Nil), fontattrs),
                TT_FontStyle    , GetTagData(TT_FontStyle, 0, fontattrs),
                TT_FontWeight   , GetTagData(TT_FontWeight, TT_FontWeight_Normal, fontattrs),
                TT_FontSize     , 24,
                TAG_END
              ]);
              if (font <> nil) then
              begin
                //red := ObtainBestPen(win^.WScreen^.ViewPort.ColorMap, $FFFFFFFF, 0        ,         0, [TAG_END]);
                //grn := ObtainBestPen(win^.WScreen^.ViewPort.ColorMap, 0        , $FFFFFFFF,         0, [TAG_END]);
                //blu := ObtainBestPen(win^.WScreen^.ViewPort.ColorMap, 0        , 0        , $FFFFFFFF, [TAG_END]);

                red := ObtainBestPenA(win^.WScreen^.ViewPort.ColorMap, $FFFFFFFF, 0        ,         0, nil);
                grn := ObtainBestPenA(win^.WScreen^.ViewPort.ColorMap, 0        , $FFFFFFFF,         0, nil);
                blu := ObtainBestPenA(win^.WScreen^.ViewPort.ColorMap, 0        , 0        , $FFFFFFFF, nil);


                if (TT_SetFont(rp, font) <> 0) then
                begin
                  TT_SetAttrs(rp,
                  [
                    TT_Encoding  , TT_Encoding_Default,
                    TT_Antialias , TT_Antialias_On,
                    TT_Window    , ULONG(win),
                    TAG_END
                  ]);

                  SetDrMd(rp, JAM2);

                  TT_SetAttrs(rp, [TT_Background, $0000FF00, TT_Foreground, $00FF0000, TAG_END]);
                  GfxMove(rp, 10, 200);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $000000FF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00000000, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00FFFFFF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  
                  TT_SetAttrs(rp, [TT_Background, $00FF0000, TT_Foreground, $0000FF00, TAG_END]);
                  GfxMove(rp, 10, 224);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $000000FF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00000000, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00FFFFFF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  
                  TT_SetAttrs(rp, [TT_Background, $000000FF, TT_Foreground, $00FF0000, TAG_END]);
                  GfxMove(rp, 10, 248);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $0000FF00, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00000000, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00FFFFFF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  
                  TT_SetAttrs(rp, [TT_Background, $0000000, TT_Foreground, $00FF0000, TAG_END]);
                  GfxMove(rp, 10, 272);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00000FF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $0000FF00, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00FFFFFF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  
                  TT_SetAttrs(rp, [TT_Background, $00FFFFFF, TT_Foreground, $00FF0000, TAG_END]);
                  GfxMove(rp, 10, 296);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $000000FF, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $00000000, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                  TT_SetAttrs(rp, [TT_Foreground, $0000FF00, TAG_END]);
                  TT_Text(rp, PChar('Smooth47'), 8);
                end
                else Writeln('TT_SetFont() failed.');

                ReleasePen(win^.WScreen^.ViewPort.ColorMap, red);
                ReleasePen(win^.WScreen^.ViewPort.ColorMap, grn);
                ReleasePen(win^.WScreen^.ViewPort.ColorMap, blu);

                TT_CloseFont(font);
              end
              else Writeln('Font open failed.');

              sigmask := SIGBREAKF_CTRL_C or (1 shl win^.UserPort^.mp_SigBit);
              while (running) do
              begin
                signals := Wait(sigmask);
                if ((signals or SIGBREAKF_CTRL_C) <> 0) then running := FALSE;
                if ((signals and (1 shl win^.UserPort^.mp_SigBit)) <> 0) then
                begin
                  imsg := PIntuiMessage(GetMsg(win^.UserPort));
                  while (imsg <> nil) do
                  begin
                    if (imsg^.IClass = IDCMP_CLOSEWINDOW) then running := false;
                    ReplyMsg(pMessage(imsg));
                    imsg := PIntuiMessage(GetMsg(win^.UserPort));
                  end;
                end;
              end;  // while running

              TT_DoneRastPort(win^.RPort);
              CloseWindow(win);
            end
            else writeln('OpenWindowTags() failed.');
          end;
          TT_FreeRequest(requester);
          // CloseLibrary(TTEngineBase);
        end;
        // CloseLibrary(IntuitionBase);
      end
      // CloseLibrary(UtilityBase);
    end;
    // CloseLibrary(GfxBase);
  end;

  result := 0;
end;



begin
  writeln('enter');
  exitcode := Main;
  writeln('leave');
end.


Example: ( insert example title )

There's no example available.



The unit

Please note that this unit uses Experimental_Tags.

unit aros_ttengine;

{$MODE OBJFPC}{$H+}

{
  ttengine.library
}

interface

uses
  exec, agraphics,
  sysutils;  { for PByteArray }


type
//  pvoid             = pointer;  
//  STRPTR            = pchar;
  PSTRPTR           = ^STRPTR;

//
//  ttengine-7.2-aros-i386\Developer\include\libraries\ttengine.h
//  
Const
  TTENGINENAME                  = 'ttengine.library';
  TTENGINEVERSION               = 7;
  TTENGINEMINVERSION            = 6;


  //* Tags */

  //* Tags applicability legend: */
  //* O - TT_OpenFont() */
  //* G - TT_GetAttrs() */
  //* S - TT_SetAttrs() */
  //* P - TT_GetPixmap() */

  //* ---- name -------------------- value ----- applicability */

  TT_FontFile                   = $6EDA0000;    //* OG.. */
        
  TT_FontStyle                  = $6EDA0001;    //* OG.. */
        
  TT_FontStyle_Regular          = 0;
  TT_FontStyle_Italic           = 1;
        
  TT_FamilyTable                = $6EDA0002;    //* O... */
  TT_FontSize                   = $6EDA0003;    //* OG.. */
        
  TT_FontWeight                 = $6EDA0004;    //* OG.. */
        
  TT_FontWeight_Normal          = 400;
  TT_FontWeight_Bold            = 700;
        
  TT_ColorMap                   = $6EDA0005;    //* O... */
  TT_Screen                     = $6EDA0006;    //* O... */
  TT_Window                     = $6EDA0007;    //* O... */
  TT_FontAscender               = $6EDA0008;    //* .G.. */
  TT_FontDescender              = $6EDA0009;    //* .G.. */
        
  TT_Antialias                  = $6EDA000F;    //* .GSP */
        
  TT_Antialias_Auto             = 0;
  TT_Antialias_Off              = 1;
  TT_Antialias_On               = 2;
        
  TT_Encoding                   = $6EDA0010;    //* .GSP */

  //* All encoding numbers (excluding TT_Encoding_Default) are equal to IANA */
  //* registered encoding numbers                                            */

  TT_Encoding_Default           =   0;          //* use ENV:ttfcodepage or ISO-8859-1 if not found */
  TT_Encoding_ISO8859_1         =   4;          //* Western Europe and US */
  TT_Encoding_ISO8859_2         =   5;          //* Eastern Europe */
  TT_Encoding_ISO8859_3         =   6;
  TT_Encoding_ISO8859_4         =   7;
  TT_Encoding_ISO8859_5         =   8;
  TT_Encoding_ISO8859_6         =   9;
  TT_Encoding_ISO8859_7         =  10;
  TT_Encoding_ISO8859_8         =  11;
  TT_Encoding_ISO8859_9         =  12;
  TT_Encoding_ISO8859_10        =  13;
  TT_Encoding_ISO8859_11        =  14;
  TT_Encoding_ISO8859_13        =  109;
  TT_Encoding_ISO8859_14        =  110;
  TT_Encoding_ISO8859_15        =  111;
  TT_Encoding_ISO8859_16        =  112;
  TT_Encoding_UTF16_BE          = 1013;
  TT_Encoding_UTF32_BE          = 1018;
  TT_Encoding_UTF8              =  106;
  TT_Encoding_UTF16_LE          = 1014;
  TT_Encoding_UTF32_LE          = 1019;
  TT_Encoding_UTF16             = 1015;
  TT_Encoding_UTF32             = 1017;


  TT_FontName                   = $6EDA0011;    //* .G.. */
  TT_FamilyName                 = $6EDA0012;    //* .G.. */
  TT_SubfamilyName              = $6EDA0013;    //* .G.. */
  TT_Transparency               = $6EDA0014;    //* .GS.  from 0 to 255 */
  TT_ScaleX                     = $6EDA0015;    //* O.SP  16.16 scaled integer */

  TT_SoftStyle                  = $6EDA0017;    //* ..SP (V5) */


  TT_SoftStyle_None             = $0000;
  TT_SoftStyle_Underlined       = $0001;
  TT_SoftStyle_DblUnderlined    = $0002;
  TT_SoftStyle_Overstriked      = $0004;
  TT_SoftStyle_DblOverstriked   = $0008;
  
  
  TT_Foreground                 = $6EDA0018;    //* ..S.  foreground RGB value*/
  
  TT_Foreground_UseRastPort     = $FFFFFFFF;
  
  TT_Background                 = $6EDA0019;    //* ..S.  background RGB value*/
  
  TT_Background_UseRastPort     = $FFFFFFFF;
  
  TT_FontMaxTop                 = $6EDA001E;    //* .G.. */
  TT_FontMaxBottom              = $6EDA001F;    //* .G.. */
  TT_FontDesignHeight           = $6EDA0020;    //* .G.. */
  TT_FontRealAscender           = $6EDA0021;    //* .G.. */
  TT_FontRealDescender          = $6EDA0022;    //* .G.. */
  TT_FontAccentedAscender       = $6EDA0023;    //* .G.. */
  TT_CustomEncoding             = $6EDA0024;    //* ..SP */
  TT_Gamma                      = $6EDA0025;    //* .GS. */  /* gettable from V7.2 */
        
  TT_FontBaseline               = TT_FontMaxTop;//* V6.7 */
        
  TT_FontFixedWidth             = $6EDA0026;    //* OG.. */  /* V6.7 */
  TT_FontHeight                 = $6EDA0027;    //* .G.. */  /* V6.7 */
  TT_FontWidth                  = $6EDA0028;    //* .G.. */  /* V6.7 */
  TT_DiskFontMetrics            = $6EDA0029;    //* ..SP */  /* V6.7 */
  TT_ForceFixedWidth            = $6EDA0030;    //* ..SP */  /* V7.2 */

Type
  //* Structure returned by TT_GetPixmap() (V5)*/
  PTT_Pixmap = ^TT_Pixmap;
  TT_Pixmap = record
    ttp_Size    : ULONG;                        //* size of the structure includung this field */
    ttp_Width   : ULONG;                        //* number of rows */
    ttp_Height  : ULONG;                        //* also equal to bytes per row */
    ttp_Data    : PByteArray;                   // PUBYTE //* grayscale pixmap data */ 
  end;
  
Const
  //* font requester attributes (V6) */
                                                //* type,             default value     */
  TTRQ_Window                   = $6EDA2000;    //* struct Window*,   NULL              */
  TTRQ_PubScreenName            = $6EDA2001;    //* STRPTR,           NULL [Workbench]  */
  TTRQ_Screen                   = $6EDA2002;    //* struct Screen*,   NULL              */
  TTRQ_SleepWindow              = $6EDA2003;    //* BOOL,             FALSE             */
  TTRQ_TitleText                = $6EDA2004;    //* STRPTR,           "Select TrueType font" or localized */
  TTRQ_PositiveText             = $6EDA2005;    //* STRPTR,           "OK" or localized */
  TTRQ_NegativeText             = $6EDA2006;    //* STRPTR,           "Cancel" or localized */
  TTRQ_InitialLeftEdge          = $6EDA2007;    //* WORD,             centered on screen */
  TTRQ_InitialTopEdge           = $6EDA2008;    //* WORD,             centered on screen */
  TTRQ_InitialWidth             = $6EDA2009;    //* WORD,             max(200, 25% of sceeen width) */
  TTRQ_InitialHeight            = $6EDA200A;    //* WORD,             max(200, 50% of screen height) */
  TTRQ_DoSizes                  = $6EDA200B;    //* BOOL,             TRUE              */
  TTRQ_DoWeight                 = $6EDA200C;    //* BOOL,             FALSE             */
  TTRQ_DoStyle                  = $6EDA200D;    //* BOOL,             FALSE             */
  TTRQ_Activate                 = $6EDA200E;    //* BOOL,             TRUE              */
  TTRQ_InitialSize              = $6EDA200F;    //* LONG,             0 [no size]       */
  TTRQ_InitialName              = $6EDA2010;    //* STRPTR,           NULL [no name]    */
  TTRQ_InitialStyle             = $6EDA2011;    //* LONG,             TT_FontStyle_Regular */
  TTRQ_DoPreview                = $6EDA2012;    //* BOOL,             FALSE             */
  TTRQ_FixedWidthOnly           = $6EDA2013;    //* BOOL,             FALSE             */  
  
  
//
//  ttengine-7.2-aros-i386\Developer\include_aros\clib\ttengine_protos.h
//  
  
var
  TTEngineBase : pLibrary;

  Function  TT_OpenFontA(taglist: PTagItem): APTR;                              syscall TTEngineBase 5;
  Function  TT_SetFont(rp: PRastPort; font: APTR): BOOL;                        syscall TTEngineBase 6;
  procedure TT_CloseFont(font: APTR);                                           syscall TTEngineBase 7;
  procedure TT_Text(rp: PRastPort; string_: APTR; count: ULONG);                syscall TTEngineBase 8;
  Function  TT_SetAttrsA(rp: PRastPort; taglist: PTagItem): ULONG;              syscall TTEngineBase 9;
  Function  TT_GetAttrsA(rp: PRastPort; taglist: PTagItem): ULONG;              syscall TTEngineBase 10;
  Function  TT_TextLength(rp: PRastPort; string_: APTR; count: ULONG): ULONG;   syscall TTEngineBase 11;
  Procedure TT_TextExtent(rp: PRastPort; string_: APTR; count: WORD; te: PTextExtent); syscall TTEngineBase 12;
  Function  TT_TextFit(rp: PRastPort; string_: APTR; count: UWORD; te: PTextExtent; tec: PTextExtent; dir: WORD; cwidth: UWORD; cheight: UWORD): ULONG; syscall TTEngineBase 13;

  //*--- functions in V5 or higher ---*/
  Function  TT_GetPixmapA(font: APTR; string_: APTR; count: ULONG; taglist: PTagItem): PTT_Pixmap; syscall TTEngineBase 14;
  Procedure TT_FreePixmap(pixmap: PTT_Pixmap);                                  syscall TTEngineBase 15;
  Procedure TT_DoneRastPort(rp: PRastPort);                                     syscall TTEngineBase 16;
  
  //*--- functions in V6 or higher ---*/
  Function  TT_AllocRequest: APTR;                                              syscall TTEngineBase 17;
  Function  TT_RequestA(request: APTR; taglist: PTagItem): PTagItem;            syscall TTEngineBase 18;
  Procedure TT_FreeRequest(request: APTR);                                      syscall TTEngineBase 19;
  
  //*--- functions in V7 or higher ---*/
  Function  TT_ObtainFamilyListA(taglist: PTagItem): PSTRPTR;                   syscall TTEngineBase 20;
  Procedure TT_FreeFamilyList(list: PSTRPTR);                                   syscall TTEngineBase 21;


  { Pascal varargs versions }
  Function  TT_OpenFont(const Tags: array of const): APTR;
  Function  TT_SetAttrs(rp: PRastPort; const Tags: array of const): ULONG;
  Function  TT_GetAttrs(rp: PRastPort; const Tags: array of const): ULONG;
  Function  TT_GetPixmap(font: APTR; string_: APTR; count: ULONG; const Tags: array of const): PTT_Pixmap;
  Function  TT_Request(request: APTR; const Tags: array of const): PTagItem;
  Function  TT_ObtainFamilyList(const Tags: array of const): PSTRPTR;
  


implementation



Uses
  aros_modern_Tags;


//
//  ttengine-7.2-aros-i386\Developer\include_aros\defines\ttengine.h
//  


Function  TT_OpenFont(const Tags: array of const): APTR;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_OpenFontA(TagItems);
  //TagItems := 0;  
end;


Function  TT_SetAttrs(rp: PRastPort; const Tags: array of const): ULONG;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_SetAttrsA(rp, TagItems);
  //TagItems := 0;
end;


Function  TT_GetAttrs(rp: PRastPort; const Tags: array of const): ULONG;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_GetAttrsA(rp, TagItems);
  //TagItems := 0;
end;


Function  TT_GetPixmap(font: APTR; string_: APTR; count: ULONG; const Tags: array of const): PTT_Pixmap;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_GetPixmapA(font, string_, count, TagItems);
  //TagItems := 0;
end;


Function  TT_Request(request: APTR; const Tags: array of const): PTagItem;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_RequestA(request, TagItems);
  //TagItems := 0;
end;


Function  TT_ObtainFamilyList(const Tags: array of const): PSTRPTR;
Var TagItems: TArosTags;
begin
  //TagItems := 0;
  TagItems.Add(Tags);
  Result := TT_ObtainFamilyListA(TagItems);
  //TagItems := 0;  
end;



Initialization
  TTEngineBase := OpenLibrary(TTENGINENAME, TTENGINEVERSION);


finalization
  CloseLibrary(TTEngineBase);

end.


Unit documentation

Currently there's no Free Pascal specific documentation available for this unit. Please consult the original SDK.