* Get rid of FTFontImpl::DoRender(), one of the oldest TODOs.
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
diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index b90e1a6..8f21feb 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -414,16 +414,15 @@ template <typename T>
inline FTPoint FTFontImpl::AdvanceI(const T* string, const int len,
FTPoint position, FTPoint spacing)
{
- const T* c = string;
-
- while(*c)
+ for(int i = 0; (len < 0 && string[i]) || (len >= 0 && i < len); i++)
{
- if(CheckGlyph(*c))
+ if(CheckGlyph(string[i]))
{
- position += glyphList->Advance(*c, *(c + 1));
+ position += glyphList->Advance((unsigned int)string[i],
+ (unsigned int)string[i + 1]);
}
- ++c;
- if(*c)
+
+ if(string[i + 1])
{
position += spacing;
}
@@ -449,30 +448,21 @@ FTPoint FTFontImpl::Advance(const wchar_t* string, const int len,
}
-/* FIXME: DoRender should disappear, see commit [853]. */
-void FTFontImpl::DoRender(const unsigned int chr, const unsigned int nextChr,
- FTPoint &origin, int renderMode)
-{
- if(CheckGlyph(chr))
- {
- FTPoint kernAdvance = glyphList->Render(chr, nextChr, origin, renderMode);
- origin += kernAdvance;
- }
-}
-
-
template <typename T>
inline FTPoint FTFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
- const T* c = string;
-
- while(*c)
+ for(int i = 0; (len < 0 && string[i]) || (len >= 0 && i < len); i++)
{
- DoRender(*c, *(c + 1), position, renderMode);
- ++c;
- if(*c)
+ if(CheckGlyph(string[i]))
+ {
+ position += glyphList->Render((unsigned int)string[i],
+ (unsigned int)string[i + 1],
+ position, renderMode);
+ }
+
+ if(string[i + 1])
{
position += spacing;
}
diff --git a/src/FTFont/FTFontImpl.h b/src/FTFont/FTFontImpl.h
index 2c1bf6e..d9891b1 100644
--- a/src/FTFont/FTFontImpl.h
+++ b/src/FTFont/FTFontImpl.h
@@ -36,7 +36,7 @@ class FTLayout;
class FTFontImpl
{
- /* Allow FTLayout classes to access DoRender and CheckGlyph */
+ /* Allow FTLayout classes to access CheckGlyph */
friend class FTLayoutImpl;
friend class FTFont;
@@ -123,22 +123,6 @@ class FTFontImpl
FTFont *intf;
/**
- * Render a character.
- * This function does an implicit conversion on its arguments.
- *
- * @param chr current character
- * @param nextChr next character
- * @param origin The position of the origin of the character.
- * After rendering the point referenced by origin
- * will be incremented by the kerning advance of
- * char and nextChr.
- * @param renderMode Render mode to display
- */
- void DoRender(const unsigned int chr,
- const unsigned int nextChr, FTPoint &origin,
- int renderMode);
-
- /**
* Check that the glyph at <code>chr</code> exist. If not load it.
*
* @param chr character index
diff --git a/src/FTLayout/FTLayout.cpp b/src/FTLayout/FTLayout.cpp
index 8a33fa4..193344e 100644
--- a/src/FTLayout/FTLayout.cpp
+++ b/src/FTLayout/FTLayout.cpp
@@ -81,7 +81,12 @@ FTLayoutImpl::~FTLayoutImpl()
void FTLayoutImpl::DoRender(FTFont *font, const unsigned int chr,
const unsigned int nextChr, int renderMode)
{
- font->impl->DoRender(chr, nextChr, pen, renderMode);
+ wchar_t string[3];
+ string[0] = chr;
+ string[1] = nextChr;
+ string[2] = '\0';
+
+ pen = font->Render(string, 1, pen, FTPoint(), renderMode);
}