Added new `ft_glyph_bbox_unscaled' enum; fixing documentation of FT_Glyph_Get_CBox(). ftnames.c has been omitted from the Makefile.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index 02c9088..dc2ed09 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 @@
/* <Input> */
/* 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. */
/* */
/* <Output> */
/* 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 dbf04fc..ccea179 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -602,8 +602,8 @@
/* <Input> */
/* 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. */
/* */
/* <Output> */
/* 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 1763a09..3479406 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