freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master e283f29: * src/ftinspect.cpp (MainGUI::loadFont


From: Werner LEMBERG
Subject: [freetype2-demos] master e283f29: * src/ftinspect.cpp (MainGUI::loadFonts): Improve logic.
Date: Wed, 04 May 2016 07:41:21 +0000

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

    * src/ftinspect.cpp (MainGUI::loadFonts): Improve logic.
---
 ChangeLog         |    6 +++++-
 src/ftinspect.cpp |    8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 642f758..d056be7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2016-05-03  Werner Lemberg  <address@hidden>
+2016-05-04  Werner Lemberg  <address@hidden>
+
+       * src/ftinspect.cpp (MainGUI::loadFonts): Improve logic.
+
+2016-05-04  Werner Lemberg  <address@hidden>
 
        [ftinspect] Make `previous face' and `next face' button logic work.
 
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 51ef50b..c150606 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -152,6 +152,8 @@ MainGUI::about()
 void
 MainGUI::loadFonts()
 {
+  int oldSize = fontFileNames.size();
+
   QStringList files = QFileDialog::getOpenFileNames(
                         this,
                         tr("Load one or more fonts"),
@@ -161,8 +163,10 @@ MainGUI::loadFonts()
                         QFileDialog::ReadOnly);
   fontFileNames += files;
 
-  if (!fontFileNames.isEmpty() && currentFontFileIndex == -1)
-    currentFontFileIndex = 0;
+  // if we have new fonts, set the current index to the first new one
+  if (!fontFileNames.isEmpty()
+      && oldSize < fontFileNames.size())
+    currentFontFileIndex = oldSize;
 
   checkCurrentFontFileIndex();
 



reply via email to

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