shithub: freetype+ttf2subf

Download patch

ref: d51452e3ece19f797f0d81d5a5e85be88bfe38c3
parent: d93a011933148d77257d98bac275944c4b3150e6
author: Werner Lemberg <wl@gnu.org>
date: Sat Feb 13 03:52:58 EST 2021

Add new function `FT_Get_Transform`.

See

  https://github.com/harfbuzz/harfbuzz/issues/2428

for some reasons to introduce this function.

* include/freetype/freetype.h, src/base/ftobjs.c (FT_Get_Transform):
Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2021-02-13  Werner Lemberg  <wl@gnu.org>
+
+	Add new function `FT_Get_Transform`.
+
+	See
+
+	  https://github.com/harfbuzz/harfbuzz/issues/2428
+
+	for some reasons to introduce this function.
+
+	* include/freetype/freetype.h, src/base/ftobjs.c (FT_Get_Transform):
+	Implement it.
+
 2021-02-12  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	Decorate `qsort` callbacks with `cdecl`.
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -50,16 +50,6 @@
 
   II. MISCELLANEOUS
 
-  - `ttdebug` didn't show changed point coordinates (bug introduced in
-    version 2.10.3).
-
-  - A  new configuration  macro `FT_DEBUG_LOGGING`  is available.   It
-    provides extended debugging capabilities for FreeType, for example
-    showing a time stamp or displaying the component a tracing message
-    comes from.  See file `docs/DEBUG` for more information.
-
-    This work was Priyesh Kumar's GSoC 2020 project.
-
   - FreeType has moved its infrastructure to
 
       https://gitlab.freedesktop.org/freetype
@@ -71,6 +61,19 @@
 
     FreeType's Savannah  repositories will stay; they  are now mirrors
     of the 'freedesktop.org' repositories.
+
+  - A  new  function  `FT_Get_Transform`  returns  the  values set  by
+    `FT_Set_Transform`.
+
+  - A  new configuration  macro `FT_DEBUG_LOGGING`  is available.   It
+    provides extended debugging capabilities for FreeType, for example
+    showing a time stamp or displaying the component a tracing message
+    comes from.  See file `docs/DEBUG` for more information.
+
+    This work was Priyesh Kumar's GSoC 2020 project.
+
+  - `ttdebug` didn't show changed point coordinates (bug introduced in
+    version 2.10.3).
 
 
 ======================================================================
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -204,6 +204,7 @@
    *   FT_Size_RequestRec
    *   FT_Size_Request
    *   FT_Set_Transform
+   *   FT_Get_Transform
    *   FT_Load_Glyph
    *   FT_Get_Char_Index
    *   FT_Get_First_Char
@@ -3200,7 +3201,8 @@
    *     A pointer to the transformation's 2x2 matrix.  Use `NULL` for the
    *     identity matrix.
    *   delta ::
-   *     A pointer to the translation vector.  Use `NULL` for the null vector.
+   *     A pointer to the translation vector.  Use `NULL` for the null
+   *     vector.
    *
    * @note:
    *   This function is provided as a convenience, but keep in mind that
@@ -3219,6 +3221,35 @@
    */
   FT_EXPORT( void )
   FT_Set_Transform( FT_Face     face,
+                    FT_Matrix*  matrix,
+                    FT_Vector*  delta );
+
+
+  /**************************************************************************
+   *
+   * @function:
+   *   FT_Get_Transform
+   *
+   * @description:
+   *   Return the transformation that is applied to glyph images when they
+   *   are loaded into a glyph slot through @FT_Load_Glyph.  See
+   *   @FT_Set_Transform for more details.
+   *
+   * @input:
+   *   face ::
+   *     A handle to the source face object.
+   *
+   * @output:
+   *   matrix ::
+   *     A pointer to a transformation's 2x2 matrix.  Set this to NULL if you
+   *     are not interested in the value.
+   *
+   *   delta ::
+   *     A pointer a translation vector.  Set this to NULL if you are not
+   *     interested in the value.
+   */
+  FT_EXPORT( void )
+  FT_Get_Transform( FT_Face     face,
                     FT_Matrix*  matrix,
                     FT_Vector*  delta );
 
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -738,6 +738,29 @@
   }
 
 
+  /* documentation is in freetype.h */
+
+  FT_EXPORT_DEF( void )
+  FT_Get_Transform( FT_Face     face,
+                    FT_Matrix*  matrix,
+                    FT_Vector*  delta )
+  {
+    FT_Face_Internal  internal;
+
+
+    if ( !face )
+      return;
+
+    internal = face->internal;
+
+    if ( matrix )
+      *matrix = internal->transform_matrix;
+
+    if ( delta )
+      *delta = internal->transform_delta;
+  }
+
+
   static FT_Renderer
   ft_lookup_glyph_renderer( FT_GlyphSlot  slot );