I've made a patch for the proposed change below.  Please let me know
if anything needs to be adjusted.

Thanks!

On Mon, Jul 11, 2011 at 8:07 PM, Steven Chu <[email protected]> wrote:
> To clarify what I've observed with the Ahem font:
>
> From ttdriver.c:
>  static FT_Error
>  tt_size_request( FT_Size          size,
>                   FT_Size_Request  req )
>  {
> /* Current value for size == previous calculated metrics */
>    TT_Size   ttsize = (TT_Size)size;
>    FT_Error  error  = TT_Err_Ok;
>
> #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
> ...
> #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
>
>    FT_Request_Metrics( size->face, req ); /* Calculates new metrics,
> incorrect for Ahem */
>
>    if ( FT_IS_SCALABLE( size->face ) ) /* Ahem is scalable */
>      error = tt_size_reset( ttsize ); /* Calculates proper metrics
> stored in ttsize */
>
> /* ttsize->metrics contains proper metrics, size->metrics contains
> incorrect metrics */
>
>    return error;
>  }
>
>
> and my proposed change:
>  tt_size_request( FT_Size          size,
>                   FT_Size_Request  req )
>  {
> ...
>    if ( FT_IS_SCALABLE( size->face ) )
>    {
>      error = tt_size_reset( ttsize );
> /* Fix: copy reset metrics from TT_Size to publically accessible
> FT_Size metrics */
>      ttsize->root.metrics = ttsize->metrics;
>    }
>
>    return error;
>  }
>
From 79d31e49a9f576de38d7298f30aa2c937ace7522 Mon Sep 17 00:00:00 2001
From: Steven Chu <[email protected]>
Date: Wed, 13 Jul 2011 19:54:57 -0500
Subject: [PATCH] [truetype] Fix metrics on size request for scalable fonts.

* src/truetype/ttdriver.c (tt_size_request):
Fix copying metrics from TT_Size to FT_Size if scalable font.
---
 ChangeLog               |    7 +++++++
 src/truetype/ttdriver.c |    3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f2b8365..59680c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-13  Steven Chu <[email protected]>
+
+	[truetype] Fix metrics on size request for scalable fonts.
+
+	* src/truetype/ttdriver.c (tt_size_request):
+	Fix copying metrics from TT_Size to FT_Size if scalable font.
+
 2011-07-10  Алексей Подтележников  <[email protected]>
 
 	[psaux] Optimize previous commit.
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 66061fd..e70a611 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -246,7 +246,10 @@
     FT_Request_Metrics( size->face, req );
 
     if ( FT_IS_SCALABLE( size->face ) )
+    {
       error = tt_size_reset( ttsize );
+      ttsize->root.metrics = ttsize->metrics;
+    }
 
     return error;
   }
-- 
1.7.4.1

_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to