From a7096374eeb138d78b86c07a652e0a098ae17775 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 11 Oct 2000 23:31:12 +0000 Subject: [PATCH] Added new `ft_glyph_bbox_unscaled' enum; fixing documentation of FT_Glyph_Get_CBox(). ftnames.c has been omitted from the Makefile. --- include/freetype/ftglyph.h | 28 +++++++++++++++++++--------- src/base/ftglyph.c | 25 +++++++++++++++++-------- src/base/rules.mk | 3 ++- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 02c90887a..dc2ed0914 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -218,8 +218,9 @@ enum { + ft_glyph_bbox_unscaled = 0, /* return unscaled font units */ ft_glyph_bbox_subpixels = 0, /* return unfitted 26.6 coordinates */ - ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */ + ft_glyph_bbox_gridfit = 1, /* return grid-fitted 26.6 coordinates */ ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */ ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */ }; @@ -236,8 +237,8 @@ /* */ /* glyph :: A handle to the source glyph object. */ /* */ - /* mode :: A set of bit flags that indicate how to interpret the */ - /* returned bounding box values. */ + /* mode :: The mode which indicates how to interpret the returned */ + /* bounding box values. */ /* */ /* */ /* box :: The glyph bounding box. Coordinates are expressed in */ @@ -247,9 +248,12 @@ /* Coordinates are relative to the glyph origin, using the Y-upwards */ /* convention. */ /* */ - /* If `ft_glyph_bbox_subpixels' is set in `mode', the bbox */ + /* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */ + /* must be set to `ft_glyph_bbox_unscaled' to get unscaled font */ + /* units. */ + /* */ + /* If `bbox_mode' is set to `ft_glyph_bbox_subpixels' the bbox */ /* coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels). */ - /* Otherwise, coordinates are expressed in integer pixels. */ /* */ /* Note that the maximum coordinates are exclusive, which means that */ /* one can compute the width and height of the glyph image (be it in */ @@ -258,16 +262,22 @@ /* width = bbox.xMax - bbox.xMin; */ /* height = bbox.yMax - bbox.yMin; */ /* */ - /* Note also that for 26.6 coordinates, if the */ - /* `ft_glyph_bbox_gridfit' flag is set in `mode;, the coordinates */ - /* will also be grid-fitted, which corresponds to: */ + /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ + /* `ft_glyph_bbox_gridfit', the coordinates will also be grid-fitted, */ + /* which corresponds to: */ /* */ /* bbox.xMin = FLOOR(bbox.xMin); */ /* bbox.yMin = FLOOR(bbox.yMin); */ /* bbox.xMax = CEILING(bbox.xMax); */ /* bbox.yMax = CEILING(bbox.yMax); */ /* */ - /* The default value (0) for `bbox_mode' is `ft_glyph_bbox_pixels'. */ + /* To get the bbox in pixel coordinates, set `bbox_mode' to */ + /* `ft_glyph_bbox_truncate'. */ + /* */ + /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ + /* to `ft_glyph_bbox_pixels'. */ + /* */ + /* The default value for `bbox_mode' is `ft_glyph_bbox_pixels'. */ /* */ FT_EXPORT_DEF( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index dbf04fcb3..ccea17903 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -602,8 +602,8 @@ /* */ /* glyph :: A handle to the source glyph object. */ /* */ - /* mode :: A set of bit flags that indicate how to interpret the */ - /* returned bounding box values. */ + /* mode :: The mode which indicates how to interpret the returned */ + /* bounding box values. */ /* */ /* */ /* box :: The glyph bounding box. Coordinates are expressed in */ @@ -613,9 +613,12 @@ /* Coordinates are relative to the glyph origin, using the Y-upwards */ /* convention. */ /* */ - /* If `ft_glyph_bbox_subpixels' is set in `mode', the bbox */ + /* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */ + /* must be set to `ft_glyph_bbox_unscaled' to get unscaled font */ + /* units. */ + /* */ + /* If `bbox_mode' is set to `ft_glyph_bbox_subpixels' the bbox */ /* coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels). */ - /* Otherwise, coordinates are expressed in integer pixels. */ /* */ /* Note that the maximum coordinates are exclusive, which means that */ /* one can compute the width and height of the glyph image (be it in */ @@ -624,16 +627,22 @@ /* width = bbox.xMax - bbox.xMin; */ /* height = bbox.yMax - bbox.yMin; */ /* */ - /* Note also that for 26.6 coordinates, if the */ - /* `ft_glyph_bbox_gridfit' flag is set in `mode;, the coordinates */ - /* will also be grid-fitted, which corresponds to: */ + /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ + /* `ft_glyph_bbox_gridfit', the coordinates will also be grid-fitted, */ + /* which corresponds to: */ /* */ /* bbox.xMin = FLOOR(bbox.xMin); */ /* bbox.yMin = FLOOR(bbox.yMin); */ /* bbox.xMax = CEILING(bbox.xMax); */ /* bbox.yMax = CEILING(bbox.yMax); */ /* */ - /* The default value (0) for `bbox_mode' is `ft_glyph_bbox_pixels'. */ + /* To get the bbox in pixel coordinates, set `bbox_mode' to */ + /* `ft_glyph_bbox_truncate'. */ + /* */ + /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ + /* to `ft_glyph_bbox_pixels'. */ + /* */ + /* The default value for `bbox_mode' is `ft_glyph_bbox_pixels'. */ /* */ FT_EXPORT_FUNC( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, diff --git a/src/base/rules.mk b/src/base/rules.mk index 1763a0981..347940605 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -45,7 +45,8 @@ BASE_SRC := $(BASE_)ftcalc.c \ # object. It will then be linked to the final executable only if one of its # symbols is used by the application. # -BASE_EXT_SRC := $(BASE_)ftglyph.c \ +BASE_EXT_SRC := $(BASE_)ftglyph.c \ + $(BASE_)ftnames.c \ $(BASE_)ftmm.c # Default extensions objects