Document BBox and CBox computation problems for tricky fonts.

This commit is contained in:
Werner Lemberg 2011-04-13 00:29:41 +02:00
parent 21b1a0de7c
commit b9baff23f4
4 changed files with 24 additions and 7 deletions

View File

@ -4,8 +4,7 @@
/* */ /* */
/* FreeType high-level API and common types (specification only). */ /* FreeType high-level API and common types (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ /* Copyright 1996-2011 by */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -1058,7 +1057,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* It is not possible to autohint such fonts using */ /* It is not possible to autohint such fonts using */
/* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
/* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */ /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
/* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
/* probably never want this except for demonstration purposes. */ /* probably never want this except for demonstration purposes. */
/* */ /* */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType exact bbox computation (specification). */ /* FreeType exact bbox computation (specification). */
/* */ /* */
/* Copyright 1996-2001, 2003, 2007 by */ /* Copyright 1996-2001, 2003, 2007, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -73,6 +73,14 @@ FT_BEGIN_HEADER
/* <Return> */ /* <Return> */
/* FreeType error code. 0~means success. */ /* FreeType error code. 0~means success. */
/* */ /* */
/* <Note> */
/* If the font is tricky and the glyph has been loaded with */
/* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */
/* reasonable values for the BBox it is necessary to load the glyph */
/* at a large ppem value (so that the hinting instructions can */
/* properly shift and scale the subglyphs), then extracting the BBox */
/* which can be eventually converted back to font units. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Outline_Get_BBox( FT_Outline* outline, FT_Outline_Get_BBox( FT_Outline* outline,
FT_BBox *abbox ); FT_BBox *abbox );

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType convenience functions to handle glyphs (specification). */ /* FreeType convenience functions to handle glyphs (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */ /* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -384,6 +384,13 @@ FT_BEGIN_HEADER
/* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */
/* is another name for this constant. */ /* is another name for this constant. */
/* */ /* */
/* If the font is tricky and the glyph has been loaded with */
/* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */
/* reasonable values for the CBox it is necessary to load the glyph */
/* at a large ppem value (so that the hinting instructions can */
/* properly shift and scale the subglyphs), then extracting the CBox */
/* which can be eventually converted back to font units. */
/* */
/* Note that the maximum coordinates are exclusive, which means that */ /* Note that the maximum coordinates are exclusive, which means that */
/* one can compute the width and height of the glyph image (be it in */ /* one can compute the width and height of the glyph image (be it in */
/* integer or 26.6 pixels) as: */ /* integer or 26.6 pixels) as: */

View File

@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */ /* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */ /* most scalable font formats (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* Copyright 1996-2003, 2005-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -227,6 +227,9 @@ FT_BEGIN_HEADER
/* <Output> */ /* <Output> */
/* acbox :: The outline's control box. */ /* acbox :: The outline's control box. */
/* */ /* */
/* <Note> */
/* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */
/* */
FT_EXPORT( void ) FT_EXPORT( void )
FT_Outline_Get_CBox( const FT_Outline* outline, FT_Outline_Get_CBox( const FT_Outline* outline,
FT_BBox *acbox ); FT_BBox *acbox );
@ -332,7 +335,7 @@ FT_BEGIN_HEADER
/* handled incorrectly. */ /* handled incorrectly. */
/* */ /* */
/* If you need `better' metrics values you should call */ /* If you need `better' metrics values you should call */
/* @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox. */ /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */
/* */ /* */
/* Example call: */ /* Example call: */
/* */ /* */