Unit 'agraphics' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#os4units]

TextFit

Count characters that will fit in a given extent

Declaration

Source position: agraphics.pas line 2409

function TextFit(

  Rp: PRastPort;

  const String_: PChar;

  StrLen: LongWord;

  TextExtent: PTextExtent;

  ConstrainingExtent: PTextExtent;

  StrDirection: LongInt;

  ConstrainingBitWidth: LongWord;

  ConstrainingBitHeight: LongWord

):LongWord;

Arguments

Rp

  

A pointer to the RastPort which describes where the text attributes reside.

String_

  

The address of string to determine the constraint of

StrLen

  

The number of characters in the string. If 0, there are no characters in the string.

ConstrainingExtent

  

The extent that the text must fit in. This can be nil, indicating only the constrainingBit dimensions will describe the constraint.

StrDirection

  

the offset to add to the string pointer to get to the next character in the string. Usually 1. Set to -1 and the string to the end of the string to perform a TextFit() anchored at the end. No other value is valid.

ConstrainingBitWidth

  

An alternative way to specify the rendering box constraint width that is independent of the rendering origin. Range 0..32767.

ConstrainingBitHeight

  

An alternative way to specify the rendering box constraint height that is independent of the rendering origin. Range 0..32767.

Function result

The number of characters from the origin of the given string that will fit in both the constraining extent (which specifies a CP bound and a rendering box relative to the origin) and in the rendering width and height specified.The result is 0 chars and an empty TextExtent when the fit cannot be performed. This occurs not only when no text will fit in the provided constraints, but also when: The RastPort's rp_TxSpacing sign and magnitude is so great it reverses the path of the text or the constrainingExtent does not include x = 0.

Description

This function determines how many of the characters of the provided string will fit into the space described by the constraining parameters. It also returns the extent of that number of characters.

See also

TextLength

  

Determine raster length of text data.

TextExtent

  

Determine raster extent of text data.

GfxText

  

Write text characters (no formatting).


Documentation generated on: 2021-07-30