Skip to content

Instantly share code, notes, and snippets.

@weiweihuanghuang
Last active March 6, 2021 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weiweihuanghuang/d9237596d876bc308516f7d5befbbd7a to your computer and use it in GitHub Desktop.
Save weiweihuanghuang/d9237596d876bc308516f7d5befbbd7a to your computer and use it in GitHub Desktop.
Set Same View Position for This Tab
#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