diff options
| author | Adrien Tétar | 2015-10-30 16:37:25 +0100 |
|---|---|---|
| committer | Adrien Tétar | 2015-10-30 16:37:25 +0100 |
| commit | c8eaf417daf84c191a95c252c585857883f652f4 (patch) | |
| tree | 754e919365b0aa8b3d1f89cc8ee7f0ae1c681959 | |
| parent | f6faf7242d03edb4b72d91d6755754f5482a9504 (diff) | |
| download | trufont-c8eaf417daf84c191a95c252c585857883f652f4.tar.bz2 | |
glyphView: react to blueValues changed
| -rw-r--r-- | Lib/defconQt/glyphView.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index c9b483a..cca153e 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -249,7 +249,7 @@ class GenericSettings(object): class DisplayStyleSettings(GenericSettings): _presets = ( - ('TruFont Default', dict( + ('Default', dict( activeLayerOnTop=True, activeLayerFilled=True, otherLayersFilled=False, activeLayerUseLayerColor=False, otherLayerUseLayerColor=True, drawOtherLayers=True @@ -585,6 +585,8 @@ componentFillColor = QColor.fromRgbF( metricsColor = QColor(70, 70, 70) pointSelectionColor = Qt.red +bluesAttrs = ["postscriptBlueValues", "postscriptOtherBlues"] + class SceneTools(Enum): SelectionTool = 0 @@ -1847,6 +1849,8 @@ class GlyphView(QGraphicsView): createComponentAction.triggered.connect(self.createComponent) self.addAction(createComponentAction) + font = glyph.getParent() + font.info.addObserver(self, "_fontInfoChanged", "Info.ValueChanged") for layer in layerSet: if self._name not in layer: self._listenToLayer(layer) @@ -1915,6 +1919,10 @@ class GlyphView(QGraphicsView): layer = self._layerSet[layerName] self._removeLayerPath(layer) + def _fontInfoChanged(self, notification): + if notification.data["attribute"] in bluesAttrs: + self.addBlues() + def _glyphChanged(self, notification): # TODO: maybe detect sidebearing changes (space center) and then only # translate elements rather than reconstructing them. @@ -1983,10 +1991,10 @@ class GlyphView(QGraphicsView): def addBlues(self): scene = self.scene() font = self._glyph.getParent() + blues = self._getSceneItems('blues', clear=True) if font is None: return - attrs = ["postscriptBlueValues", "postscriptOtherBlues"] - for attr in attrs: + for attr in bluesAttrs: values = getattr(font.info, attr) if not values: continue @@ -2001,6 +2009,7 @@ class GlyphView(QGraphicsView): item = scene.addRect(-1000, yMin, 3000, yMax - yMin, QPen(Qt.NoPen), QBrush(bluesColor)) item.setZValue(-998) + blues.append(item) def addHorizontalMetrics(self): scene = self.scene() |
