Re: [ft-devel] controlling FreeType modules

2012-08-23 Thread Behdad Esfahbod
Werner,

I know I'm fairly opinionated when it comes to library design, but thought
share my thoughts anyway.  Personally I think FreeType's public API is largely
over-engineered, and the proposed property service is a big step in that
direction.  As a user of the library, I don't care about modules,
services, or generic properties infrastructures.  Just give me an enum for
the parameters that make sense, and a setter/getter.  No need to reinvent a
property system in C.

My 0.02CAD,
behdad

On 07/28/2012 01:51 AM, Werner LEMBERG wrote:
 
 Toshiya-san and I have met in Osaka, and we have enjoyed a great time
 visiting the private museums of Motoya and Morizawa, two big font
 companies in Japan.
 
 While having a nice lunch, we've discussed how to control modules in
 FreeType.  In FreeType's `autohinter-properties' branch, I've posted a
 first draft of how an interface might look like.  However, this is far
 from sufficient, and it is special to the auto-hinter only, while we
 need a more generic solution to control any module.
 
 So here is another proposal for an interface.
 
 
   Property service
   
 
   Properties get accessed with FreeType services.  For example, to
   make the module `foo' listen to property changes, add a
   `foo-properties' service to the module, with two functions to get
   and set values.
 
 
   Default properties
   --
 
   Internally, we use an `FT_Property' structure to collect all
   properties in a linked list:
 
 typedef FT_Property_
 {
   FT_String*module_name;
   FT_String*property_name;
   void* value;
 
   FT_Property*  next;
 
 } FT_Property;
 
   The list is located in the `FT_Library' object:
 
 FT_Property*  properties;
 
   Allocation and deallocation of `properties' is handled by FreeType.
 
   As soon as a new `FT_Face' object gets created, the corresponding
   modules check the `properties' list and use it for initialization.
   There might be properties which are not suitable for global
   initialization; such cases are to be ignored (with a debugging
   warning probably).
 
   Already existing `FT_Face' objects are not affected.
 
 FT_Error
 FT_Library_SetProperty( FT_Librarylibrary,
 const FT_String*  module_name,
 const FT_String*  property_name,
 void* value );
 
 FT_Error
 FT_Library_RemoveProperty( FT_Librarylibrary,
const FT_String*  module_name,
const FT_String*  property_name );
 
 FT_Error
 FT_Library_GetProperty( FT_Librarylibrary,
 const FT_String*  module_name,
 const FT_String*  property_name,
 void* avalue );
 
   The generic pointer `value' gets typecast to a pointer of the real
   value variable or structure.  Maybe not the most convenient, it
   guarantees flexibility and extensibility, however.
 
 
   Local properties
   
 
   These are located in an FT_Face object.  Existing values for
   properties get overwritten.
 
 FT_Error
 FT_Face_SetProperty( FT_Face   face,
  const FT_String*  module_name,
  const FT_String*  property_name,
  void* value );
 
 FT_Error
 FT_Face_RemoveProperty( FT_Face   face,
 const FT_String*  module_name,
 const FT_String*  property_name );
 
 FT_Error
 FT_Face_GetProperty( FT_Face   face,
  const FT_String*  module_name,
  const FT_String*  property_name,
  void* avalue );
 
 
   Examples
   
 
 /***/
 /* Set property `bar' in module `foo' to value 1.  */
 
 FT_UInt  bar;
 
 
 bar = 1;
 FT_Face_SetProperty( face, foo, bar, bar );
 
 
 /***/
 /* Get property `baz', which consists of a minimum and maximum */
 /* value.  */
 
 typedef range_
 {
   FT_Int32  min;
   FT_Int32  max;
 
 } range;
 
 range baz;
 
 
 FT_Face_GetProperty( face, foo, baz, baz );
 
 
 
   Werner
 
 ___
 Freetype-devel mailing list
 Freetype-devel@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/freetype-devel
 

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


[ft-devel] Architecture Astronaut: Liftoff in 5, 4, 3...!

2012-08-23 Thread Vinnie Falco
 From: Behdad Esfahbod beh...@behdad.org

 I know I'm fairly opinionated when it comes to library design, but thought
 share my thoughts anyway.  Personally I think FreeType's public API is largely
 over-engineered, and the proposed property service is a big step in that
 direction.

I agree 100%. The drawing of fonts is something that's been around for
what, 40 years now (give or take)? The API should have been frozen a
long time ago, with only minor changes made to adapt to infrequent new
technologies (like LCD rendering).

That we are considering something as bulky as a generic property
get/set system means either that the original design was flawed, or
we are going into orbit as architecture astronauts.

Thanks

-- 
Follow me on Github: https://github.com/vinniefalco

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


Re: [ft-devel] controlling FreeType modules

2012-08-23 Thread Werner LEMBERG

 I know I'm fairly opinionated when it comes to library design, but
 thought share my thoughts anyway.  Personally I think FreeType's
 public API is largely over-engineered,

well...  This is definitely not my fault :-)

 and the proposed property service is a big step in that
 direction.

As soon as you are up to date with reading the FreeType email list
postings, you will have seen my other email.  Now there are only two
functions, FT_Property_Set and FT_Property_Get.

 As a user of the library, I don't care about modules, services,
 or generic properties infrastructures.

You don't have to.  Services is something internal to FreeType, not
visible by the application.  The module API already exists, and it is
central to FreeType, so I will continue with addressing properties
using module names.

 Just give me an enum for the parameters that make sense, and a
 setter/getter.

Hmm.  Instead of an enum like FT_AUTOFITTER_DO_THIS_AND_THAT you will
have to use two arguments, autofitter and do-this-and-that, so I
don't see a big difference, neither in understanding nor typing.


Werner

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


Re: [ft-devel] Architecture Astronaut: Liftoff in 5, 4, 3...!

2012-08-23 Thread Werner LEMBERG

 That we are considering something as bulky as a generic property
 get/set system means either that the original design was flawed, or
 we are going into orbit as architecture astronauts.

I'm open to suggestions how to do the following:

  . autohinter:

  . switch on/off horizontal hinting
  . switch on/off vertical hinting
  . switch on/off emboldening of small glyphs
  . control range of emboldening of small glyphs
  . ditto for thin glyphs
  . ditto for `more rounding up'
  . control glyph index - script mapping

  . ttf engine:

  . select interpreter version (this also controls whether we have
GDI ClearType, DirectWrite ClearType, or none)

  . cache:

  . control maximum number of slots, faces, etc.

  ...

Note that I don't want to have zillions of functions; instead I want
two functions to set and get those values.


Werner

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