Lenard Lindstrom avatar Lenard Lindstrom committed 427a9ac

Remove experimental _freetype.Face methods

Methods get_transformation, set_transformation, and delete_transformation
were part of an attempt to generalize the rotation and oblique transforms.
The provided an interface to a common transformation matrix. As it is,
the rotation and oblique transforms involve more than than just applying
a matrix multiplication on a glyph outline. This is too complicated
to be worth exploring right now. It would better be developed in a
Pygame branch.

Comments (0)

Files changed (3)

docs/reST/ref/freetype.rst

       | :sg:`resolution -> int`
 
       Gets the pixel size used in scaling face glyphs for this Face instance.
-
-   .. method:: set_transform
-
-      | :sl:`assign a glyph transformation matrix`
-      | :sg:`set_transform(xx, xy, yx, yy) -> None`
-
-      Set a transform matrix for the face. If None, no matrix assigned.
-      The arguments can be any numeric type that can be converted
-      to a double. The matrix is applied after the strong transformation,
-      but before oblique and rotation.
-
-   .. method:: delete_transform
-
-      | :sl:`delete a glyph transformation matrix`
-      | :sg:`set_transform(xx, xy, yx, yy) -> None`
-
-      Remove the transformation matrix, if any.
-
-   .. method:: get_transform
-
-      | :sl:`return the user assigned transformation matrix, or None`
-      | :sg:`get_transform() -> (double, double, double, double) or None`
-
-      Return the transform matrix for the face. If None, no matrix is assigned.
 static PyObject *_ftface_getsizeddescender(PgFaceObject *, PyObject *);
 static PyObject *_ftface_getsizedheight(PgFaceObject *, PyObject *);
 static PyObject *_ftface_getsizedglyphheight(PgFaceObject *, PyObject *);
-static PyObject *_ftface_gettransform(PgFaceObject *);
-static PyObject *_ftface_settransform(PgFaceObject *, PyObject *);
-static PyObject *_ftface_deletetransform(PgFaceObject *);
 
 /* static PyObject *_ftface_copy(PgFaceObject *); */
 
         METH_VARARGS | METH_KEYWORDS,
         DOC_FACERENDERRAWTO
     },
-    {
-        "get_transform",
-        (PyCFunction)_ftface_gettransform,
-        METH_NOARGS,
-        DOC_FACEGETTRANSFORM
-    },
-    {
-        "set_transform",
-        (PyCFunction)_ftface_settransform,
-        METH_VARARGS,
-        DOC_FACESETTRANSFORM
-    },
-    {
-        "delete_transform",
-        (PyCFunction)_ftface_deletetransform,
-        METH_NOARGS,
-        DOC_FACEDELETETRANSFORM
-    },
 
     { 0, 0, 0, 0 }
 };
 #endif // HAVE_PYGAME_SDL_VIDEO
 }
 
-static PyObject *
-_ftface_gettransform(PgFaceObject *self)
-{
-    if (!(self->render_flags & FT_RFLAG_TRANSFORM)) {
-        Py_RETURN_NONE;
-    }
-    return Py_BuildValue("dddd",
-                         FX16_TO_DBL(self->transform.xx),
-                         FX16_TO_DBL(self->transform.xy),
-                         FX16_TO_DBL(self->transform.yx),
-                         FX16_TO_DBL(self->transform.yy));
-}
-
-static PyObject *
-_ftface_settransform(PgFaceObject *self, PyObject *args)
-{
-    double xx;
-    double xy;
-    double yx;
-    double yy;
-
-    if (!PyArg_ParseTuple(args, "dddd", &xx, &xy, &yx, &yy)) {
-        return 0;
-    }
-    /* Sanity check: only accept numbers between -2.0 and 2.0 inclusive */
-    if (xx < -2.0 || xx > 2.0 || xy < -2.0 || xy > 2.0 ||
-        yx < -2.0 || yx > 2.0 || yy < -2.0 || yy > 2.0) {
-        PyErr_SetString(PyExc_ValueError,
-                        "received a value outside range [-2.0,2.0]");
-        return 0;
-    }
-    self->transform.xx = FX16_TO_DBL(xx);
-    self->transform.xy = FX16_TO_DBL(xy);
-    self->transform.yx = FX16_TO_DBL(yx);
-    self->transform.yy = FX16_TO_DBL(yy);
-    self->render_flags |= FT_RFLAG_TRANSFORM;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
-_ftface_deletetransform(PgFaceObject *self)
-{
-    self->render_flags &= ~FT_RFLAG_TRANSFORM;
-    self->transform.xx = 0x00010000;
-    self->transform.xy = 0x00000000;
-    self->transform.yx = 0x00000000;
-    self->transform.yy = 0x00010000;
-    Py_RETURN_NONE;
-}
-
 /****************************************************
  * C API CALLS
  ****************************************************/

src/freetype/ft_cache.c

     unsigned short render_flags;
     unsigned short rotation;
     FT_Fixed strength;
-    FT_Matrix transform;
 } KeyFields;
 
 typedef union cachenodekey_ {
     fields->render_flags = mode->render_flags & rflag_mask;
     fields->rotation = rot;
     fields->strength = mode->strength;
-    fields->transform.xx = mode->transform.xx;
-    fields->transform.xy = mode->transform.xy;
-    fields->transform.yx = mode->transform.yx;
-    fields->transform.yy = mode->transform.yy;
 }
 
 static int
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.