From 5d614884764f40e50280dfd638a8b02344587318 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 9 Aug 2002 19:51:12 +0000 Subject: [PATCH] Submission for Gideon May, fixes for spacing in various osgText files. --- AUTHORS | 3 +++ src/osgText/FTBitmapGlyph.cpp | 5 +++-- src/osgText/FTOutlineGlyph.cpp | 3 ++- src/osgText/FTPixmapGlyph.cpp | 8 ++++---- src/osgText/FTPolyGlyph.cpp | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 70854cc72..d6b08c04a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -126,6 +126,9 @@ Pavel Moloshtan Alberto Barbati - lazy evaluation of the inverse in the MatrixTransform. +Gideon May + - fixed spacing in osgText. + Indirect Contributors --------------------- diff --git a/src/osgText/FTBitmapGlyph.cpp b/src/osgText/FTBitmapGlyph.cpp index 0f0b0b682..63f9cd583 100644 --- a/src/osgText/FTBitmapGlyph.cpp +++ b/src/osgText/FTBitmapGlyph.cpp @@ -12,6 +12,8 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph) if( err || ft_glyph_format_bitmap != glyph->format) {return;} + advance = glyph->advance.x >> 16; + FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph; FT_Bitmap* source = &bitmap->bitmap; @@ -24,9 +26,8 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph) if (srcPitch*srcHeight==0) return; - advance = glyph->advance.x >> 16; - pos.x = bitmap->left; + pos.x = bitmap->left; pos.y = srcHeight - bitmap->top; // FIXME What about dest alignment? diff --git a/src/osgText/FTOutlineGlyph.cpp b/src/osgText/FTOutlineGlyph.cpp index 26c4da338..3039cd895 100644 --- a/src/osgText/FTOutlineGlyph.cpp +++ b/src/osgText/FTOutlineGlyph.cpp @@ -18,6 +18,8 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph) return; } + advance = glyph->advance.x >> 16; + vectoriser = osgNew FTVectoriser( glyph); vectoriser->Process(); @@ -44,7 +46,6 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph) vectoriser->MakeOutline( data); - advance = glyph->advance.x >> 16; vectoriser=0; diff --git a/src/osgText/FTPixmapGlyph.cpp b/src/osgText/FTPixmapGlyph.cpp index 3a6c448d7..3cd46f143 100644 --- a/src/osgText/FTPixmapGlyph.cpp +++ b/src/osgText/FTPixmapGlyph.cpp @@ -1,7 +1,6 @@ #include "FTPixmapGlyph.h" #include "FTGL.h" - FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph) : FTGlyph(), destWidth(0), @@ -16,6 +15,8 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph) return; } + advance = glyph->advance.x >> 16; + FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph; FT_Bitmap* source = &bitmap->bitmap; @@ -25,11 +26,10 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph) int srcWidth = source->width; int srcHeight = source->rows; int srcPitch = source->pitch; - + if (srcWidth*srcHeight==0) return; - + numGreys = source->num_grays; - advance = glyph->advance.x >> 16; pos.x = bitmap->left; pos.y = srcHeight - bitmap->top; diff --git a/src/osgText/FTPolyGlyph.cpp b/src/osgText/FTPolyGlyph.cpp index 8e4fd4281..3ae3905be 100644 --- a/src/osgText/FTPolyGlyph.cpp +++ b/src/osgText/FTPolyGlyph.cpp @@ -66,6 +66,8 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph) if( ft_glyph_format_outline != glyph->format) { return;} + advance = glyph->advance.x >> 16; + vectoriser = osgNew FTVectoriser( glyph); vectoriser->Process(); @@ -90,7 +92,6 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph) vectoriser->MakeOutline( data); contourFlag = vectoriser->ContourFlag(); - advance = glyph->advance.x >> 16; vectoriser=0; // delete it, using ref_ptr.