freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 4f87d81 2/4: [ftinspect] Compute load flags for


From: Werner LEMBERG
Subject: [freetype2-demos] master 4f87d81 2/4: [ftinspect] Compute load flags for `FT_Load_Glyph'.
Date: Fri, 06 May 2016 21:42:58 +0000

branch: master
commit 4f87d8111b5268b3f6ae405608be9d79bf82564c
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftinspect] Compute load flags for `FT_Load_Glyph'.
    
    * src/ftinspect.cpp (Engine::update): Compute `doHinting' and
    `doAutoHinting', and `loadFlags'.
    
    * src/ftinspect.h (Engine): Updated.
---
 ChangeLog         |    9 +++++++++
 src/ftinspect.cpp |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/ftinspect.h   |    4 ++++
 3 files changed, 64 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index be0379d..3c4c457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2016-05-06  Werner Lemberg  <address@hidden>
 
+       [ftinspect] Compute load flags for `FT_Load_Glyph'.
+
+       * src/ftinspect.cpp (Engine::update): Compute `doHinting' and
+       `doAutoHinting', and `loadFlags'.
+
+       * src/ftinspect.h (Engine): Updated.
+
+2016-05-06  Werner Lemberg  <address@hidden>
+
        [ftinspect] Add general hinting check button.
 
        * src/ftinspect.cpp (MainGUI::checkHinting): New method.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 67c6ccf..83d356e 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -282,6 +282,9 @@ Engine::update()
     pointSize = pixelSize * 72.0 / dpi;
   }
 
+  doHinting = gui->hintingCheckBox->isChecked();
+
+  doAutoHinting = gui->autoHintingCheckBox->isChecked();
   doHorizontalHinting = gui->horizontalHintingCheckBox->isChecked();
   doVerticalHinting = gui->verticalHintingCheckBox->isChecked();
   doBlueZoneHinting = gui->blueZoneHintingCheckBox->isChecked();
@@ -297,6 +300,54 @@ Engine::update()
   showOutlines = gui->showOutlinesCheckBox->isChecked();
 
   gamma = gui->gammaSlider->value();
+
+  loadFlags = FT_LOAD_DEFAULT;
+  if (doAutoHinting)
+    loadFlags |= FT_LOAD_FORCE_AUTOHINT;
+  loadFlags |= FT_LOAD_NO_BITMAP; // XXX handle bitmap fonts also
+
+  int index = gui->antiAliasingComboBoxx->currentIndex();
+
+  if (doHinting)
+  {
+    int target;
+
+    if (index == MainGUI::AntiAliasing_None)
+      target = FT_LOAD_TARGET_MONO;
+    else
+    {
+      switch (index)
+      {
+      case MainGUI::AntiAliasing_Slight:
+        target = FT_LOAD_TARGET_LIGHT;
+        break;
+
+      case MainGUI::AntiAliasing_LCD:
+      case MainGUI::AntiAliasing_LCD_BGR:
+        target = FT_LOAD_TARGET_LCD;
+        break;
+
+      case MainGUI::AntiAliasing_LCD_Vertical:
+      case MainGUI::AntiAliasing_LCD_Vertical_BGR:
+        target = FT_LOAD_TARGET_LCD_V;
+        break;
+
+      default:
+        target = FT_LOAD_TARGET_NORMAL;
+      }
+    }
+
+    loadFlags |= target;
+  }
+  else
+  {
+    loadFlags |= FT_LOAD_NO_HINTING;
+
+    if (index == MainGUI::AntiAliasing_None)
+      loadFlags |= FT_LOAD_MONOCHROME;
+  }
+
+  // XXX handle color fonts also
 }
 
 
diff --git a/src/ftinspect.h b/src/ftinspect.h
index 7ca4942..0767dce 100644
--- a/src/ftinspect.h
+++ b/src/ftinspect.h
@@ -99,6 +99,8 @@ private:
   int dpi;
   int zoom;
 
+  bool doHinting;
+  bool doAutoHinting;
   bool doHorizontalHinting;
   bool doVerticalHinting;
   bool doBlueZoneHinting;
@@ -111,6 +113,8 @@ private:
   bool showOutlines;
 
   double gamma;
+
+  int loadFlags;
 };
 
 



reply via email to

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