Last active
March 6, 2021 01:18
-
-
Save weiweihuanghuang/d9237596d876bc308516f7d5befbbd7a to your computer and use it in GitHub Desktop.
Set Same View Position for This Tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Set Same View Position | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Set tab in current font and other font to to the same view position as this one (also sets the preview panel height) and same master | |
""" | |
import GlyphsApp | |
Font = Glyphs.font | |
thisTab = Font.currentTab | |
currentVisibleRect = thisTab.viewPort | |
currentScale = thisTab.scale | |
currentSelectedCursor = thisTab.textCursor | |
currentSelectedRange = thisTab.textRange | |
currentFrameHeight = thisTab.previewHeight | |
currentMasterIndex = Font.masterIndex | |
# print currentVisibleRect | |
# print currentScale | |
# print currentFrameHeight | |
otherTab = Glyphs.fonts[1].currentTab | |
otherTab.textCursor = currentSelectedCursor | |
otherTab.textRange = currentSelectedRange | |
otherTab.scale = currentScale | |
# otherTab.frameView().zoomViewToRect_(currentVisibleRect) | |
otherTab.frameView().zoomViewToVisibleRect_(currentVisibleRect) | |
otherTab.previewHeight = currentFrameHeight | |
otherTab.setMasterIndex_(currentMasterIndex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment