freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] veeki-gsoc-experimental 6cb280d: GUI bug fixes 3


From: Veeki Yadav
Subject: [freetype2-demos] veeki-gsoc-experimental 6cb280d: GUI bug fixes 3
Date: Sun, 18 Aug 2019 10:07:38 -0400 (EDT)

branch: veeki-gsoc-experimental
commit 6cb280ddc1cce6376eb810cb25221c43b10e47f0
Author: gevic <address@hidden>
Commit: gevic <address@hidden>

    GUI bug fixes 3
    
    Fixes dot-like pixel when zoomed in 'Comparator' mode.
    Enabled glyph index push buttons in 'All Glyphs' mode.
    Passed command line arguements without normalizing.
---
 src/ftinspect/ftinspect.cpp            |  2 +-
 src/ftinspect/maingui.cpp              | 12 +++++++++---
 src/ftinspect/rendering/comparator.cpp | 15 ++++++++-------
 src/ftinspect/rendering/view.cpp       | 12 +++++++-----
 src/ftinspect/rendering/view.hpp       |  4 +++-
 5 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/src/ftinspect/ftinspect.cpp b/src/ftinspect/ftinspect.cpp
index 504ec8b..21a7be6 100644
--- a/src/ftinspect/ftinspect.cpp
+++ b/src/ftinspect/ftinspect.cpp
@@ -26,7 +26,7 @@ main(int argc,
 
   for (int i = 1; i < QCoreApplication::arguments().size(); i++)
   {
-    QString homeDir = app.applicationDirPath() + "/" + 
QCoreApplication::arguments().at(i);
+    QString homeDir = QCoreApplication::arguments().at(i);
     gui.files.append(homeDir);
   }
 
diff --git a/src/ftinspect/maingui.cpp b/src/ftinspect/maingui.cpp
index 75eb343..842dab7 100644
--- a/src/ftinspect/maingui.cpp
+++ b/src/ftinspect/maingui.cpp
@@ -1281,7 +1281,7 @@ MainGUI::renderAll()
     }
 
   // disable glyph buttons
-  toStartButtonx->setEnabled(false);
+  /*toStartButtonx->setEnabled(false);
   toM1000Buttonx->setEnabled(false);
   toM100Buttonx->setEnabled(false);
   toM10Buttonx->setEnabled(false);
@@ -1290,7 +1290,7 @@ MainGUI::renderAll()
   toP10Buttonx->setEnabled(false);
   toP100Buttonx->setEnabled(false);
   toP1000Buttonx->setEnabled(false);
-  toEndButtonx->setEnabled(false);
+  toEndButtonx->setEnabled(false);*/
 
   // diable tabs
   tabWidget->setTabEnabled(1, false);
@@ -1326,7 +1326,8 @@ MainGUI::renderAll()
                                   kerning_mode,
                                   kerning_degree,
                                   engine->getFlags(),
-                                  (gammaSlider->value()/10.0));
+                                  (gammaSlider->value()/10.0),
+                                  currentGlyphIndex);
   glyphScene->addItem(currentRenderAllItem);
 
   if (renderAllCount < 2)
@@ -1420,6 +1421,11 @@ MainGUI::adjustGlyphIndex(int delta)
   glyphNameLabel->setText(engine->glyphName(currentGlyphIndex));
 
   drawGlyph();
+
+  if (allGlyphs->isChecked())
+  {
+    renderAll();
+  }
 }
 
 
diff --git a/src/ftinspect/rendering/comparator.cpp 
b/src/ftinspect/rendering/comparator.cpp
index 4fcfbbd..cbc039d 100644
--- a/src/ftinspect/rendering/comparator.cpp
+++ b/src/ftinspect/rendering/comparator.cpp
@@ -132,11 +132,11 @@ Comparator::paint(QPainter* painter,
                 0,
                 &f);*/
 
-  error = FT_Set_Char_Size(face,
+  /*error = FT_Set_Char_Size(face,
                         0,
                         16 * 64,
                         0,
-                        72);
+                        72);*/
                         
   //column_y_start = 10 + 2 * HEADER_HEIGHT;
   //column_height  = height - 8 * HEADER_HEIGHT - 5;
@@ -191,14 +191,15 @@ Comparator::paint(QPainter* painter,
       {
         colorTable << qRgba(0, 0, 0, i);
       }
+      glyphImage.setColorTable(colorTable);
 
-      if (pixelMode_col[col] == FT_PIXEL_MODE_GRAY)
+      /* if (pixelMode_col[col] == FT_PIXEL_MODE_GRAY)
       {
-        glyphImage.setColorTable(colorTable);
+        
       } else
       {
         glyphImage.setColorTable(colorTable);
-      }
+      }*/
 
       FT_Pos bottom = 0;
 
@@ -219,8 +220,8 @@ Comparator::paint(QPainter* painter,
           const double a = qAlpha(p) / 255.0;
           painter->fillRect(QRectF(n + column_x_start[col]- 1 / lod / 2,
                                     m + height + bottom - 
face->glyph->metrics.horiBearingY/64- 1 / lod / 2,
-                                    1/lod,
-                                    1/lod),
+                                    1,
+                                    1),
                             QColor(
                                   255 * std::pow(r, 1/gamma),
                                   255 * std::pow(g, 1/gamma),
diff --git a/src/ftinspect/rendering/view.cpp b/src/ftinspect/rendering/view.cpp
index fa8ed06..0fc3235 100644
--- a/src/ftinspect/rendering/view.cpp
+++ b/src/ftinspect/rendering/view.cpp
@@ -174,7 +174,8 @@ RenderAll::RenderAll(FT_Face face,
           int kern_mode,
           int kern_degree,
           unsigned long loadFlags,
-          double gammaVal)
+          double gammaVal,
+          int glyphIndex)
 :face(face),
 size(size),
 cacheManager(cacheManager),
@@ -192,7 +193,8 @@ stroke_factor(stroke_factor),
 kerning_mode(kern_mode),
 kerning_degree(kern_degree),
 loadFlags(loadFlags),
-gamma(gammaVal)
+gamma(gammaVal),
+glyphIndexStart(glyphIndex)
 {
 }
 
@@ -241,7 +243,7 @@ RenderAll::paint(QPainter* painter,
 
     int count = 0;
     // Normal rendering
-    for ( int i = 0; i < face->num_glyphs; i++ )
+    for ( int i = glyphIndexStart; i < face->num_glyphs; i++ )
     {
       count += 1;
       // get char index
@@ -341,7 +343,7 @@ RenderAll::paint(QPainter* painter,
     xstr = (FT_Pos)( size->metrics.y_ppem * 64 * x_factor );
     ystr = (FT_Pos)( size->metrics.y_ppem * 64 * y_factor );
 
-    for ( int i = 0; i < face->num_glyphs; i++ )
+    for ( int i = glyphIndexStart; i < face->num_glyphs; i++ )
     {
       count += 1;
 
@@ -481,7 +483,7 @@ RenderAll::paint(QPainter* painter,
     FT_Stroker_Set( stroker, 32, FT_STROKER_LINECAP_BUTT,
                 FT_STROKER_LINEJOIN_BEVEL, 0x20000 );
 
-    for ( int i = 0; i < face->num_glyphs; i++ )
+    for ( int i = glyphIndexStart; i < face->num_glyphs; i++ )
     {
       count += 1;
 
diff --git a/src/ftinspect/rendering/view.hpp b/src/ftinspect/rendering/view.hpp
index 9bcda9d..213f063 100644
--- a/src/ftinspect/rendering/view.hpp
+++ b/src/ftinspect/rendering/view.hpp
@@ -48,7 +48,8 @@ public:
        int kerning_mode,
        int kerning_degree,
        unsigned long loadFlags,
-       double gamma);
+       double gamma,
+       int glyphIndexStart);
   ~RenderAll();
   QRectF boundingRect() const;
   void paint(QPainter* painter,
@@ -78,6 +79,7 @@ private:
   int kerning_degree;
   unsigned long loadFlags;
   double gamma;
+  int glyphIndexStart;
 };
 
 



reply via email to

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