libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd_src gltext.cpp


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd/cvd_src gltext.cpp
Date: Mon, 25 May 2009 14:01:21 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      09/05/25 14:01:21

Modified files:
        cvd_src        : gltext.cpp 

Log message:
        better tabs in gltext

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/gltext.cpp?cvsroot=libcvd&r1=1.1&r2=1.2

Patches:
Index: gltext.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/gltext.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gltext.cpp  12 Jun 2008 15:22:39 -0000      1.1
+++ gltext.cpp  25 May 2009 14:01:21 -0000      1.2
@@ -135,6 +135,8 @@
     double max_total = 0;
     double total=0;
     const Internal::Font * font = Internal::data.currentFont();
+    const Internal::Font::Char * space = font->findChar(' ');
+    const double tab_width = 8 * ((space)?(space->advance):1);
     for (size_t i=0; i<text.length(); ++i) {
         char c = text[i];
         if (c == '\n') {
@@ -144,6 +146,12 @@
             ++lines;
             continue;
         }
+        if(c == '\t'){
+            const float advance = tab_width - fmodf(total, tab_width);
+            total += advance;
+            glTranslated(advance, 0, 0);
+            continue;
+        }
         const Internal::Font::Char * ch = font->findChar(c);
         if(!ch){
             c = toupper(c);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]