GithubHelp home page GithubHelp logo

wei-glyphs-scripts's Introduction

wei-glyphs-scripts's People

Contributors

weiweihuanghuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wei-glyphs-scripts's Issues

Compare Fonts script?

Hi Wei, I was searching in the Glyphs plugin manager scripts and came across your Compare Fonts script but looks like it's not in your repo anymore.

Any chance it is still available?

Screenshot 2022-10-13 at 15 01 14

Show Kerning Pairs.py not working with groups

I've noticed an issue with Show Kerning Pairs.py. Kerning pairs which have a group name, other than its glyph name, are shown blank.

From what I can tell the if statement of the nameMaker() function returns the names of the kerning groups, and those names are then added into the kernPair string kernPair = "/%s/%s " % (thisGlyphName, nameMaker(R)) Does there have to be an additional loop of listing what at the members of each kerning group?

I've tried modifying the code by adding a loop that checks which glyphs are members of the returned kerning groups and inserting those into the string. I've got it working somewhat but have a feeling that there are things it may be missing. In any case, I've included the code below.

The issue is also posted in the Glyphs forum: https://forum.glyphsapp.com/t/show-kerning-pairs/10729/5

#MenuTitle: Show Kerning Pairs
# -*- coding: utf-8 -*-
__doc__="""
Show Kerning Pairs for this glyph in a new tab.
"""
import GlyphsApp


thisFont = Glyphs.font
Doc = Glyphs.currentDocument
selectedLayers = thisFont.selectedLayers
selectedMaster = thisFont.selectedFontMaster
masterID = selectedMaster.id

editStringLeft = ""
editStringRight = ""

def nameMaker(kernGlyph):
	if kernGlyph[0] == "@":
		return kernGlyph[7:]
	else:
		return thisFont.glyphForId_(kernGlyph).name	

	
	
for thisLayer in selectedLayers:
	thisGlyph = thisLayer.parent
	thisGlyphName = thisGlyph.name
	rGroupName = str(thisGlyph.rightKerningGroup)
	lGroupName = str(thisGlyph.leftKerningGroup)

	for L in thisFont.kerning[ masterID ]:
		try:
			# if the this kerning-pair's left glyph matches rGroupName (right side kerning group of thisGlyph)
			if L[0] == "@" and rGroupName == L[7:] or rGroupName == thisFont.glyphForId_(L).name or thisFont.glyphForId_(L).name == thisGlyph.name:
				# for every R counterpart to L in the kerning pairs of rGroupName
			
				for R in thisFont.kerning[masterID][L]:
					editStringLeft += '\n'
					for g in thisFont.glyphs:
						groupMembers = g.name
						if g.leftKerningGroup == nameMaker(R):
							kernPair = "/%s/%s  " % (thisGlyphName, groupMembers)
							editStringLeft += kernPair 		
					
		except:
			pass

		for R in thisFont.kerning[masterID][L]:
			
			try:
				# if the R counterpart (class glyph) of L glyph is the selectedGlyph
				if R[0] == "@" and lGroupName == R[7:] or lGroupName == thisFont.glyphForId_(R).name or thisFont.glyphForId_(R).name == thisGlyph.name:
					editStringRight += '\n'
					for g in thisFont.glyphs:
						groupMembers = g.name
						if g.rightKerningGroup == nameMaker(L):
							kernPair = "/%s/%s  " % (groupMembers, thisGlyphName)
# 							
							editStringRight += kernPair 
							print editStringRight
					
						
							
			except:
				pass

thisFont.newTab("/%s/%s " % (editStringLeft, editStringRight))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.