Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Faxual II for CA-Clipper - riptextsize http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 RipTextSize
 Get text size
------------------------------------------------------------------------------
 Syntax

    RipTextSize(<nWhich>, <cText>) -> nSize

 Parameters

    <nWhich> specifies which measurement to make:

    RipTextSize() measurements defined in FAXUAL2.CH
    ----------------------------------------------------------------------
    Value   Constant        Measurement
    ----------------------------------------------------------------------
      0     SIZE_ADVANCE    Baseline advance.
      1     SIZE_LSB        Left side bearing.
      2     SIZE_RSB        Right side bearing.
      3     SIZE_ASCENT     Maximum ascent.
      4     SIZE_DESCENT    Maximum descent.
    ----------------------------------------------------------------------

    <cText> is the string to measure.  Measurements are made using the
    current font.

 Returns

    Selected measurement, in RIP units.

    SIZE_ADVANCE, the baseline advance, is the amount the current position
    moves when writing the text to the page.  This is the measurement you
    will normally use if you want the width of a string.

    SIZE_LSB, the left side bearing, is the amount of empty space between
    the current point (before writing the text) and the first pixel of the
    first letter drawn.  Some letters include empty space within the
    character cell (to even out intercharacter spacing); SIZE_LSB measures
    this empty space.  Some letters, particularly italic letters with
    descenders, actually draw to the left of the current point.  For these
    letters, SIZE_LSB will be negative.

    SIZE_RSB, the right side bearing, is similar to SIZE_LSB but measures
    empty space between the last pixel of the last letter, and the the new
    current point after writing the text.

    SIZE_ASCENT is the maximum height above the baseline of any letter in
    the string.  Unlike FontAscent(), it measures the actual sizes of the
    characters in the string.

    SIZE_DESCENT is the maximum descent of any letter in the string.  Unlike
    FontDescent(), it measures the actual sizes of the characters in the
    string. It might be negative if the string contains only letters that do
    not reach the baseline, like ", ', or -.

 Example

    // Write "Hello, world!" in white in a black box that EXACTLY fits
    // around the string.  The extreme points of the string will touch
    // the edges of the box, leaving a little white gap.

    message := "Hello, world!"

    // We'll start at an arbitrary position....

    RipMoveTo(200, 200)

    // Figure out the limits of the box.

    left   := RipCurX() + RipTextSize(SIZE_LSB, message)
    top    := RipCurY() - RipTextSize(SIZE_ASCENT, message)
    right  := RipCurX() + RipTextSize(SIZE_ADVANCE, message) - ;
                          RipTextSize(SIZE_RSB, message)
    bottom := RipCurY() + RipTextSize(SIZE_DESCENT, message)

    RipFillRect(left, top, right, bottom, 100)  // Black box

    // Now draw the text.

    RipTextOp("white")  // White text
    RipWrite(message)

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson