freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master bb59c3c95: * src/base/ftsynth.c (FT_GlyphSlot_Slant):


From: Werner Lemberg
Subject: [freetype2] master bb59c3c95: * src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant.
Date: Sun, 16 Oct 2022 22:14:17 -0400 (EDT)

branch: master
commit bb59c3c958cac48044dc5ce3c0a393196c627974
Author: Liu Kunpeng(柳鲲鹏) <liukunpeng@ts-it.cn>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant.
    * include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Declare it.
---
 include/freetype/ftsynth.h |  7 ++++++-
 src/base/ftsynth.c         | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index afc40b1d8..013f1cc78 100644
--- a/include/freetype/ftsynth.h
+++ b/include/freetype/ftsynth.h
@@ -68,10 +68,15 @@ FT_BEGIN_HEADER
   FT_EXPORT( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
 
-  /* Slant an outline glyph to the right by about 12 degrees. */
+  /* Slant an outline glyph to the right by about 12 degrees.              */
   FT_EXPORT( void )
   FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );
 
+  /* Slant an outline glyph by a given sine of an angle.                   */
+  FT_EXPORT( void )
+  FT_GlyphSlot_Slant( FT_GlyphSlot  slot,
+                      FT_Fixed      slant );
+
   /* */
 
 
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 10bbe0dfd..fd595e118 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -45,6 +45,16 @@
 
   FT_EXPORT_DEF( void )
   FT_GlyphSlot_Oblique( FT_GlyphSlot  slot )
+  {
+    FT_GlyphSlot_Slant( slot, 0x0366A );
+  }
+
+
+  /* documentation is in ftsynth.h */
+
+  FT_EXPORT_DEF( void )
+  FT_GlyphSlot_Slant( FT_GlyphSlot  slot,
+                      FT_Fixed      slant )
   {
     FT_Matrix    transform;
     FT_Outline*  outline;
@@ -61,13 +71,11 @@
 
     /* we don't touch the advance width */
 
-    /* For italic, simply apply a shear transform, with an angle */
-    /* of about 12 degrees.                                      */
-
+    /* For italic, simply apply a shear transform */
     transform.xx = 0x10000L;
     transform.yx = 0x00000L;
 
-    transform.xy = 0x0366AL;
+    transform.xy = slant;
     transform.yy = 0x10000L;
 
     FT_Outline_Transform( outline, &transform );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]