From 0e1c50a2be0aa0a079c0bd7fa22436d95d559760 Mon Sep 17 00:00:00 2001 From: oscarl-2 Date: Sat, 20 Dec 2003 08:54:24 +0000 Subject: [PATCH] _string.pp changes --- .../bepascal/pas/src/be/interface/bitmap.pp | 238 +--------- .../bepascal/pas/src/be/interface/font.pp | 439 +++++++++++------- 2 files changed, 292 insertions(+), 385 deletions(-) diff --git a/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp b/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp index d15b847..843a2d7 100644 --- a/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp +++ b/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp @@ -23,7 +23,7 @@ unit Bitmap; interface uses - BeObj, Archivable, GraphicDefs, Message, OS, Rect, SupportDefs,accelerant; + BeObj, Archivable, GraphicDefs, Message, OS, Rect, SupportDefs, View; const B_BITMAP_CLEAR_TO_WHITE = $00000001; @@ -70,48 +70,17 @@ type cs : color_space); function GetOverlayRestrictions(restrict : overlay_restrictions) : status_t; -// procedure AddChild(view : BView); -// function RemoveChild(view : BView) : Boolean; + procedure AddChild(view : BView); + function RemoveChild(view : BView) : Boolean; function CountChildren : Integer; -// function ChildAt(index : Integer) : BView; -// function FindView(view_name : PChar) : BView; -// function FindView(point : BPoint) : BView; + function ChildAt(index : Integer) : BView; + function FindView(view_name : PChar) : BView; + function FindView(point : BPoint) : BView; function Lock : Boolean; procedure Unlock; function IsLocked : Boolean; function Perform(d : perform_code; arg : Pointer) : status_t; -{ - procedure _ReservedBitmap1; - procedure _ReservedBitmap2; - procedure _ReservedBitmap3; - constructor Create( : TBitmap); - function operator=( : TBitmap) : TBitmap; - function get_shared_pointer : PChar; - procedure set_bits(offset : integer; data : PChar; length : integer); - procedure set_bits_24(offset : integer; data : PChar; length : integer); - procedure set_bits_24_local_gray(offset : integer; data : PChar; len : integer); - procedure set_bits_24_local_256(offset : integer; data : PByte; len : integer); - procedure set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); - procedure set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); - procedure set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); - function get_server_token : integer; - procedure InitObject(frame : TRect; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); - procedure AssertPtr; - procedure void *fBasePtr; - procedure int32 fSize; - procedure color_space fType; - procedure BRect fBound; - procedure int32 fRowBytes; - procedure BWindow *fWindow; - procedure int32 fServerToken; - procedure int32 fToken; - procedure uint8 unused; - procedure area_id fArea; - procedure area_id fOrigArea; - procedure uint32 fFlags; - procedure status_t fInitError; -} end; function BBitmap_Create(AObject : TBeObject; frame : TCPlusObject; @@ -189,7 +158,7 @@ function BBitmap_RemoveChild(AObject : TCPlusObject; view : TCPlusObject) function BBitmap_CountChildren(AObject : TCPlusObject) : Integer; cdecl; external BePascalLibName name 'BBitmap_CountChildren'; -(*function BBitmap_ChildAt(AObject : TCPlusObject; index : Integer) : BView; +function BBitmap_ChildAt(AObject : TCPlusObject; index : Integer) : BView; cdecl; external BePascalLibName name 'BBitmap_ChildAt'; function BBitmap_FindView(AObject : TCPlusObject; view_name : PChar) : BView; @@ -197,7 +166,7 @@ function BBitmap_FindView(AObject : TCPlusObject; view_name : PChar) : BView; function BBitmap_FindView(AObject : TCPlusObject; point : {BPoint}TCPlusObject) : BView; cdecl; external BePascalLibName name 'BBitmap_FindView'; -*) + function BBitmap_Lock(AObject : TCPlusObject) : Boolean; cdecl; external BePascalLibName name 'BBitmap_Lock'; @@ -209,38 +178,6 @@ function BBitmap_IsLocked(AObject : TCPlusObject) : Boolean; cdecl; function BBitmap_Perform(AObject : TCPlusObject; d : perform_code; arg : Pointer) : status_t; cdecl; external BePascalLibName name 'BBitmap_Perform'; -{ -procedure BBitmap__ReservedBitmap1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap1'; -procedure BBitmap__ReservedBitmap2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap2'; -procedure BBitmap__ReservedBitmap3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap3'; -function BBitmap_Create(AObject : TBeObject; : TBitmap); cdecl; external BePascalLibName name 'BBitmap_Create'; -function BBitmap_operator=(AObject : TCPlusObject; : TBitmap) : TBitmap; cdecl; external BePascalLibName name 'BBitmap_operator='; -function BBitmap_get_shared_pointer(AObject : TCPlusObject) : PChar; cdecl; external BePascalLibName name 'BBitmap_get_shared_pointer'; -procedure BBitmap_set_bits(AObject : TCPlusObject; offset : integer; data : PChar; length : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits'; -procedure BBitmap_set_bits_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24'; -procedure BBitmap_set_bits_24_local_gray(AObject : TCPlusObject; offset : integer; data : PChar; len : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_local_gray'; -procedure BBitmap_set_bits_24_local_256(AObject : TCPlusObject; offset : integer; data : PByte; len : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_local_256'; -procedure BBitmap_set_bits_24_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_24'; -procedure BBitmap_set_bits_8_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_8_24'; -procedure BBitmap_set_bits_gray_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_gray_24'; -function BBitmap_get_server_token(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BBitmap_get_server_token'; -procedure BBitmap_InitObject(AObject : TCPlusObject; frame : TCPlusObject; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); cdecl; external BePascalLibName name 'BBitmap_InitObject'; -procedure BBitmap_AssertPtr(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_AssertPtr'; -procedure BBitmap_void *fBasePtr(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_void *fBasePtr'; -procedure BBitmap_int32 fSize(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fSize'; -procedure BBitmap_color_space fType(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_color_space fType'; -procedure BBitmap_BRect fBound(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_BRect fBound'; -procedure BBitmap_int32 fRowBytes(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fRowBytes'; -procedure BBitmap_BWindow *fWindow(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_BWindow *fWindow'; -procedure BBitmap_int32 fServerToken(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fServerToken'; -procedure BBitmap_int32 fToken(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fToken'; -procedure BBitmap_uint8 unused(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_uint8 unused'; -procedure BBitmap_area_id fArea(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_area_id fArea'; -procedure BBitmap_area_id fOrigArea(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_area_id fOrigArea'; -procedure BBitmap_uint32 fFlags(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_uint32 fFlags'; -procedure BBitmap_status_t fInitError(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_status_t fInitError'; -} - implementation { -- NOTE! @@ -275,8 +212,8 @@ end; constructor BBitmap.Create(source : BBitmap; accepts_views : Boolean; need_contiguous : Boolean); begin - CreatePas; - CPlusObject := BBitmap_Create_2(Self, source, accepts_views, need_contiguous); + CreatePas; + CPlusObject := BBitmap_Create_2(Self, source, accepts_views, need_contiguous); end; constructor BBitmap.Create(data : BMessage); @@ -361,7 +298,7 @@ begin Result := BBitmap_GetOverlayRestrictions(CPlusObject, restrict); end; -(*procedure BBitmap.AddChild(view : BView); +procedure BBitmap.AddChild(view : BView); begin BBitmap_AddChild(CPlusObject, view.CPlusObject); end; @@ -370,14 +307,13 @@ function BBitmap.RemoveChild(view : BView) : Boolean; begin Result := BBitmap_RemoveChild(CPlusObject, view.CPlusObject); end; -*) function BBitmap.CountChildren : Integer; begin Result := BBitmap_CountChildren(CPlusObject); end; -(*function BBitmap.ChildAt(index : Integer) : BView; +function BBitmap.ChildAt(index : Integer) : BView; begin Result := BBitmap_ChildAt(CPlusObject, index); end; @@ -391,7 +327,6 @@ function BBitmap.FindView(point : BPoint) : BView; begin Result := BBitmap_FindView(CPlusObject, point.CPlusObject); end; -*) function BBitmap.Lock : Boolean; begin @@ -413,151 +348,4 @@ begin Result := BBitmap_Perform(CPlusObject, d, arg); end; -{ -procedure TBitmap._ReservedBitmap1; -begin - BBitmap__ReservedBitmap1(CPlusObject); -end; - -procedure TBitmap._ReservedBitmap2; -begin - BBitmap__ReservedBitmap2(CPlusObject); -end; - -procedure TBitmap._ReservedBitmap3; -begin - BBitmap__ReservedBitmap3(CPlusObject); -end; - -constructor TBitmap.Create( : TBitmap); -begin - CPlusObject := BBitmap_Create(Self, ); -end; - -function TBitmap.operator=( : TBitmap) : TBitmap; -begin - Result := BBitmap_operator=(CPlusObject, ); -end; - -function TBitmap.get_shared_pointer : PChar; -begin - Result := BBitmap_get_shared_pointer(CPlusObject); -end; - -procedure TBitmap.set_bits(offset : integer; data : PChar; length : integer); -begin - BBitmap_set_bits(CPlusObject, offset, data, length); -end; - -procedure TBitmap.set_bits_24(offset : integer; data : PChar; length : integer); -begin - BBitmap_set_bits_24(CPlusObject, offset, data, length); -end; - -procedure TBitmap.set_bits_24_local_gray(offset : integer; data : PChar; len : integer); -begin - BBitmap_set_bits_24_local_gray(CPlusObject, offset, data, len); -end; - -procedure TBitmap.set_bits_24_local_256(offset : integer; data : PByte; len : integer); -begin - BBitmap_set_bits_24_local_256(CPlusObject, offset, data, len); -end; - -procedure TBitmap.set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); -begin - BBitmap_set_bits_24_24(CPlusObject, offset, data, length, big_endian_dst); -end; - -procedure TBitmap.set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); -begin - BBitmap_set_bits_8_24(CPlusObject, offset, data, length, big_endian_dst); -end; - -procedure TBitmap.set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); -begin - BBitmap_set_bits_gray_24(CPlusObject, offset, data, length, big_endian_dst); -end; - -function TBitmap.get_server_token : integer; -begin - Result := BBitmap_get_server_token(CPlusObject); -end; - -procedure TBitmap.InitObject(frame : TRect; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); -begin - BBitmap_InitObject(CPlusObject, frame.CPlusObject, depth, flags, bytesPerRow, screenID); -end; - -procedure TBitmap.AssertPtr; -begin - BBitmap_AssertPtr(CPlusObject); -end; - -procedure TBitmap.void *fBasePtr; -begin - BBitmap_void *fBasePtr(CPlusObject); -end; - -procedure TBitmap.int32 fSize; -begin - BBitmap_int32 fSize(CPlusObject); -end; - -procedure TBitmap.color_space fType; -begin - BBitmap_color_space fType(CPlusObject); -end; - -procedure TBitmap.BRect fBound; -begin - BBitmap_BRect fBound(CPlusObject); -end; - -procedure TBitmap.int32 fRowBytes; -begin - BBitmap_int32 fRowBytes(CPlusObject); -end; - -procedure TBitmap.BWindow *fWindow; -begin - BBitmap_BWindow *fWindow(CPlusObject); -end; - -procedure TBitmap.int32 fServerToken; -begin - BBitmap_int32 fServerToken(CPlusObject); -end; - -procedure TBitmap.int32 fToken; -begin - BBitmap_int32 fToken(CPlusObject); -end; - -procedure TBitmap.uint8 unused; -begin - BBitmap_uint8 unused(CPlusObject); -end; - -procedure TBitmap.area_id fArea; -begin - BBitmap_area_id fArea(CPlusObject); -end; - -procedure TBitmap.area_id fOrigArea; -begin - BBitmap_area_id fOrigArea(CPlusObject); -end; - -procedure TBitmap.uint32 fFlags; -begin - BBitmap_uint32 fFlags(CPlusObject); -end; - -procedure TBitmap.status_t fInitError; -begin - BBitmap_status_t fInitError(CPlusObject); -end; -} - -end. +end. \ No newline at end of file diff --git a/bepascal/source/bepascal/pas/src/be/interface/font.pp b/bepascal/source/bepascal/pas/src/be/interface/font.pp index 5df64bd..897f606 100644 --- a/bepascal/source/bepascal/pas/src/be/interface/font.pp +++ b/bepascal/source/bepascal/pas/src/be/interface/font.pp @@ -1,6 +1,7 @@ { BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde + Oscar Lesta This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -16,124 +17,170 @@ License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA } -unit font; +unit Font; interface uses - beobj,flattenable,interfacedefs,supportdefs,rect,bstring; - -type - font_which= ( - font_which_nil, - B_PLAIN_FONT, - B_BOLD_FONT, - B_FIXED_FONT, - B_SYMBOL_FONT, - B_SERIF_FONT -); + BeObj, Flattenable, InterfaceDefs, Rect, _String, SupportDefs; const - B__NUM_FONT = 5; - // Attention this is hexadecimal; need conversion !!!! - B_ITALIC_FACE = $0001; - B_UNDERSCORE_FACE = $0002; - B_NEGATIVE_FACE = $0004; - B_OUTLINED_FACE = $0008; - B_STRIKEOUT_FACE = $0010; - B_BOLD_FACE = $0020; - B_REGULAR_FACE = $0040; + B_FONT_FAMILY_LENGTH = 63; + B_FONT_STYLE_LENGTH = 63; type + font_family = string[B_FONT_FAMILY_LENGTH + 1]; //array[0..B_FONT_FAMILY_LENGTH] of char; + font_style = string[B_FONT_STYLE_LENGTH + 1]; //array[0..B_FONT_STYLE_LENGTH] of char; -font_metric_mode = ( - B_SCREEN_METRIC, - B_PRINTING_METRIC); - - font_file_format =( - B_TRUETYPE_WINDOWS , - B_POSTSCRIPT_TYPE1_WINDOWS); - - -const B_FONT_FAMILY_LENGTH= 63; - -type FONT_FAMILY = array[0..B_FONT_FAMILY_LENGTH] of char; - -const B_FONT_STYLE_LENGTH= 63; - -type font_style = array[0..B_FONT_STYLE_LENGTH ] of char; +const + B_CHAR_SPACING = 0; + B_STRING_SPACING = 1; + B_BITMAP_SPACING = 2; + B_FIXED_SPACING = 3; type -escapement_delta = record - nonspace : real; - space: real; -end; -edge_info = record - left: real; - right: real; -end; -tuned_font_info = record - size : real; - shear: real ; - rotation : real; - flags: cardinal; - face : integer; -end; + font_direction = ( + B_FONT_LEFT_TO_RIGHT, + B_FONT_RIGHT_TO_LEFT + ); + +const + B_DISABLE_ANTIALIASING = $00000001; + B_FORCE_ANTIALIASING = $00000002; - -font_height = record - ascent: real; - descent: real; - leading: real; -end; - -font_direction =( - B_FONT_LEFT_TO_RIGHT , - B_FONT_RIGHT_TO_LEFT -); + B_TRUNCATE_END = 0; + B_TRUNCATE_BEGINNING = 1; + B_TRUNCATE_MIDDLE = 2; + B_TRUNCATE_SMART = 3; + B_UNICODE_UTF8 = 0; + B_ISO_8859_1 = 1; + B_ISO_8859_2 = 2; + B_ISO_8859_3 = 3; + B_ISO_8859_4 = 4; + B_ISO_8859_5 = 5; + B_ISO_8859_6 = 6; + B_ISO_8859_7 = 7; + B_ISO_8859_8 = 8; + B_ISO_8859_9 = 9; + B_ISO_8859_10 = 10; + B_MACINTOSH_ROMAN = 11; + + + B_SCREEN_FONT_CACHE = $0001; + B_PRINTING_FONT_CACHE = $0002; + B_DEFAULT_CACHE_SETTING = $0004; + B_APP_CACHE_SETTING = $0008; + + + B_HAS_TUNED_FONT = $0001; + B_IS_FIXED = $0002; + + +// B__NUM_FONT = 5; + + B_ITALIC_FACE = $0001; + B_UNDERSCORE_FACE = $0002; + B_NEGATIVE_FACE = $0004; + B_OUTLINED_FACE = $0008; + B_STRIKEOUT_FACE = $0010; + B_BOLD_FACE = $0020; + B_REGULAR_FACE = $0040; type - BFont = class(TBeObject) - private + font_metric_mode = ( + B_SCREEN_METRIC, + B_PRINTING_METRIC + ); + + font_file_format = ( + B_TRUETYPE_WINDOWS, + B_POSTSCRIPT_TYPE1_WINDOWS + ); +{ + font_which = (font_which_nil, + B_PLAIN_FONT, + B_BOLD_FONT, + B_FIXED_FONT, + B_SYMBOL_FONT, + B_SERIF_FONT + ); +} + +type + edge_info = record + left, + right : Single; + end; + + font_height = record + ascent, + descent, + leading: Single; + end; + + escapement_delta = record + nonspace, + space : Single; + end; + + font_cache_info = record + sheared_font_penalty, + rotated_font_penalty : Longint; + oversize_threshold : Single; + oversize_penalty, + cache_size : Longint; + spacing_size_threshold : Single; + end; + + tuned_font_info = record + size, + shear, + rotation : Single; + flags : Longword; + face : Word; + end; + +type + BFont = class(TBeObject) public constructor Create; - constructor Create(font : BFont);virtual; + constructor Create(font : BFont); virtual; destructor Destroy;override; - function SetFamilyAndStyle(family : Font_FAMILY; style : Font_style) : Status_t; - procedure SetFamilyAndStyle(code : Cardinal); - function SetFamilyAndFace(family : Font_FAMILY; aface : integer) : Status_t; - procedure SetSize(asize : single); - procedure SetShear(ashear : single); - procedure SetRotation(arotation : single); - procedure SetSpacing(aspacing : integer); - procedure SetEncoding(aencoding : integer); - procedure SetFace(aface :integer ); - procedure SetFlags(aflags : Cardinal); - procedure GetFamilyAndStyle(family : Font_FAMILY; style : Font_style); - function FamilyAndStyle : Cardinal; - function Size : single; - function Shear : single; - function Rotation : single; - function Spacing : integer; - function Encoding : integer; - function Face : integer; - function Flags : Cardinal; + function SetFamilyAndStyle(family : Font_FAMILY; style : font_style) : status_t; + procedure SetFamilyAndStyle(code : Longword); + function SetFamilyAndFace(family : Font_FAMILY; aface : Word) : status_t; + procedure SetSize(asize : Single); + procedure SetShear(ashear : Single); + procedure SetRotation(arotation : Single); + procedure SetSpacing(aspacing : Byte); + procedure SetEncoding(aencoding : Byte); + procedure SetFace(aface : Word); + procedure SetFlags(aflags : Longword); + procedure GetFamilyAndStyle(family : font_family; style : font_style); + function FamilyAndStyle : Longword; + function Size : Single; + function Shear : Single; + function Rotation : Single; + function Spacing : Byte; + function Encoding : Byte; + function Face : Word; + function Flags : Longword; function Direction : Font_direction; - function IsFixed : boolean; - function IsFullAndHalfFixed : boolean; + function IsFixed : Boolean; + function IsFullAndHalfFixed : Boolean; function BoundingBox : BRect; // function Blocks : ; function FileFormat : Font_file_format; - function CountTuned : integer; - procedure GetTunedInfo(index : integer; info : tuned_font_info); - procedure TruncateString(in_out : TString; mode : Cardinal; width : single); + function CountTuned : Longint; + procedure GetTunedInfo(index : Longint; info : tuned_font_info); + procedure TruncateString(in_out : BString; mode : Longword; width : Single); // procedure GetTruncatedStrings(stringArray : PChar; numStrings : integer; mode : Cardinal; width : single; resultArray : Pchar); // procedure GetTruncatedStrings(stringArray : PChar; numStrings : integer; mode : Cardinal; width : single; resultArray : PChar); - function StringWidth(astring : PChar) : single; - function StringWidth(astring : PChar; length : integer) : single; + function StringWidth(astring : PChar) : Single; + function StringWidth(astring : PChar; length : Longint) : Single; // procedure GetStringWidths(stringArray : PChar; lengthArray : integer; numStrings : integer; widthArray : single); // procedure GetEscapements(charArray : ; numChars : integer; escapementArray : single); // procedure GetEscapements(charArray : ; numChars : integer; delta : ; escapementArray : single); @@ -169,48 +216,85 @@ procedure tuned_font_info_uint32 flags(AObject : TCPlusObject); cdecl; external procedure tuned_font_info_uint16 face(AObject : TCPlusObject); cdecl; external BePascalLibName name 'tuned_font_info_uint16 face'; } -function BFont_Create(AObject : TBeObject): TCPlusObject; cdecl; external BePascalLibName name 'BFont_Create'; -function BFont_Create(AObject : TBeObject; font : BFont): TCPlusObject; cdecl; external BePascalLibName name 'BFont_Create_1'; -procedure BFont_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFont_Free'; -function BFont_SetFamilyAndStyle(AObject : TCPlusObject; family : Font_family; style : Font_style) : Status_t; cdecl; external BePascalLibName name 'BFont_SetFamilyAndStyle'; -procedure BFont_SetFamilyAndStyle(AObject : TCPlusObject; code : Cardinal); cdecl; external BePascalLibName name 'BFont_SetFamilyAndStyle'; -function BFont_SetFamilyAndFace(AObject : TCPlusObject; family : Font_family; face : integer) : Status_t; cdecl; external BePascalLibName name 'BFont_SetFamilyAndFace'; -procedure BFont_SetSize(AObject : TCPlusObject; size : single); cdecl; external BePascalLibName name 'BFont_SetSize'; -procedure BFont_SetShear(AObject : TCPlusObject; shear : single); cdecl; external BePascalLibName name 'BFont_SetShear'; -procedure BFont_SetRotation(AObject : TCPlusObject; rotation : single); cdecl; external BePascalLibName name 'BFont_SetRotation'; -procedure BFont_SetSpacing(AObject : TCPlusObject; spacing : integer); cdecl; external BePascalLibName name 'BFont_SetSpacing'; -procedure BFont_SetEncoding(AObject : TCPlusObject; encoding : integer); cdecl; external BePascalLibName name 'BFont_SetEncoding'; -procedure BFont_SetFace(AObject : TCPlusObject; face :integer ); cdecl; external BePascalLibName name 'BFont_SetFace'; -procedure BFont_SetFlags(AObject : TCPlusObject; flags : Cardinal); cdecl; external BePascalLibName name 'BFont_SetFlags'; -procedure BFont_GetFamilyAndStyle(AObject : TCPlusObject; family : Font_family; style : Font_style); cdecl; external BePascalLibName name 'BFont_GetFamilyAndStyle'; -function BFont_FamilyAndStyle(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BFont_FamilyAndStyle'; -function BFont_Size(AObject : TCPlusObject) : single; cdecl; external BePascalLibName name 'BFont_Size'; -function BFont_Shear(AObject : TCPlusObject) : single; cdecl; external BePascalLibName name 'BFont_Shear'; -function BFont_Rotation(AObject : TCPlusObject) : single; cdecl; external BePascalLibName name 'BFont_Rotation'; -function BFont_Spacing(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BFont_Spacing'; -function BFont_Encoding(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BFont_Encoding'; -function BFont_Face(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BFont_Face'; -function BFont_Flags(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BFont_Flags'; +function BFont_Create(AObject : TBeObject) : TCPlusObject; + cdecl; external BePascalLibName name 'BFont_Create'; +function BFont_Create(AObject : TBeObject; font : BFont) : TCPlusObject; + cdecl; external BePascalLibName name 'BFont_Create_1'; +procedure BFont_Free(AObject : TCPlusObject); + cdecl; external BePascalLibName name 'BFont_Free'; +function BFont_SetFamilyAndStyle(AObject : TCPlusObject; family : font_family; + style : font_style) : status_t; + cdecl; external BePascalLibName name 'BFont_SetFamilyAndStyle'; +procedure BFont_SetFamilyAndStyle(AObject : TCPlusObject; code : Longword); + cdecl; external BePascalLibName name 'BFont_SetFamilyAndStyle'; +function BFont_SetFamilyAndFace(AObject : TCPlusObject; family : font_family; + face : Word) : status_t; + cdecl; external BePascalLibName name 'BFont_SetFamilyAndFace'; +procedure BFont_SetSize(AObject : TCPlusObject; size : Single); + cdecl; external BePascalLibName name 'BFont_SetSize'; +procedure BFont_SetShear(AObject : TCPlusObject; shear : Single); + cdecl; external BePascalLibName name 'BFont_SetShear'; +procedure BFont_SetRotation(AObject : TCPlusObject; rotation : Single); + cdecl; external BePascalLibName name 'BFont_SetRotation'; +procedure BFont_SetSpacing(AObject : TCPlusObject; spacing : Byte); + cdecl; external BePascalLibName name 'BFont_SetSpacing'; +procedure BFont_SetEncoding(AObject : TCPlusObject; encoding : Byte); + cdecl; external BePascalLibName name 'BFont_SetEncoding'; +procedure BFont_SetFace(AObject : TCPlusObject; face : Word); + cdecl; external BePascalLibName name 'BFont_SetFace'; +procedure BFont_SetFlags(AObject : TCPlusObject; flags : Longword); + cdecl; external BePascalLibName name 'BFont_SetFlags'; +procedure BFont_GetFamilyAndStyle(AObject : TCPlusObject; family : font_family; + style : font_style); + cdecl; external BePascalLibName name 'BFont_GetFamilyAndStyle'; +function BFont_FamilyAndStyle(AObject : TCPlusObject) : Longword; + cdecl; external BePascalLibName name 'BFont_FamilyAndStyle'; +function BFont_Size(AObject : TCPlusObject) : Single; + cdecl; external BePascalLibName name 'BFont_Size'; +function BFont_Shear(AObject : TCPlusObject) : Single; + cdecl; external BePascalLibName name 'BFont_Shear'; +function BFont_Rotation(AObject : TCPlusObject) : Single; + cdecl; external BePascalLibName name 'BFont_Rotation'; +function BFont_Spacing(AObject : TCPlusObject) : Byte; + cdecl; external BePascalLibName name 'BFont_Spacing'; +function BFont_Encoding(AObject : TCPlusObject) : Byte; + cdecl; external BePascalLibName name 'BFont_Encoding'; +function BFont_Face(AObject : TCPlusObject) : Word; + cdecl; external BePascalLibName name 'BFont_Face'; +function BFont_Flags(AObject : TCPlusObject) : Longword; + cdecl; external BePascalLibName name 'BFont_Flags'; function BFont_Direction(AObject : TCPlusObject) : Font_direction; cdecl; external BePascalLibName name 'BFont_Direction'; -function BFont_IsFixed(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BFont_IsFixed'; -function BFont_IsFullAndHalfFixed(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BFont_IsFullAndHalfFixed'; -function BFont_BoundingBox(AObject : TCPlusObject) : BRect; cdecl; external BePascalLibName name 'BFont_BoundingBox'; +function BFont_IsFixed(AObject : TCPlusObject) : Boolean; cdecl; external BePascalLibName name 'BFont_IsFixed'; +function BFont_IsFullAndHalfFixed(AObject : TCPlusObject) : Boolean; + cdecl; external BePascalLibName name 'BFont_IsFullAndHalfFixed'; +function BFont_BoundingBox(AObject : TCPlusObject) : BRect; + cdecl; external BePascalLibName name 'BFont_BoundingBox'; //function BFont_Blocks(AObject : TCPlusObject) : ; cdecl; external BePascalLibName name 'BFont_Blocks'; -function BFont_FileFormat(AObject : TCPlusObject) :Font_file_format ; cdecl; external BePascalLibName name 'BFont_FileFormat'; -function BFont_CountTuned(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BFont_CountTuned'; -procedure BFont_GetTunedInfo(AObject : TCPlusObject; index : integer; info : tuned_font_info); cdecl; external BePascalLibName name 'BFont_GetTunedInfo'; -procedure BFont_TruncateString(AObject : TCPlusObject; in_out : TCPlusObject; mode : Cardinal; width : single); cdecl; external BePascalLibName name 'BFont_TruncateString'; +function BFont_FileFormat(AObject : TCPlusObject) : font_file_format; + cdecl; external BePascalLibName name 'BFont_FileFormat'; +function BFont_CountTuned(AObject : TCPlusObject) : Longint; + cdecl; external BePascalLibName name 'BFont_CountTuned'; +procedure BFont_GetTunedInfo(AObject : TCPlusObject; index : Longint; + info : tuned_font_info); + cdecl; external BePascalLibName name 'BFont_GetTunedInfo'; +procedure BFont_TruncateString(AObject : TCPlusObject; in_out : TCPlusObject; + mode : Longword; width : Single); + cdecl; external BePascalLibName name 'BFont_TruncateString'; //procedure BFont_GetTruncatedStrings(AObject : TCPlusObject; stringArray : PChar; numStrings : integer; mode : Cardinal; width : single; resultArray : ); cdecl; external BePascalLibName name 'BFont_GetTruncatedStrings'; //procedure BFont_GetTruncatedStrings(AObject : TCPlusObject; stringArray : PChar; numStrings : integer; mode : Cardinal; width : single; resultArray : PChar); cdecl; external BePascalLibName name 'BFont_GetTruncatedStrings'; -function BFont_StringWidth(AObject : TCPlusObject; astring : PChar) : single; cdecl; external BePascalLibName name 'BFont_StringWidth'; -function BFont_StringWidth(AObject : TCPlusObject; astring : PChar; length : integer) : single; cdecl; external BePascalLibName name 'BFont_StringWidth'; +function BFont_StringWidth(AObject : TCPlusObject; astring : PChar) : Single; + cdecl; external BePascalLibName name 'BFont_StringWidth'; +function BFont_StringWidth(AObject : TCPlusObject; astring : PChar; + length : Longint) : Single; + cdecl; external BePascalLibName name 'BFont_StringWidth'; //procedure BFont_GetStringWidths(AObject : TCPlusObject; stringArray : PChar; lengthArray : ; numStrings : integer; widthArray : single); cdecl; external BePascalLibName name 'BFont_GetStringWidths'; //procedure BFont_GetEscapements(AObject : TCPlusObject; charArray : ; numChars : integer; escapementArray : single); cdecl; external BePascalLibName name 'BFont_GetEscapements'; //procedure BFont_GetEscapements(AObject : TCPlusObject; charArray : ; numChars : integer; delta : ; escapementArray : single); cdecl; external BePascalLibName name 'BFont_GetEscapements'; //procedure BFont_GetEscapements(AObject : TCPlusObject; charArray : ; numChars : integer; delta : ; escapementArray : TPoint); cdecl; external BePascalLibName name 'BFont_GetEscapements'; //procedure BFont_GetEscapements(AObject : TCPlusObject; charArray : ; numChars : integer; delta : ; escapementArray : TPoint; offsetArray : TPoint); cdecl; external BePascalLibName name 'BFont_GetEscapements'; //procedure BFont_GetEdges(AObject : TCPlusObject; charArray : ; numBytes : integer; edgeArray : ); cdecl; external BePascalLibName name 'BFont_GetEdges'; -procedure BFont_GetHeight(AObject : TCPlusObject; height :Font_height ); cdecl; external BePascalLibName name 'BFont_GetHeight'; +procedure BFont_GetHeight(AObject : TCPlusObject; height : font_height ); + cdecl; external BePascalLibName name 'BFont_GetHeight'; {procedure BFont_GetBoundingBoxesAsGlyphs(AObject : TCPlusObject; charArray : ; numChars : integer; mode : ; boundingBoxArray : BRect); cdecl; external BePascalLibName name 'BFont_GetBoundingBoxesAsGlyphs'; procedure BFont_GetBoundingBoxesAsString(AObject : TCPlusObject; charArray : ; numChars : integer; mode : ; delta : ; boundingBoxArray : BRect); cdecl; external BePascalLibName name 'BFont_GetBoundingBoxesAsString'; @@ -221,7 +305,8 @@ function BFont_operator=(AObject : TCPlusObject; font : ) : ; cdecl; external Be function BFont_operator==(AObject : TCPlusObject; font : ) : boolean; cdecl; external BePascalLibName name 'BFont_operator=='; function BFont_operator!=(AObject : TCPlusObject; font : ) : boolean; cdecl; external BePascalLibName name 'BFont_operator!='; } -procedure BFont_PrintToStream(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFont_PrintToStream'; +procedure BFont_PrintToStream(AObject : TCPlusObject); + cdecl; external BePascalLibName name 'BFont_PrintToStream'; {procedure BFont_uint16 fFamilyID(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFont_uint16 fFamilyID'; procedure BFont_uint16 fStyleID(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFont_uint16 fStyleID'; procedure BFont_float fSize(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFont_float fSize'; @@ -240,8 +325,40 @@ procedure BFont_GetTruncatedStrings64(AObject : TCPlusObject; stringArray : PCha procedure BFont__GetEscapements_(AObject : TCPlusObject; charArray : ; numChars : integer; delta : ; mode : ; escapements : single; offsets : single); cdecl; external BePascalLibName name 'BFont__GetEscapements_'; procedure BFont__GetBoundingBoxes_(AObject : TCPlusObject; charArray : ; numChars : integer; mode : ; string_escapement : boolean; delta : ; boundingBoxArray : BRect); cdecl; external BePascalLibName name 'BFont__GetBoundingBoxes_'; } -implementation +//----- BFont related declarations ------------------------------- +var + be_plain_font : BFont; cvar; external; + be_bold_font : BFont; cvar; external; + be_fixed_font : BFont; cvar; external; + +function count_font_families : Longint; + cdecl; external 'be' name 'count_font_families__Fv'; +function get_font_family(index : Longint; var name : font_family; + var flags : Longword {$ifndef VER1_0}= nil{$endif}) + : status_t; cdecl; external 'be' name 'get_font_family__FlPA64_cPUl'; + +function count_font_styles(name : font_family) : Longint; + cdecl; external 'be' name 'count_font_styles__FPc'; + +function get_font_style(family : font_family; index : Longint; + var name : font_style; var flags : Longword {$ifndef VER1_0}= nil{$endif}) + : status_t; cdecl; external 'be' name 'get_font_style__FPclPA64_cPUl'; + +function get_font_style(family : font_family; index : Longint; + var name : font_style; var face : Word; + var flags : Longword {$ifndef VER1_0}= nil{$endif}) + : status_t; cdecl; external 'be' name 'get_font_style__FPclPA64_cPUsPUl'; + +function update_font_families(check_only : Boolean) : Boolean; + cdecl; external 'be' name 'update_font_families__Fb'; + +function get_font_cache_info(id : Longword; var _set : Pointer) : status_t; + cdecl; external 'be' name 'get_font_cache_info__FUlPv'; +function set_font_cache_info(id : Longword; var _set : Pointer) : status_t; + cdecl; external 'be' name 'set_font_cache_info__FUlPv'; + +implementation constructor BFont.Create; begin @@ -262,112 +379,112 @@ begin inherited; end; -function BFont.SetFamilyAndStyle(family : Font_family; style :Font_style ) : Status_t; +function BFont.SetFamilyAndStyle(family : font_family; style : font_style) : status_t; begin Result := BFont_SetFamilyAndStyle(CPlusObject, family, style); end; -procedure BFont.SetFamilyAndStyle(code : Cardinal); +procedure BFont.SetFamilyAndStyle(code : Longword); begin BFont_SetFamilyAndStyle(CPlusObject, code); end; -function BFont.SetFamilyAndFace(family : Font_family; aface : integer) : Status_t; +function BFont.SetFamilyAndFace(family : Font_family; aface : Word) : status_t; begin Result := BFont_SetFamilyAndFace(CPlusObject, family, aface); end; -procedure BFont.SetSize(asize : single); +procedure BFont.SetSize(asize : Single); begin BFont_SetSize(CPlusObject, asize); end; -procedure BFont.SetShear(ashear : single); +procedure BFont.SetShear(ashear : Single); begin BFont_SetShear(CPlusObject, ashear); end; -procedure BFont.SetRotation(arotation : single); +procedure BFont.SetRotation(arotation : Single); begin BFont_SetRotation(CPlusObject, arotation); end; -procedure BFont.SetSpacing(aspacing : integer); +procedure BFont.SetSpacing(aspacing : Byte); begin BFont_SetSpacing(CPlusObject, aspacing); end; -procedure BFont.SetEncoding(aencoding : integer); +procedure BFont.SetEncoding(aencoding : Byte); begin BFont_SetEncoding(CPlusObject, aencoding); end; -procedure BFont.SetFace(aface : integer); +procedure BFont.SetFace(aface : Word); begin BFont_SetFace(CPlusObject, aface); end; -procedure BFont.SetFlags(aflags : Cardinal); +procedure BFont.SetFlags(aflags : Longword); begin BFont_SetFlags(CPlusObject, aflags); end; -procedure BFont.GetFamilyAndStyle(family : Font_family; style :Font_style ); +procedure BFont.GetFamilyAndStyle(family : font_family; style : font_style); begin BFont_GetFamilyAndStyle(CPlusObject, family, style); end; -function BFont.FamilyAndStyle : Cardinal; +function BFont.FamilyAndStyle : Longword; begin Result := BFont_FamilyAndStyle(CPlusObject); end; -function BFont.Size : single; +function BFont.Size : Single; begin Result := BFont_Size(CPlusObject); end; -function BFont.Shear : single; +function BFont.Shear : Single; begin Result := BFont_Shear(CPlusObject); end; -function BFont.Rotation : single; +function BFont.Rotation : Single; begin Result := BFont_Rotation(CPlusObject); end; -function BFont.Spacing : integer; +function BFont.Spacing : Byte; begin Result := BFont_Spacing(CPlusObject); end; -function BFont.Encoding : integer; +function BFont.Encoding : Byte; begin Result := BFont_Encoding(CPlusObject); end; -function BFont.Face : integer; +function BFont.Face : Word; begin Result := BFont_Face(CPlusObject); end; -function BFont.Flags : Cardinal; +function BFont.Flags : Longword; begin Result := BFont_Flags(CPlusObject); end; -function BFont.Direction : Font_direction; +function BFont.Direction : font_direction; begin Result := BFont_Direction(CPlusObject); end; -function BFont.IsFixed : boolean; +function BFont.IsFixed : Boolean; begin Result := BFont_IsFixed(CPlusObject); end; -function BFont.IsFullAndHalfFixed : boolean; +function BFont.IsFullAndHalfFixed : Boolean; begin Result := BFont_IsFullAndHalfFixed(CPlusObject); end; @@ -377,27 +494,29 @@ begin Result := BFont_BoundingBox(CPlusObject); end; -{function BFont.Blocks : ; +{ +function BFont.Blocks : ; begin Result := BFont_Blocks(CPlusObject); end; } -function BFont.FileFormat : Font_file_format; + +function BFont.FileFormat : font_file_format; begin Result := BFont_FileFormat(CPlusObject); end; -function BFont.CountTuned : integer; +function BFont.CountTuned : Integer; begin Result := BFont_CountTuned(CPlusObject); end; -procedure BFont.GetTunedInfo(index : integer; info : tuned_font_info); +procedure BFont.GetTunedInfo(index : Longint; info : tuned_font_info); begin BFont_GetTunedInfo(CPlusObject, index, info); end; -procedure BFont.TruncateString(in_out : TString; mode : Cardinal; width : single); +procedure BFont.TruncateString(in_out : BString; mode : Longword; width : Single); begin BFont_TruncateString(CPlusObject, in_out.CPlusObject, mode, width); end; @@ -413,12 +532,12 @@ begin end; } -function BFont.StringWidth(astring : PChar) : single; +function BFont.StringWidth(astring : PChar) : Single; begin Result := BFont_StringWidth(CPlusObject, astring); end; -function BFont.StringWidth(astring : PChar; length : integer) : single; +function BFont.StringWidth(astring : PChar; length : Longint) : Single; begin Result := BFont_StringWidth(CPlusObject, astring, length); end; @@ -453,7 +572,8 @@ begin BFont_GetEdges(CPlusObject, charArray, numBytes, edgeArray); end; } -procedure BFont.GetHeight(height :Font_height ); + +procedure BFont.GetHeight(height : font_height); begin BFont_GetHeight(CPlusObject, height); end; @@ -489,5 +609,4 @@ begin BFont_PrintToStream(CPlusObject); end; - -end. +end. \ No newline at end of file