Package Name: quickdrawtext

Return to: Package List


with Interfaces.C.Extensions; use Interfaces.C.Extensions;
with Types; use Types;

package QuickdrawText is
   --  
   --  File:       QuickdrawText.h
   --  
   --  Contains:   QuickDraw Text Interfaces.
   --  
   --  Version:    Technology: System 7.5
   --              Package:	Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
   --  
   --  Copyright:  © 1984-1995 by Apple Computer, Inc.
   --              All rights reserved.

   --  
   --  CharToPixel directions
	leftCaret    : constant := 0;  --Place caret for left block
	rightCaret   : constant := -1; --Place caret for right block
	hilite       : constant := 1;  --Direction is SysDirection
	smLeftCaret  : constant := 0;  --Place caret for left block - obsolete
	smRightCaret : constant := -1; --Place caret for right block - obsolete *

	smHilite     : constant := 1;  --Direction is TESysJust - obsolete
   --  Constants for styleRunPosition argument in PortionLine, DrawJustified,
   --  MeasureJustified, CharToPixel, and PixelToChar.
	onlyStyleRun     : constant := 0; --This is the only style run on the line
	leftStyleRun     : constant := 1; --This is leftmost of multiple style runs on the line
	rightStyleRun    : constant := 2; --This is rightmost of multiple style runs on the line
	middleStyleRun   : constant := 3; --There are multiple style runs on the line and this 
                                     --is neither the leftmost nor the rightmost.
	smOnlyStyleRun   : constant := 0; --obsolete
	smLeftStyleRun   : constant := 1; --obsolete
	smRightStyleRun  : constant := 2; --obsolete

	smMiddleStyleRun : constant := 3; --obsolete
   --  type for styleRunPosition parameter in PixelToChar etc.

   subtype JustStyleCode is Short_Integer;
   type Short_Integer_Vec_1 is array (0 .. 0) of Short_Integer;
   subtype FormatOrder is Short_Integer_Vec_1;

   type FormatOrderPtr is Access FormatOrder;
   type OffPair is 
      record
         offFirst : Short_Integer;
         offSecond : Short_Integer;
      end record;

   type OffPair_Vec_3 is array (0 .. 2) of OffPair;

   subtype OffsetTable is OffPair_Vec_3;
   type StyleRunDirectionProcPtr is access      function (styleRunIndex
                         : in     Short_Integer; dirParam

                         : in     Void_Ptr) return Boolean;

   subtype StyleRunDirectionUPP is UniversalProcPtr;
   function Pixel2Char
     (textBuf            : in     Ptr;
      textLen            : in     Short_Integer;
      slop               : in     Short_Integer;
      pixelWidth         : in     Short_Integer;
      leadingEdge        : access Boolean)
      return                      Short_Integer;

   pragma Import (C, Pixel2Char, "Pixel2Char", "Pixel2Char");
   function Char2Pixel
     (textBuf            : in     Ptr;
      textLen            : in     Short_Integer;
      slop               : in     Short_Integer;
      offset             : in     Short_Integer;
      direction          : in     Short_Integer)
      return                      Short_Integer;

   pragma Import (C, Char2Pixel, "Char2Pixel", "Char2Pixel");
   function PixelToChar
     (textBuf            : in     Ptr;
      textLength         : in     Long_Integer;
      slop               : in     Fixed;
      pixelWidth         : in     Fixed;
      leadingEdge        : access Boolean;
      widthRemaining     : access Fixed;
      styleRunPosition   : in     JustStyleCode;
      numer              : in     Point;
      denom              : in     Point)
      return                      Short_Integer;

   pragma Import (C, PixelToChar, "PixelToChar", "PixelToChar");
   function CharToPixel
     (textBuf            : in     Ptr;
      textLength         : in     Long_Integer;
      slop               : in     Fixed;
      offset             : in     Long_Integer;
      direction          : in     Short_Integer;
      styleRunPosition   : in     JustStyleCode;
      numer              : in     Point;
      denom              : in     Point)
      return                      Short_Integer;

   pragma Import (C, CharToPixel, "CharToPixel", "CharToPixel");
   procedure DrawJustified
     (textPtr            : in     Ptr;
      textLength         : in     Long_Integer;
      slop               : in     Fixed;
      styleRunPosition   : in     JustStyleCode;
      numer              : in     Point;
      denom              : in     Point);

   pragma Import (C, DrawJustified, "DrawJustified", "DrawJustified");
   procedure MeasureJustified
     (textPtr            : in     Ptr;
      textLength         : in     Long_Integer;
      slop               : in     Fixed;
      charLocs           : in     Ptr;
      styleRunPosition   : in     JustStyleCode;
      numer              : in     Point;
      denom              : in     Point);

   pragma Import (C, MeasureJustified, "MeasureJustified", "MeasureJustified");
   function PortionLine
     (textPtr            : in     Ptr;
      textLen            : in     Long_Integer;
      styleRunPosition   : in     JustStyleCode;
      numer              : in     Point;
      denom              : in     Point)
      return                      Fixed;

   pragma Import (C, PortionLine, "PortionLine", "PortionLine");
   procedure HiliteText
     (textPtr            : in     Ptr;
      textLength         : in     Short_Integer;
      firstOffset        : in     Short_Integer;
      secondOffset       : in     Short_Integer;
      offsets            : in     OffsetTable);

   pragma Import (C, HiliteText, "HiliteText", "HiliteText");
   procedure DrawJust
     (textPtr            : in     Ptr;
      textLength         : in     Short_Integer;
      slop               : in     Short_Integer);

   pragma Import (C, DrawJust, "DrawJust", "DrawJust");
   procedure MeasureJust
     (textPtr            : in     Ptr;
      textLength         : in     Short_Integer;
      slop               : in     Short_Integer;
      charLocs           : in     Ptr);

   pragma Import (C, MeasureJust, "MeasureJust", "MeasureJust");
   function PortionText
     (textPtr            : in     Ptr;
      textLength         : in     Long_Integer)
      return                      Fixed;

   pragma Import (C, PortionText, "PortionText", "PortionText");
   function VisibleLength
     (textPtr            : in     Ptr;
      textLength         : in     Long_Integer)
      return                      Long_Integer;

   pragma Import (C, VisibleLength, "VisibleLength", "VisibleLength");
   procedure GetFormatOrder
     (ordering           : in     FormatOrderPtr;
      firstFormat        : in     Short_Integer;
      lastFormat         : in     Short_Integer;
      lineRight          : in     Boolean;
      rlDirProc          : in     StyleRunDirectionUPP;
      dirParam           : in     Ptr);

   pragma Import (C, GetFormatOrder, "GetFormatOrder", "GetFormatOrder");
   type FontInfo is 
      record
         ascent : Short_Integer;
         descent : Short_Integer;
         widMax : Short_Integer;
         leading : Short_Integer;

      end record;

   subtype FormatStatus is Short_Integer;
   procedure TextFont
     (font               : in     Short_Integer);

   pragma Import (C, TextFont, "TextFont", "TextFont");
   procedure TextFace
     (face               : in     Short_Integer);

   pragma Import (C, TextFace, "TextFace", "TextFace");
   procedure TextMode
     (mode               : in     Short_Integer);

   pragma Import (C, TextMode, "TextMode", "TextMode");
   procedure TextSize
     (size               : in     Short_Integer);

   pragma Import (C, TextSize, "TextSize", "TextSize");
   procedure SpaceExtra
     (extra              : in     Fixed);

   pragma Import (C, SpaceExtra, "SpaceExtra", "SpaceExtra");
   procedure DrawChar
     (ch                 : in     Short_Integer);

   pragma Import (C, DrawChar, "DrawChar", "DrawChar");
   procedure DrawString
     (s                  : access Str255);

   pragma Import (C, DrawString, "DrawString", "DrawString");
   procedure DrawText
     (textBuf            : in     Void_Ptr;
      firstByte          : in     Short_Integer;
      byteCount          : in     Short_Integer);

   pragma Import (C, DrawText, "DrawText", "DrawText");
   function CharWidth
     (ch                 : in     Short_Integer)
      return                      Short_Integer;

   pragma Import (C, CharWidth, "CharWidth", "CharWidth");
   function StringWidth
     (s                  : access Str255)
      return                      Short_Integer;

   pragma Import (C, StringWidth, "StringWidth", "StringWidth");
   function TextWidth
     (textBuf            : in     Void_Ptr;
      firstByte          : in     Short_Integer;
      byteCount          : in     Short_Integer)
      return                      Short_Integer;

   pragma Import (C, TextWidth, "TextWidth", "TextWidth");
   procedure MeasureText
     (count              : in     Short_Integer;
      textAddr           : in     Void_Ptr;
      charLocs           : in     Void_Ptr);

   pragma Import (C, MeasureText, "MeasureText", "MeasureText");
   procedure GetFontInfo
     (info               : access FontInfo);

   pragma Import (C, GetFontInfo, "GetFontInfo", "GetFontInfo");
   procedure CharExtra
     (extra              : in     Fixed);

   pragma Import (C, CharExtra, "CharExtra", "CharExtra");
   procedure StdText
     (count              : in     Short_Integer;
      textAddr           : in     Void_Ptr;
      numer              : in     Point;
      denom              : in     Point);

   pragma Import (C, StdText, "StdText", "StdText");
   function StdTxMeas
     (byteCount          : in     Short_Integer;
      textAddr           : in     Void_Ptr;
      numer              : access Point;
      denom              : access Point;
      info               : access FontInfo)
      return                      Short_Integer;

   pragma Import (C, StdTxMeas, "StdTxMeas", "StdTxMeas");
   procedure DrawString

     (s                  : in     String);
   function StringWidth
     (s                  : in     String)

      return                      Short_Integer;
end QuickdrawText;