Commit a90225b5a5d639adce07f3b90ee9ace13de398a0

sammy 2008-05-11T11:29:39

* Get rid of all methods in FTLayoutImpl that were accessing FTFontImpl internals, since FTFont now has all the proper public methods for that.

diff --git a/src/FTFont/FTFontImpl.h b/src/FTFont/FTFontImpl.h
index d9891b1..7962e8e 100644
--- a/src/FTFont/FTFontImpl.h
+++ b/src/FTFont/FTFontImpl.h
@@ -32,12 +32,9 @@
 
 class FTGlyphContainer;
 class FTGlyph;
-class FTLayout;
 
 class FTFontImpl
 {
-        /* Allow FTLayout classes to access CheckGlyph */
-        friend class FTLayoutImpl;
         friend class FTFont;
 
     protected:
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index 568cc03..2a5e77a 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -372,9 +372,6 @@ class FTGL_EXPORT FTFont
         virtual FTGlyph* MakeGlyph(FT_GlyphSlot slot) = 0;
 
     private:
-        /* Allow FTLayout classes to access this->impl. */
-        friend class FTLayoutImpl;
-
         /**
          * Internal FTGL FTFont implementation object. For private use only.
          */
diff --git a/src/FTLayout/FTLayout.cpp b/src/FTLayout/FTLayout.cpp
index 193344e..5cdc083 100644
--- a/src/FTLayout/FTLayout.cpp
+++ b/src/FTLayout/FTLayout.cpp
@@ -77,33 +77,3 @@ FTLayoutImpl::~FTLayoutImpl()
     ;
 }
 
-
-void FTLayoutImpl::DoRender(FTFont *font, const unsigned int chr,
-                            const unsigned int nextChr, int renderMode)
-{
-    wchar_t string[3];
-    string[0] = chr;
-    string[1] = nextChr;
-    string[2] = '\0';
-
-    pen = font->Render(string, 1, pen, FTPoint(), renderMode);
-}
-
-
-void FTLayoutImpl::CheckGlyph(FTFont *font, const unsigned int Chr)
-{
-    font->impl->CheckGlyph(Chr);
-}
-
-
-FTGlyphContainer * FTLayoutImpl::GetGlyphs(FTFont *font)
-{
-    return font->impl->glyphList;
-}
-
-
-FTSize & FTLayoutImpl::GetCharSize(FTFont *font)
-{
-    return font->impl->charSize;
-}
-
diff --git a/src/FTLayout/FTLayoutImpl.h b/src/FTLayout/FTLayoutImpl.h
index 4bc0aa6..c424105 100644
--- a/src/FTLayout/FTLayoutImpl.h
+++ b/src/FTLayout/FTLayoutImpl.h
@@ -46,45 +46,6 @@ class FTLayoutImpl
         FTPoint pen;
 
         /**
-         * Expose <code>FTFont::DoRender</code> method to derived classes.
-         *
-         * @param font      The font that contains the glyph.
-         * @param chr       current character
-         * @param nextChr   next character
-         * @param renderMode  Render mode to diplay
-         * @see FTFont::DoRender
-         */
-        void DoRender(FTFont *font, const unsigned int chr,
-                      const unsigned int nextChr, int renderMode);
-
-        /**
-         * Expose <code>FTFont::CheckGlyph</code> method to derived classes.
-         *
-         * @param font The font that contains the glyph.
-         * @param chr  character index
-         */
-        void CheckGlyph(FTFont *font, const unsigned int Chr);
-
-        /**
-         * Expose the FTFont <code>glyphList</code> to our derived classes.
-         *
-         * @param font The font to perform the query on.
-         * @param Char The character corresponding to the glyph to query.
-         *
-         * @return A pointer to the glyphList of font.
-         */
-        FTGlyphContainer *GetGlyphs(FTFont *font);
-
-        /**
-         * Expose the FTFont <code>charSize</code> to our derived classes.
-         *
-         * @param The font to perform the query on.
-         *
-         * @return A reference to the charSize object of font.
-         */
-        FTSize &GetCharSize(FTFont *font);
-
-        /**
          * Current error code. Zero means no error.
          */
         FT_Error err;
diff --git a/src/FTLayout/FTSimpleLayout.cpp b/src/FTLayout/FTSimpleLayout.cpp
index 1fd24f0..ce8ce8d 100644
--- a/src/FTLayout/FTSimpleLayout.cpp
+++ b/src/FTLayout/FTSimpleLayout.cpp
@@ -235,11 +235,10 @@ inline void FTSimpleLayoutImpl::WrapTextI(const T *buf, int renderMode,
     for(int i = 0; buf[i]; i++)
     {
         // Find the width of the current glyph
-        CheckGlyph(currentFont, buf[i]);
-        glyphBounds = GetGlyphs(currentFont)->BBox(buf[i]);
+        glyphBounds = currentFont->BBox(buf + i, 1);
         glyphWidth = glyphBounds.Upper().Xf() - glyphBounds.Lower().Xf();
 
-        advance = GetGlyphs(currentFont)->Advance(buf[i], buf[i + 1]).Xf();
+        advance = currentFont->Advance(buf + i, 1).Xf();
         prevWidth = currentWidth;
         // Compute the width of all glyphs up to the end of buf[i]
         currentWidth = nextStart + glyphWidth;
@@ -282,7 +281,7 @@ inline void FTSimpleLayoutImpl::WrapTextI(const T *buf, int renderMode,
             // Store the start of the next line
             lineStart = breakIdx + 1;
             // TODO: Is Height() the right value here?
-            pen -= FTPoint(0, GetCharSize(currentFont).Height() * lineSpacing);
+            pen -= FTPoint(0, currentFont->LineHeight() * lineSpacing);
             // The current width is the width since the last break
             nextStart = wordLength + advance;
             wordLength += advance;
@@ -444,7 +443,7 @@ inline void FTSimpleLayoutImpl::RenderSpaceI(const T *string, const int start,
             pen += FTPoint(space, 0);
         }
 
-        DoRender(currentFont, string[i], string[i + 1], renderMode);
+        pen = currentFont->Render(string + i, 1, pen, FTPoint(), renderMode);
     }
 }