Skip to content

# `typerig.core.func.transform`

## typerig.core.func.transform (version 0.26.1)

    # MODULE: TypeRig / Core / Transform (Functions)
    # -----------------------------------------------------------
    # (C) Vassil Kateliev, 2018-2020        (http://www.kateliev.com)
    # (C) Karandash Type Foundry            (http://www.karandash.eu)
    #------------------------------------------------------------
    # www.typerig.com

### Modules

- math

### Functions

adaptive_scale(v, s, d, t, c, i, st)

      Perform adaptive scaling by keeping the stem/stroke weights
      Args:
              v(t0, t1) -> tuple((float, float), (float, float)) : Joined coordinates for both weights
              s(sx, sy) -> tuple((float, float) : Scale factors (X, Y)
              d(dx, dy) -> tuple((float, float) : Translate values (X, Y)
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              c(cx, cy) -> tuple((float, float) : Compensation factor 0.0 (no compensation) to 1.0 (full compensation) (X,Y)
              i -> (radians) : Angle of sharing (for italic designs)
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              tuple(float, float): Transformed coordinate data

adaptive_scale_array(a, s, d, t, c, i, st)

      Perform adaptive scaling by keeping the stem/stroke weights
      Args:
              a(t0, t1) -> list(tuple(float, float), (float, float)) : Joined coordinate arrays for both weights
              s(sx, sy) -> tuple((float, float) : Scale factors (X, Y)
              d(dx, dy) -> tuple((float, float) : Translate values (X, Y)
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              c(cx, cy) -> tuple((float, float) : Compensation factor 0.0 (no compensation) to 1.0 (full compensation) (X,Y)
              i -> (radians) : Angle of sharing (for italic designs)
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              list(tuple(float, float)): Transformed coordinate data

adjuster(v, w, h, t, d, st)

      Readjust scale factor based on interpolation time
      Args:
              v(t0, t1) -> list(tuple((float, float), (float, float))...) : Joined coordinate arrays for both weights
              w, h -> Float: Target Width and Height
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              d(dx, dy) -> tuple((float, float) : Translation X, Y
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              tuple(float, float): Readjusted scale factors

compensator(sf, cf, st0, st1)

lerp(t0, t1, t)

      # - Functions ---------------------------

timer(sw_c, sw_0, sw_1, fix_boundry=False)

      Get Interpolation time for stem value withing given interval.
      Args:
              sw_c -> Float : Target stem value
              sw_0, sw_1 -> Float : Stem values
      Returns:
              t -> Float : Interpolation time

## `timer`

typerig.core.func.transform.timer = timer(sw_c, sw_0, sw_1, fix_boundry=False)

      Get Interpolation time for stem value withing given interval.
      Args:
              sw_c -> Float : Target stem value
              sw_0, sw_1 -> Float : Stem values
      Returns:
              t -> Float : Interpolation time

## `adjuster`

typerig.core.func.transform.adjuster = adjuster(v, w, h, t, d, st)

      Readjust scale factor based on interpolation time
      Args:
              v(t0, t1) -> list(tuple((float, float), (float, float))...) : Joined coordinate arrays for both weights
              w, h -> Float: Target Width and Height
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              d(dx, dy) -> tuple((float, float) : Translation X, Y
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              tuple(float, float): Readjusted scale factors

## `adaptive_scale`

typerig.core.func.transform.adaptive_scale = adaptive_scale(v, s, d, t, c, i, st)

      Perform adaptive scaling by keeping the stem/stroke weights
      Args:
              v(t0, t1) -> tuple((float, float), (float, float)) : Joined coordinates for both weights
              s(sx, sy) -> tuple((float, float) : Scale factors (X, Y)
              d(dx, dy) -> tuple((float, float) : Translate values (X, Y)
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              c(cx, cy) -> tuple((float, float) : Compensation factor 0.0 (no compensation) to 1.0 (full compensation) (X,Y)
              i -> (radians) : Angle of sharing (for italic designs)
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              tuple(float, float): Transformed coordinate data

## `adaptive_scale_array`

typerig.core.func.transform.adaptive_scale_array = adaptive_scale_array(a, s, d, t, c, i, st)

      Perform adaptive scaling by keeping the stem/stroke weights
      Args:
              a(t0, t1) -> list(tuple(float, float), (float, float)) : Joined coordinate arrays for both weights
              s(sx, sy) -> tuple((float, float) : Scale factors (X, Y)
              d(dx, dy) -> tuple((float, float) : Translate values (X, Y)
              t(tx, ty) -> tuple((float, float) : Interpolation times (anisotropic X, Y)
              c(cx, cy) -> tuple((float, float) : Compensation factor 0.0 (no compensation) to 1.0 (full compensation) (X,Y)
              i -> (radians) : Angle of sharing (for italic designs)
              st(stx0, stx1, sty0, sty1) -> tuple((float, float, float, float) : Stems widths for weights t0, t1

      Returns:
              list(tuple(float, float)): Transformed coordinate data