freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master bdef236 03/13: [ftinspect] Synchronize dpi, tar


From: Werner LEMBERG
Subject: [freetype2-demos] master bdef236 03/13: [ftinspect] Synchronize dpi, target, pxlMode types with FreeType.
Date: Thu, 11 May 2017 15:26:22 -0400 (EDT)

branch: master
commit bdef2368d979b9c6558359406af9e1f70aa157f4
Author: Philipp Kerling <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftinspect] Synchronize dpi, target, pxlMode types with FreeType.
    
    * src/ftinspect.h (Engine): Make `dpi' unsigned int.
    Make `loadFlags' unsigned long.
    (GlyphBitmap): Use `FT_Pixel_Mode' for `pixelMode' and constructor.
    
    * src/ftinspect.c: Include `cstdint', `cmath', `limits',
    `stdexcept', needed by forthcoming commits.
    (Engine::update, GlyphBitmap::GlyphBitmap, MainGUI::drawGlyph):
    Updated.
---
 ChangeLog         | 13 +++++++++++++
 src/ftinspect.cpp | 13 +++++++++----
 src/ftinspect.h   |  8 ++++----
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b9f286c..c80ccf8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-05-11  Philipp Kerling  <address@hidden>
 
+       [ftinspect] Synchronize dpi, target, pxlMode types with FreeType.
+
+       * src/ftinspect.h (Engine): Make `dpi' unsigned int.
+       Make `loadFlags' unsigned long.
+       (GlyphBitmap): Use `FT_Pixel_Mode' for `pixelMode' and constructor.
+
+       * src/ftinspect.c: Include `cstdint', `cmath', `limits',
+       `stdexcept', needed by forthcoming commits.
+       (Engine::update, GlyphBitmap::GlyphBitmap, MainGUI::drawGlyph):
+       Updated.
+
+2017-05-11  Philipp Kerling  <address@hidden>
+
        [ftinspect] Change freetype2 include path to system include path.
 
        This avoids warnings.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 3ec36e9..a0305a3 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -4,6 +4,10 @@
 
 #include "ftinspect.h"
 
+#include <cstdint>
+#include <cmath>
+#include <limits>
+#include <stdexcept>
 
 #define VERSION "X.Y.Z"
 
@@ -531,7 +535,8 @@ Engine::setTTInterpreterVersion(int mode)
 void
 Engine::update()
 {
-  dpi = gui->dpiSpinBox->value();
+  // Spinbox value cannot become negative
+  dpi = static_cast<unsigned int> (gui->dpiSpinBox->value());
 
   if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px)
   {
@@ -564,7 +569,7 @@ Engine::update()
 
   if (doHinting)
   {
-    int target;
+    unsigned long target;
 
     if (index == MainGUI::AntiAliasing_None)
       target = FT_LOAD_TARGET_MONO;
@@ -1136,7 +1141,7 @@ GlyphPointNumbers::paint(QPainter* painter,
 
 GlyphBitmap::GlyphBitmap(FT_Outline* outline,
                          FT_Library lib,
-                         int pxlMode,
+                         FT_Pixel_Mode pxlMode,
                          const QVector<QRgb>& monoColorTbl,
                          const QVector<QRgb>& grayColorTbl)
 : library(lib),
@@ -1917,7 +1922,7 @@ MainGUI::drawGlyph()
     if (showBitmapCheckBox->isChecked())
     {
       // XXX support LCD
-      int pixelMode = FT_PIXEL_MODE_GRAY;
+      FT_Pixel_Mode pixelMode = FT_PIXEL_MODE_GRAY;
       if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_None)
         pixelMode = FT_PIXEL_MODE_MONO;
 
diff --git a/src/ftinspect.h b/src/ftinspect.h
index 7946ac0..7d6f86b 100644
--- a/src/ftinspect.h
+++ b/src/ftinspect.h
@@ -149,7 +149,7 @@ private:
 
   double pointSize;
   double pixelSize;
-  int dpi;
+  unsigned int dpi;
 
   bool doHinting;
   bool doAutoHinting;
@@ -161,7 +161,7 @@ private:
 
   double gamma;
 
-  int loadFlags;
+  unsigned long loadFlags;
 };
 
 
@@ -246,7 +246,7 @@ class GlyphBitmap
 public:
   GlyphBitmap(FT_Outline*,
               FT_Library,
-              int,
+              FT_Pixel_Mode,
               const QVector<QRgb>&,
               const QVector<QRgb>&);
   ~GlyphBitmap();
@@ -258,7 +258,7 @@ public:
 private:
   FT_Outline transformed;
   FT_Library library;
-  int pixelMode;
+  unsigned char pixelMode;
   const QVector<QRgb>& monoColorTable;
   const QVector<QRgb>& grayColorTable;
   QRectF bRect;



reply via email to

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