[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 7bc1e02 4/4: * src/ftinspect.cpp (MainGUI::show
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 7bc1e02 4/4: * src/ftinspect.cpp (MainGUI::showFont): Fix logic. |
Date: |
Fri, 06 May 2016 21:42:58 +0000 |
branch: master
commit 7bc1e0241e3716c97a7c1c703239c845f31f7f4d
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
* src/ftinspect.cpp (MainGUI::showFont): Fix logic.
---
ChangeLog | 4 +++
src/ftinspect.cpp | 76 ++++++++++++++++++++++++++---------------------------
2 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 80f62e3..f2da01a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2016-05-06 Werner Lemberg <address@hidden>
+ * src/ftinspect.cpp (MainGUI::showFont): Fix logic.
+
+2016-05-06 Werner Lemberg <address@hidden>
+
[ftinspect] Simplify code.
* src/ftinspect.cpp (MainGUI::createConnections,
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 7a33f45..4f8a914 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -466,55 +466,55 @@ MainGUI::closeFont()
void
MainGUI::showFont()
{
- if (currentFontIndex < 0)
- return;
-
- // we do lazy evaluation as much as possible
-
- Font& font = fonts[currentFontIndex];
+ if (currentFontIndex >= 0)
+ {
+ // we do lazy evaluation as much as possible
- // if not yet available, extract the number of faces and indices
- // for the current font
+ Font& font = fonts[currentFontIndex];
- if (font.numInstancesList.isEmpty())
- {
- int numFaces = engine->numFaces(currentFontIndex);
+ // if not yet available, extract the number of faces and indices
+ // for the current font
- if (numFaces > 0)
+ if (font.numInstancesList.isEmpty())
{
- for (int i = 0; i < numFaces; i++)
- font.numInstancesList.append(-1);
+ int numFaces = engine->numFaces(currentFontIndex);
- currentFaceIndex = 0;
- currentInstanceIndex = 0;
- }
- else
- {
- // we use `numInstancesList' with a single element set to zero
- // to indicate either a non-font or a font FreeType couldn't load;
- font.numInstancesList.append(0);
+ if (numFaces > 0)
+ {
+ for (int i = 0; i < numFaces; i++)
+ font.numInstancesList.append(-1);
- currentFaceIndex = -1;
- currentInstanceIndex = -1;
+ currentFaceIndex = 0;
+ currentInstanceIndex = 0;
+ }
+ else
+ {
+ // we use `numInstancesList' with a single element set to zero
+ // to indicate either a non-font or a font FreeType couldn't load;
+ font.numInstancesList.append(0);
+
+ currentFaceIndex = -1;
+ currentInstanceIndex = -1;
+ }
}
- }
- // value -1 in `numInstancesList' means `not yet initialized'
- else if (font.numInstancesList[currentFaceIndex] < 0)
- {
- int numInstances = engine->numInstances(currentFontIndex,
- currentFaceIndex);
+ // value -1 in `numInstancesList' means `not yet initialized'
+ if (font.numInstancesList[currentFaceIndex] < 0)
+ {
+ int numInstances = engine->numInstances(currentFontIndex,
+ currentFaceIndex);
- // XXX? we ignore errors
- if (numInstances < 0)
- numInstances = 1;
+ // XXX? we ignore errors
+ if (numInstances < 0)
+ numInstances = 1;
- font.numInstancesList[currentFaceIndex] = numInstances;
+ font.numInstancesList[currentFaceIndex] = numInstances;
- // instance index 0 represents a face without an instance;
- // consequently, `n' instances are enumerated from 1 to `n'
- // (instead of having indices 0 to `n-1')
- currentInstanceIndex = 0;
+ // instance index 0 represents a face without an instance;
+ // consequently, `n' instances are enumerated from 1 to `n'
+ // (instead of having indices 0 to `n-1')
+ currentInstanceIndex = 0;
+ }
}
checkCurrentFontIndex();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 7bc1e02 4/4: * src/ftinspect.cpp (MainGUI::showFont): Fix logic.,
Werner LEMBERG <=