README

bikallem/freetype/fixed does not have a README file

#
F26Dot6

type F26Dot6 derive(Compare, Eq, Show)

26.6 fixed-point number (used for pixel coordinates).
impl Add for F26Dot6
impl Neg for F26Dot6
impl Sub for F26Dot6

#
F26Dot6::ceil

fn F26Dot6::ceil(self : F26Dot6) -> F26Dot6

#
F26Dot6::floor

fn F26Dot6::floor(self : F26Dot6) -> F26Dot6

#
F26Dot6::from_int

fn F26Dot6::from_int(v : Int) -> F26Dot6

#
F26Dot6::from_pixels

fn F26Dot6::from_pixels(pixels : Int) -> F26Dot6

#
F26Dot6::from_raw

fn F26Dot6::from_raw(v : Int64) -> F26Dot6

#
F26Dot6::round

fn F26Dot6::round(self : F26Dot6) -> F26Dot6

Round to nearest integer (26.6 → integer).

#
F26Dot6::to_int

fn F26Dot6::to_int(self : F26Dot6) -> Int

#
F26Dot6::to_raw

fn F26Dot6::to_raw(self : F26Dot6) -> Int64

#
F26Dot6::val

fn F26Dot6::val(self : F26Dot6) -> Int64

#
F26Dot6::zero

fn F26Dot6::zero() -> F26Dot6

#
F2Dot14

type F2Dot14 derive(Compare, Eq, Show)

2.14 fixed-point number (used for unit vectors).

#
F2Dot14::from_raw

fn F2Dot14::from_raw(v : Int) -> F2Dot14

#
F2Dot14::one

fn F2Dot14::one() -> F2Dot14

#
F2Dot14::to_fixed

fn F2Dot14::to_fixed(self : F2Dot14) -> Fixed

Convert F2Dot14 to Fixed (16.16). Simply left-shift by 2.

#
F2Dot14::to_raw

fn F2Dot14::to_raw(self : F2Dot14) -> Int

#
F2Dot14::val

fn F2Dot14::val(self : F2Dot14) -> Int

#
F2Dot14::zero

fn F2Dot14::zero() -> F2Dot14

#
Fixed

pub struct Fixed {
val : Int64
} derive(Compare, Eq, Show)

16.16 fixed-point number. Wraps Int64 to avoid overflow in intermediate computations (C FreeType relies on two's-complement wrapping of 32-bit signed long; we use 64-bit and mask/truncate where needed).
impl Add for Fixed
impl Neg for Fixed
impl Sub for Fixed

#
Fixed::ceil

fn Fixed::ceil(self : Fixed) -> Fixed

Ceil (round up toward +∞).

#
Fixed::floor

fn Fixed::floor(self : Fixed) -> Fixed

Floor (round down toward −∞).

#
Fixed::from_int

fn Fixed::from_int(v : Int) -> Fixed

#
Fixed::from_raw

fn Fixed::from_raw(v : Int64) -> Fixed

#
Fixed::one

fn Fixed::one() -> Fixed

#
Fixed::round

fn Fixed::round(self : Fixed) -> Fixed

Round to nearest integer (16.16 → integer).

#
Fixed::to_int

fn Fixed::to_int(self : Fixed) -> Int

Extract integer part (truncate toward zero).

#
Fixed::to_raw

fn Fixed::to_raw(self : Fixed) -> Int64

Extract raw 16.16 value.

#
Fixed::val

fn Fixed::val(self : Fixed) -> Int64

#
Fixed::zero

fn Fixed::zero() -> Fixed

#
Matrix

type Matrix derive(Eq, Show)

2×2 matrix with 16.16 fixed-point entries. Used for glyph transformations (scaling, rotation, skewing).

#
Matrix::identity

fn Matrix::identity() -> Matrix

Identity matrix.

#
Matrix::invert

fn Matrix::invert(self : Matrix) -> Unit raise
FTError

Invert this matrix in place. Port of ftcalc.c FT_Matrix_Invert.

#
Matrix::multiply

fn Matrix::multiply(self : Matrix, a : Matrix) -> Unit

Multiply matrix a into self (self = a * self). Port of ftcalc.c FT_Matrix_Multiply.

#
Matrix::new

fn Matrix::new(xx : Fixed, xy : Fixed, yx : Fixed, yy : Fixed) -> Matrix

Create a matrix with the given entries.

#
Matrix::set_xx

fn Matrix::set_xx(self : Matrix, v : Fixed) -> Unit

#
Matrix::set_xy

fn Matrix::set_xy(self : Matrix, v : Fixed) -> Unit

#
Matrix::set_yx

fn Matrix::set_yx(self : Matrix, v : Fixed) -> Unit

#
Matrix::set_yy

fn Matrix::set_yy(self : Matrix, v : Fixed) -> Unit

#
Matrix::transform

fn Matrix::transform(self : Matrix, x : Int64, y : Int64) -> (Int64, Int64)

Transform a vector (x, y) by this matrix. Returns (xxx + xyy, yxx + yyy).

#
Matrix::xx

fn Matrix::xx(self : Matrix) -> Fixed

#
Matrix::xy

fn Matrix::xy(self : Matrix) -> Fixed

#
Matrix::yx

fn Matrix::yx(self : Matrix) -> Fixed

#
Matrix::yy

fn Matrix::yy(self : Matrix) -> Fixed

#
ANGLE_2PI

let ANGLE_2PI : Int64

FT_ANGLE_2PI = 360 << 16

#
ANGLE_PI

let ANGLE_PI : Int64

FT_ANGLE_PI = 180 << 16

#
ANGLE_PI2

let ANGLE_PI2 : Int64

FT_ANGLE_PI2 = 90 << 16

#
ANGLE_PI4

let ANGLE_PI4 : Int64

FT_ANGLE_PI4 = 45 << 16

#
angle_diff

fn angle_diff(angle1 : Int64, angle2 : Int64) -> Int64

Compute difference between two angles, normalized to [-PI, PI].

#
atan2

fn atan2(dx : Int64, dy : Int64) -> Int64

Arctangent of (dx, dy). Returns angle in 16.16 degrees.

#
corner_is_flat

fn corner_is_flat(in_x : Int64, in_y : Int64, out_x : Int64, out_y : Int64) -> Bool

Test whether a corner is flat (nearly colinear). Port of ftcalc.c ft_corner_is_flat.

#
corner_orientation

fn corner_orientation(in_x : Int64, in_y : Int64, out_x : Int64, out_y : Int64) -> Int

Determine orientation of corner formed by vectors (in_x,in_y) → (out_x,out_y). Returns +1 (counter-clockwise), -1 (clockwise), or 0 (colinear).

#
cos

fn cos(angle : Int64) -> Fixed

Cosine of an angle (16.16 degrees). Returns Fixed.

#
div_fix

fn div_fix(a : Int64, b : Int64) -> Fixed

FT_DivFix: compute (a << 16) / b with rounding. Returns 16.16 fixed. Port of ftcalc.c FT_DivFix (64-bit path).

#
msb

fn msb(z : UInt) -> Int

FT_MSB: return index of the most significant bit (0-based). Returns -1 if z == 0.

#
mul_div

fn mul_div(a : Int64, b : Int64, c : Int64) -> Int64

FT_MulDiv: compute (a * b + c/2) / c with rounding to nearest. Port of ftcalc.c FT_MulDiv (64-bit path).

#
mul_fix

fn mul_fix(a : Fixed, b : Fixed) -> Fixed

FT_MulFix: multiply two 16.16 fixed-point values, return 16.16 result. Equivalent to (a * b) / 0x10000 with rounding. Port of ftcalc.c FT_MulFix (64-bit path).

#
sin

fn sin(angle : Int64) -> Fixed

Sine of an angle (16.16 degrees). Returns Fixed.

#
sqrt_fixed

fn sqrt_fixed(v : UInt64) -> UInt

FT_SqrtFixed: integer square root of a 16.16 fixed-point value. Uses Babylonian method. Port of ftcalc.c FT_SqrtFixed.

#
tan

fn tan(angle : Int64) -> Fixed

Tangent of an angle (16.16 degrees). Returns Fixed.

#
vector_from_polar

fn vector_from_polar(length : Int64, angle : Int64) -> (Int64, Int64)

Create vector from polar coordinates (length, angle).

#
vector_length

fn vector_length(x : Int64, y : Int64) -> Int64

Compute length of vector (x, y).

#
vector_polarize

fn vector_polarize(x : Int64, y : Int64) -> (Int64, Int64)

Convert vector to polar form: (length, angle).

#
vector_rotate

fn vector_rotate(x : Int64, y : Int64, angle : Int64) -> (Int64, Int64)

Rotate vector (x, y) by angle. Returns rotated (x, y).

#
vector_unit

fn vector_unit(angle : Int64) -> (Fixed, Fixed)

Compute unit vector for the given angle (16.16 degrees). Returns (cos, sin) as Fixed values.