Re: [ft-devel] adjustable stroker radius

2012-08-18 Thread Werner LEMBERG

 I'd like to introduce adjustable stroking radius to ftview
 functionalities.  This is a patch.  Please comment.

Thanks; this looks simple and straightforward.  Please install.

BTW, what about using integer numbers for slant and radius in the UI
(for example, the real values multiplied by 1000)?  Right now, if
increasing and decreasing the slant, ftview sometimes shows `-0.000'
which looks weird.  Using integer values, such rounding issues can be
avoided completely.


   Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] adjustable stroker radius

2012-08-18 Thread Alexei Podtelezhnikov
On Sat, Aug 18, 2012 at 3:22 AM, Werner LEMBERG w...@gnu.org wrote:

 I'd like to introduce adjustable stroking radius to ftview
 functionalities.  This is a patch.  Please comment.

 Thanks; this looks simple and straightforward.  Please install.

 BTW, what about using integer numbers for slant and radius in the UI
 (for example, the real values multiplied by 1000)?  Right now, if
 increasing and decreasing the slant, ftview sometimes shows `-0.000'
 which looks weird.  Using integer values, such rounding issues can be
 avoided completely.


Yes. This is in the plans. I actually wanted to measure everything in
pixels and use FT_Fixed instead of double throughout.

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] adjustable stroker radius

2012-08-17 Thread Alexei Podtelezhnikov
Hi All,

I'd like to introduce adjustable stroking radius to ftview
functionalities. This is a patch. Please comment.

diff --git a/src/ftview.c b/src/ftview.c
index 0b7bcbd..59dd8cc 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -77,6 +77,7 @@
 double gamma;
 double xbold_factor;
 double ybold_factor;
+double radius;
 double slant;

 intdebug;
@@ -94,7 +95,7 @@
 intfw_index;

   } status = { RENDER_MODE_ALL, FT_ENCODING_NONE, 72, 48, -1,
-   1.0, 0.04, 0.04, 0.22,
+   1.0, 0.04, 0.04, 0.02, 0.22,
0, 0, 0, 0, 0, NULL, { 0 }, 0, 0,
0, { 0x10, 0x40, 0x70, 0x40, 0x10 }, 2 };

@@ -130,6 +131,8 @@
 FT_Face   face;
 FT_GlyphSlot  slot;

+FT_Fixed  radius;
+

 error = FTDemo_Get_Size( handle, size );

@@ -143,7 +146,10 @@
 face = size-face;
 slot = face-glyph;

-FT_Stroker_Set( handle-stroker, 64,
+radius = status.radius *
+ FT_MulFix( face-units_per_EM, face-size-metrics.y_scale );
+
+FT_Stroker_Set( handle-stroker, radius,
 FT_STROKER_LINECAP_ROUND,
 FT_STROKER_LINEJOIN_ROUND,
 0 );
@@ -617,6 +623,7 @@
 grLn();
 grWriteln(   x, Xadjust horizontal emboldening );
 grWriteln(   y, Yadjust vertical emboldening );
+grWriteln(   r, Radjust stroking radius );
 grWriteln(   s, Sadjust slanting );
 grLn();
 grWriteln(   F   toggle custom LCD filter mode );
@@ -755,6 +762,23 @@


   static void
+  event_radius_change( double  delta )
+  {
+status.radius += delta;
+
+if ( status.radius  0.05 )
+  status.radius = 0.05;
+else if ( status.radius  0.0 )
+  status.radius = 0.0;
+
+sprintf( status.header_buffer, stroking radius changed to %.3f,
+ status.radius );
+
+status.header = status.header_buffer;
+  }
+
+
+  static void
   event_slant_change( double  delta )
   {
 status.slant += delta;
@@ -992,6 +1016,14 @@
   event_slant_change( -0.02 );
   break;

+case grKEY( 'r' ):
+  event_radius_change( 0.005 );
+  break;
+
+case grKEY( 'R' ):
+  event_radius_change( -0.005 );
+  break;
+
 case grKEY( 'x' ):
   event_bold_change( 0.005, 0.0 );
   break;

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel