Fix kerning for the first pair of characters
authorDavid Gow <[email protected]>
Mon, 18 Aug 2014 13:18:31 +0000 (21:18 +0800)
committerDavid Gow <[email protected]>
Mon, 18 Aug 2014 13:18:31 +0000 (21:18 +0800)
src/document.cpp

index 57b8925..3f00e64 100644 (file)
@@ -798,7 +798,7 @@ void Document::AddText(const string & text, Real scale, Real x, Real y)
                        
                int advance_width = 0, left_side_bearing = 0, kerning = 0;
                stbtt_GetCodepointHMetrics(&m_font, text[i], &advance_width, &left_side_bearing);
                        
                int advance_width = 0, left_side_bearing = 0, kerning = 0;
                stbtt_GetCodepointHMetrics(&m_font, text[i], &advance_width, &left_side_bearing);
-               if (i > 1)
+               if (i >= 1)
                {
                        kerning = stbtt_GetCodepointKernAdvance(&m_font, text[i-1], text[i]);
                }
                {
                        kerning = stbtt_GetCodepointKernAdvance(&m_font, text[i-1], text[i]);
                }

UCC git Repository :: git.ucc.asn.au