[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 4f5e1c4 4/5: [ftinspect] Fix logical mistakes i
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 4f5e1c4 4/5: [ftinspect] Fix logical mistakes in font navigation. |
Date: |
Thu, 12 May 2016 10:05:37 +0000 (UTC) |
branch: master
commit 4f5e1c4c4330c8f2e9421a09237cd7d888ba6e4f
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[ftinspect] Fix logical mistakes in font navigation.
* src/ftinspect.cpp (Engine::Engine): Initialize `ftSize'.
(MainGUI::showFont): Don't let exceed indices the number of
available index values if `preserveIndices' is active.
Always call `engine->loadFont' even for invalid fonts so that
various font-global variables are set correctly.
---
ChangeLog | 10 ++++++++++
src/ftinspect.cpp | 54 +++++++++++++++++++++++++++++------------------------
2 files changed, 40 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 173dfe4..dbe5157 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-05-12 Werner Lemberg <address@hidden>
+
+ [ftinspect] Fix logical mistakes in font navigation.
+
+ * src/ftinspect.cpp (Engine::Engine): Initialize `ftSize'.
+ (MainGUI::showFont): Don't let exceed indices the number of
+ available index values if `preserveIndices' is active.
+ Always call `engine->loadFont' even for invalid fonts so that
+ various font-global variables are set correctly.
+
2016-05-11 Werner Lemberg <address@hidden>
[ftinspect] Minor.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index a5031c5..a84d665 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -82,6 +82,7 @@ faceRequester(FTC_FaceID faceID,
Engine::Engine(MainGUI* g)
{
gui = g;
+ ftSize = NULL;
FT_Error error;
@@ -1309,18 +1310,16 @@ MainGUI::showFont(bool preserveIndices)
for (int i = 0; i < numFaces; i++)
font.numNamedInstancesList.append(-1);
- if (!preserveIndices)
- {
+ if (preserveIndices)
+ currentFaceIndex = qMin(currentFaceIndex, numFaces - 1);
+ else
currentFaceIndex = 0;
- currentInstanceIndex = 0;
- }
}
else
{
// we use `numNamedInstancesList' with a single element set to zero
// to indicate either a non-font or a font FreeType couldn't load;
font.numNamedInstancesList.append(0);
-
currentFaceIndex = -1;
currentInstanceIndex = -1;
}
@@ -1348,33 +1347,40 @@ MainGUI::showFont(bool preserveIndices)
// 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')
- if (!preserveIndices)
+ if (preserveIndices)
+ currentInstanceIndex = qMin(currentInstanceIndex,
+ numNamedInstances - 1);
+ else
currentInstanceIndex = 0;
}
- if (currentFontIndex >= 0
- && fontList[currentFontIndex].numNamedInstancesList[0] != 0)
- {
- // up to now we only called for rudimentary font handling (via the
- // `engine->numFaces' and `engine->numNamedInstances' methods);
- // `engine->loadFont', however, really parses a font
-
- // if the (font,face,instance) triplet is invalid,
- // remove it from the hash
- currentNumGlyphs = engine->loadFont(currentFontIndex,
- currentFaceIndex,
- currentInstanceIndex);
- if (currentNumGlyphs < 0)
- faceIDHash.remove(FaceID(currentFontIndex,
- currentFaceIndex,
- currentInstanceIndex));
- }
- else
+ // up to now we only called for rudimentary font handling (via the
+ // `engine->numFaces' and `engine->numNamedInstances' methods);
+ // `engine->loadFont', however, really parses a font
+
+ // if the (font,face,instance) triplet is invalid,
+ // remove it from the hash
+ currentNumGlyphs = engine->loadFont(currentFontIndex,
+ currentFaceIndex,
+ currentInstanceIndex);
+ if (currentNumGlyphs < 0)
{
+ faceIDHash.remove(FaceID(currentFontIndex,
+ currentFaceIndex,
+ currentInstanceIndex));
+
+ // XXX improve navigation for fonts with named instances
currentFaceIndex = -1;
+ currentInstanceIndex = -1;
currentNumGlyphs = -1;
}
}
+ else
+ {
+ currentFaceIndex = -1;
+ currentInstanceIndex = -1;
+ currentNumGlyphs = -1;
+ }
checkCurrentFontIndex();
checkCurrentFaceIndex();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 4f5e1c4 4/5: [ftinspect] Fix logical mistakes in font navigation.,
Werner LEMBERG <=