diff options
| author | Adrien Tétar | 2015-06-12 15:25:32 +0200 |
|---|---|---|
| committer | Adrien Tétar | 2015-06-12 15:25:32 +0200 |
| commit | cd296f4613191f474a700e8330ec29c2a0917189 (patch) | |
| tree | 491513d1488712f4c5c4139709679b5db7a7e158 | |
| parent | 49ce44561ec8ade6ee0618076bfb955e6d2aaf50 (diff) | |
| download | trufont-cd296f4613191f474a700e8330ec29c2a0917189.tar.bz2 | |
Some fixes
| -rw-r--r-- | Lib/defconQt/glyphView.py | 31 | ||||
| -rw-r--r-- | Lib/defconQt/spaceCenter.py | 8 |
2 files changed, 19 insertions, 20 deletions
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index 0def116..cca95c0 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -115,6 +115,8 @@ onWidth = onHeight = roundPosition(onCurvePointSize)# * self._inverseScale) onHalf = onWidth / 2.0 smoothWidth = smoothHeight = roundPosition(onCurveSmoothPointSize)# * self._inverseScale) smoothHalf = smoothWidth / 2.0 +onCurvePenWidth = 1.5 +offCurvePenWidth = 1.0 bezierHandleColor = QColor.fromRgbF(0, 0, 0, .2) startPointColor = QColor.fromRgbF(0, 0, 0, .2) @@ -500,6 +502,7 @@ class GlyphView(QGraphicsView): self.setTransformationAnchor(QGraphicsView.AnchorUnderMouse) self.setResizeAnchor(QGraphicsView.AnchorUnderMouse) self.setDragMode(QGraphicsView.RubberBandDrag) + #self.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate) self.setRenderHint(QPainter.Antialiasing) #self.translate(0, self.height()*(1+self._font.info.descender/self._font.info.unitsPerEm)) @@ -760,38 +763,32 @@ class GlyphView(QGraphicsView): #self._setFrame() self.scale(factor, factor) scale = self.transform().m11() - #if scale < .3 or scale > 1: scale = 1 - offCurvePointSize = 7 - onCurvePointSize = 8 - onCurveSmoothPointSize = 9 - onCurvePenWidth = 1.5 - offCurvePenWidth = 1.0 - if scale < 1: - offCurvePointSize /= scale - onCurvePointSize /= scale - onCurveSmoothPointSize /= scale - onCurvePenWidth /= scale - offCurvePenWidth /= scale + if scale < 4: + offCPS = offCurvePointSize / scale + onCPS = onCurvePointSize / scale + onCSPS = onCurveSmoothPointSize / scale + onCPW = onCurvePenWidth / scale + offCPW = offCurvePenWidth / scale for item in self.scene().items(): if isinstance(item, OnCurvePointItem): path = QPainterPath() if item._isSmooth: - width = height = self.roundPosition(onCurveSmoothPointSize)# * self._inverseScale) + width = height = self.roundPosition(onCSPS)# * self._inverseScale) half = width / 2.0 path.addEllipse(-half, -half, width, height) else: - width = height = self.roundPosition(onCurvePointSize)# * self._inverseScale) + width = height = self.roundPosition(onCPS)# * self._inverseScale) half = width / 2.0 path.addRect(-half, -half, width, height) item.prepareGeometryChange() item.setPath(path) - item.setPen(QPen(Qt.white, onCurvePenWidth)) + item.setPen(QPen(Qt.white, onCPW)) elif isinstance(item, OffCurvePointItem): - width = height = self.roundPosition(offCurvePointSize)# * self._inverseScale) + width = height = self.roundPosition(offCPS)# * self._inverseScale) half = width / 2.0 item.prepareGeometryChange() item.setRect(-half, -half, width, height) - item.setPen(QPen(Qt.white, offCurvePenWidth)) + item.setPen(QPen(Qt.white, offCPW)) self.update() event.accept() diff --git a/Lib/defconQt/spaceCenter.py b/Lib/defconQt/spaceCenter.py index 20c90d4..106c6d1 100644 --- a/Lib/defconQt/spaceCenter.py +++ b/Lib/defconQt/spaceCenter.py @@ -360,9 +360,11 @@ class GlyphsCanvas(QWidget): scrollMargins = self.scrollArea.contentsMargins() innerHeight = self.scrollArea.height() - scrollMargins.top() - scrollMargins.bottom() - innerWidth = self.scrollArea.width() - scrollMargins.left() - scrollMargins.right() - width = max(innerWidth, cur_width+self.padding*2) if not self._wrapLines else self.width() - self.resize(width, max(innerHeight, lines*self.ptSize)) + if not self._wrapLines: + innerWidth = self.scrollArea.width() - scrollMargins.left() - scrollMargins.right() + width = max(innerWidth, cur_width+self.padding*2) + else: width = self.width() + self.resize(width, max(innerHeight, lines*self.ptSize+2*self.padding)) class GlyphCellItemDelegate(QStyledItemDelegate): # TODO: implement =... lexer |
