diff options
author | Egbert Eich <eich@suse.de> | 2004-08-04 12:21:48 +0000 |
---|---|---|
committer | Egbert Eich <eich@suse.de> | 2004-08-04 12:21:48 +0000 |
commit | e521b8425894ae62ebe225af80e8b6f820df6ff8 (patch) | |
tree | 6a3f655bfa5aa4e76192b48ae045d1721d893543 | |
parent | 0cbe4e38042a21ee193b2fda42fa647e23f61758 (diff) |
Optimization of CJK rendering when using versions of freetype prior torel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1
2.1.8 (Chisato Yamauchi).
A small backward compatibility fix to make the freetype module build with
freetype version < 2.1.7.
Fixed/added some debugging code.
-rw-r--r-- | src/FreeType/ft.h | 2 | ||||
-rw-r--r-- | src/FreeType/ftfuncs.c | 37 | ||||
-rw-r--r-- | src/FreeType/fttools.c | 7 |
3 files changed, 30 insertions, 16 deletions
diff --git a/src/FreeType/ft.h b/src/FreeType/ft.h index 91c8d42..8ad8403 100644 --- a/src/FreeType/ft.h +++ b/src/FreeType/ft.h @@ -28,6 +28,8 @@ THE SOFTWARE. #include <X11/Xfuncproto.h> +#define FREETYPE_VERSION (FREETYPE_MAJOR * 1000000 + FREETYPE_MINOR * 1000 + FREETYPE_PATCH) + #undef DEBUG_TRUETYPE #ifdef DEBUG_TRUETYPE diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c index f53e3c9..9e6163e 100644 --- a/src/FreeType/ftfuncs.c +++ b/src/FreeType/ftfuncs.c @@ -25,7 +25,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XdotOrg: xc/lib/font/FreeType/ftfuncs.c,v 1.5 2004/08/03 09:02:17 eich Exp $ */ +/* $XdotOrg: xc/lib/font/FreeType/ftfuncs.c,v 1.6 2004/08/03 16:12:53 eich Exp $ */ /* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.43 2004/02/07 04:37:18 dawes Exp $ */ @@ -69,8 +69,6 @@ THE SOFTWARE. #include "ftfuncs.h" #include "xttcap.h" -#define FREETYPE_VERSION (FREETYPE_MAJOR * 1000000 + FREETYPE_MINOR * 1000 + FREETYPE_PATCH) - /* Work around FreeType bug */ #define WORK_AROUND_UPM 2048 @@ -92,12 +90,6 @@ THE SOFTWARE. #define DEFAULT_VERY_LAZY 2 /* Multi-byte only */ /* #define DEFAULT_VERY_LAZY 256 */ /* Unicode only */ -#if (FREETYPE_VERSION < 2001008) -#ifdef DEFAULT_VERY_LAZY -#undef DEFAULT_VERY_LAZY -#endif -#endif - /* Does the X accept noSuchChar? */ #define X_ACCEPTS_NO_SUCH_CHAR /* Does the XAA accept NULL noSuchChar.bits?(dangerous) */ @@ -912,7 +904,8 @@ ft_get_very_lazy_bbox( FT_UInt index, static FT_Error FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index, - FT_UShort glyph_index, FT_Glyph_Metrics *metrics_return ) + FT_UShort glyph_index, FT_Glyph_Metrics *metrics_return, + int *sbitchk_incomplete_but_exist ) { #if (FREETYPE_VERSION >= 2001008) SFNT_Service sfnt; @@ -979,7 +972,15 @@ FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index, Exit: return error; #else /* if (FREETYPE_VERSION < 2001008) */ - return -1; + TT_Face face; + SFNT_Service sfnt; + if ( ! FT_IS_SFNT( ft_face ) ) return -1; + face = (TT_Face)ft_face; + sfnt = (SFNT_Service)face->sfnt; + if ( strike_index != 0xFFFFU && sfnt->load_sbits ) { + if ( sbitchk_incomplete_but_exist ) *sbitchk_incomplete_but_exist=1; + } + return -1; #endif } @@ -999,6 +1000,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, int dx, dy; int leftSideBearing, rightSideBearing, characterWidth, rawCharacterWidth, ascent, descent; + int sbitchk_incomplete_but_exist; double bbox_center_raw; face = instance->face; @@ -1027,14 +1029,15 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, int new_width; double ratio; + sbitchk_incomplete_but_exist=0; if( ! (instance->load_flags & FT_LOAD_NO_BITMAP) ) { if( FT_Do_SBit_Metrics(face->face,instance->size,instance->strike_index, - idx,&sbit_metrics)==0 ) { + idx,&sbit_metrics,&sbitchk_incomplete_but_exist)==0 ) { bitmap_metrics = &sbit_metrics; } } if( bitmap_metrics == NULL ) { - if ( instance->ttcap.flags & TTCAP_IS_VERY_LAZY ) { + if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) { if( ft_get_very_lazy_bbox( idx, face->face, instance->size, instance->ttcap.vl_slant, &instance->transformation.matrix, @@ -1053,7 +1056,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, } if( bitmap_metrics ) { - int factor; + FT_Pos factor; leftSideBearing = bitmap_metrics->horiBearingX / 64; rightSideBearing = (bitmap_metrics->width + bitmap_metrics->horiBearingX) / 64; @@ -1170,14 +1173,16 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, else if( flags & FT_FORCE_CONSTANT_SPACING ) correct=1; else{ int sbit_available=0; + sbitchk_incomplete_but_exist=0; if( !(instance->load_flags & FT_LOAD_NO_BITMAP) ) { if( FT_Do_SBit_Metrics(face->face,instance->size, - instance->strike_index,idx,NULL)==0 ) { + instance->strike_index,idx,NULL, + &sbitchk_incomplete_but_exist)==0 ) { sbit_available=1; } } if( sbit_available == 0 ) { - if ( instance->ttcap.flags & TTCAP_IS_VERY_LAZY ) { + if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) { if( FT_IS_SFNT(face->face) ) correct=1; } } diff --git a/src/FreeType/fttools.c b/src/FreeType/fttools.c index 3df910e..1567724 100644 --- a/src/FreeType/fttools.c +++ b/src/FreeType/fttools.c @@ -40,6 +40,13 @@ #include FT_TRUETYPE_IDS_H #include "ft.h" +/* backward compatibility hack */ +#if (FREETYPE_VERSION < 2001008) +# ifndef ft_isdigit +# define ft_isdigit isdigit +# endif +#endif + #ifndef LSBFirst #define LSBFirst 0 #define MSBFirst 1 |