Coder Social home page Coder Social logo

scalefast's Issues

Cannot use masters that share hstem/vstem

I’m getting a range of issues using the Mechanic version of ScaleFast and the latest RoboFont. No visuals, a long traceback, and, interestingly, typing in the character preview input doubles every character, but no preview shows. The traceback explains why, but I don’t understand the why :)


Traceback (most recent call last):
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 295, in _getInstance
    b, m = buildMutator(masters)
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/mutatorMath/objects/mutator.py", line 38, in buildMutator
    items = sorted(items)
TypeError: '<' not supported between instances of 'MathGlyph' and 'MathGlyph'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaEditText.py", line 11, in controlTextDidChange_
    self.action_(notification.object())
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaBase.py", line 503, in action_
    self.callback(sender)
  File "scaleFast.py", line 715, in _inputGlyphs
  File "scaleFast.py", line 1209, in _updatePreview
  File "scaleFast.py", line 756, in _buildScaledGlyphs
  File "scaleFast.py", line 763, in _retrieveScaledGlyph
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 262, in getScaledGlyph
    instanceGlyph = self._getInstanceGlyph(targetLocation, mutatorMasters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 286, in _getInstanceGlyph
    I = self._getInstance(location, masters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 300, in _getInstance
    self.mutatorErrors.append({'error':e.message})
AttributeError: 'TypeError' object has no attribute 'message'
Traceback (most recent call last):
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 295, in _getInstance
    b, m = buildMutator(masters)
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/mutatorMath/objects/mutator.py", line 38, in buildMutator
    items = sorted(items)
TypeError: '<' not supported between instances of 'MathGlyph' and 'MathGlyph'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaEditText.py", line 11, in controlTextDidChange_
    self.action_(notification.object())
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaBase.py", line 503, in action_
    self.callback(sender)
  File "scaleFast.py", line 715, in _inputGlyphs
  File "scaleFast.py", line 1209, in _updatePreview
  File "scaleFast.py", line 756, in _buildScaledGlyphs
  File "scaleFast.py", line 763, in _retrieveScaledGlyph
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 262, in getScaledGlyph
    instanceGlyph = self._getInstanceGlyph(targetLocation, mutatorMasters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 286, in _getInstanceGlyph
    I = self._getInstance(location, masters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 300, in _getInstance
    self.mutatorErrors.append({'error':e.message})
AttributeError: 'TypeError' object has no attribute 'message'
Traceback (most recent call last):
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 295, in _getInstance
    b, m = buildMutator(masters)
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/mutatorMath/objects/mutator.py", line 38, in buildMutator
    items = sorted(items)
TypeError: '<' not supported between instances of 'MathGlyph' and 'MathGlyph'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/doodleDelegate.pyc", line 96, in sendEvent_
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaEditText.py", line 11, in controlTextDidChange_
    self.action_(notification.object())
  File "/Applications/RoboFont_alts/3.4/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaBase.py", line 503, in action_
    self.callback(sender)
  File "scaleFast.py", line 715, in _inputGlyphs
  File "scaleFast.py", line 1209, in _updatePreview
  File "scaleFast.py", line 756, in _buildScaledGlyphs
  File "scaleFast.py", line 763, in _retrieveScaledGlyph
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 262, in getScaledGlyph
    instanceGlyph = self._getInstanceGlyph(targetLocation, mutatorMasters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 286, in _getInstanceGlyph
    I = self._getInstance(location, masters)
  File "/Users/robin/Code/RF-scripts/Robofont-3/Extensions/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 300, in _getInstance
    self.mutatorErrors.append({'error':e.message})
AttributeError: 'TypeError' object has no attribute 'message'

Use submodule for MutatorScale

Hi all (@typemytype, @roberto-arista),

In making Transmutor, I noticed there was a standalone repo here on roboDocs for MutatorScale, and a copy of it in this repo... almost. I noticed they diverged only slightly, so I made roboDocs/MutatorScale#4 to update it.

Going forward, I think we should update this repo to use a submodule of MutatorScale, instead of just copying it, like I do on Transmutor.

It works fairly seamlessly except for a few things, the primary thing is that when you clone a repo, by default the submodules aren't cloned as well, you need to add either another argument to your pull or run an extra command, see working with submodules.

Because of this, you need to package things up more neatly for Mechanic and point it to a zip instead of just the repo. I have example of how it's done in a github action. Then you just point it to the latest release

It's a little extra work but I think it would benefit us in the future because there isn't a risk of the different versions of the library diverging further. If you are interested I will make a PR.

Default to generate All Glyphs

For me, it's looking like the default glyphset when generating a New Font is blank, which makes an empty font. Would be nice to have a default that would yield something. All Glyphs maybe?

retrieve unicode on error --> bug as in py3

traceback :


I've been receiving the following error when generating a new font when using Scalefast:

"File "/Applications/RoboFont.app/Contents/Resources/lib/python3.7/vanilla/vanillaBase.py", line 503, in action_
self.callback(sender)
File "scaleFast.py", line 533, in _generationCallback
File "scaleFast.py", line 726, in generateGlyphsToFont
File "scaleFast.py", line 756, in _buildScaledGlyphs
File "scaleFast.py", line 763, in _retrieveScaledGlyph
File "/Users/graemeswank/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 266, in getScaledGlyph
instanceGlyph.unicodes = masters[0][glyphName].unicodes
TypeError: 'dict_values' object is not subscriptable"

see https://forum.robofont.com/topic/970/repeated-error-using-scalefast

ScaleFast won't launch on fresh install in RF3

I've installed the ScaleFast extension from this repository (also tried installing from Mechanic 2), and it won't launch. I get this output:

Traceback (most recent call last):
​  File "scaleFast.py", line 1532, in <module>
  File "scaleFast.py", line 387, in __init__
  File "scaleFast.py", line 920, in _selectedFontChanged
  File "/Users/Cadmon/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/utilities/fontUtils.py", line 59, in getRefStems
  File "/Users/Cadmon/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/utilities/fontUtils.py", line 127, in freezeGlyph
  File "/Users/Cadmon/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/utilities/fontUtils.py", line 177, in extractComposites
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.6/fontParts/base/deprecated.py", line 77, in transform
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.6/fontParts/base/base.py", line 466, in transformBy
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.6/fontParts/base/normalizers.py", line 999, in normalizeTransformationMatrix
TypeError: Transformation matrices must be tuple instances, not Transform.

Proportional Horizontal value not shown upon clicking `∞`

image

The Horizontal value is not updating before going gray (once is toggled on). It would be useful, if going from disproportionate back to proportionate, to be reminded what the proportional value for Horizontals is. This might help one decide to only change the Horizontal vale a bit lower, or a bit higher than what's proportional.

That said, I could see a benefit to being able to toggle back and forth between one's custom value and a proportional value, rather than having to manually enter the custom value again. So in my head there's 2 ways to handle this...

Option 1: Keep the manual value there in the gray box as is, but have the proportional value displayed somewhere else nearby (as an informational label) once the is clicked again.

Option 2: Just update the to-be-grayed-out Horizontal text-field box with the proportional value when the is toggled True.

'reduce' is not defined

I am getting this traceback when I try to use more than 2 masters at a time.

  File "lib/doodleDelegate.pyc", line 97, in sendEvent_
  File "/Applications/RoboFont3.app/Contents/Resources/lib/python3.6/vanilla/vanillaList.py", line 53, in observeValueForKeyPath_ofObject_change_context_
    self._targetMethod()
  File "/Applications/RoboFont3.app/Contents/Resources/lib/python3.6/vanilla/vanillaList.py", line 787, in _edit
    self._editCallback(self)
  File "scaleFast.py", line 987, in _editMasterFontsList
  File "/Users/ford/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 187, in addMaster
    self.update()
  File "/Users/ford/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 152, in update
    self._determineWorkingStems()
  File "/Users/ford/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 367, in _determineWorkingStems
    twoAxes = self._checkForTwoAxes(stems)
  File "/Users/ford/Library/Application Support/RoboFont/plugins/ScaleFast.roboFontExt/lib/mutatorScale/lib/mutatorScale/objects/scaler.py", line 394, in _checkForTwoAxes
    return bool(reduce(lambda a,b: a*b, twoAxes))
NameError: name 'reduce' is not defined

Thankfully it seems like the fix is just moving from functools import reduce to the top of the file... I think the reason this wasn't caught before was because it was being imported for the automated tests, but not for the larger module.

Add some rationale to glyph order of output

When I generate All Glyphs to a New Font, I'm not seeing a rhyme or reason to the output glyph order. Maybe it should use the glyph order from one of the sources, or sorted via unicode?

Input UFOs (2) glyph order:

 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,:;-–—‘’“”‚„...

Output UFO glyph order:

|BFėe˙0ºn¸÷6ő˝o¿?ĩı˜ÝY´Ħ}{ûuˆøĠGpļlďdkö¨ĹLªw⁶⁷§įiỲ`)(ÁAÄÂŽZˇ97ĻňĶKŋű⁄ŘRŃNĵȷġg“‘ĐÐD2ÜU...

Mangled contours if start point is offcurve

I noticed that an interpolation with scaleFast may mangle curves if the starting point is inconsistent across masters – one contour may start with an offcurve, the other with an oncurve. While this doesn’t cause any problems in many interpolation scenarios, scaleFast isn’t that forgiving:

Screen Shot 2019-09-26 at 12 11 10

I solved the issue by pre-processing my UFOs with this little script first, which makes sure all contours start with oncurve points:

from fontTools.ufoLib.pointPen import PointToSegmentPen


def redraw_glyph(g):
    contours = []

    for contour in g.contours:
        points = [p for p in contour.points]
        while points[0].type == 'offcurve':
            points.append(points.pop(0))
        contours.append(points)

    g.prepareUndo('redraw')
    rg = RGlyph()
    ppen = PointToSegmentPen(rg.getPen())

    for contour in contours:
        ppen.beginPath()
        for point in contour:
            if point.type == 'offcurve':
                ptype = None
            else:
                ptype = point.type
            ppen.addPoint((point.x, point.y), ptype)
        ppen.endPath()

    g.clearContours()
    g.appendGlyph(rg)
    g.performUndo()

f = CurrentFont()
glyphs_with_contours = [g for g in f if len(g.contours)]
glyphs_with_offcurve_start = []

for g in glyphs_with_contours:
    for contour in g.contours:
        first_point = contour.points[0]
        first_bPoint = contour.bPoints[0]
        first_point_coords = (first_point.x, first_point.y)
        if first_point_coords != first_bPoint.anchor:
            glyphs_with_offcurve_start.append(g)

for g in glyphs_with_offcurve_start:
    print(g.name)
    redraw_glyph(g)

(for a modernized version of this script, which processes all UFOs at once, see https://gist.github.com/frankrolf/e75980e3895df26615cc8ed1e60f9c5b )

Default to generate "All Glyphs"

For me, it's looking like the default glyphset when generating a New Font is blank, which makes an empty font. Would be nice to have a default that would yield something. All Glyphs maybe?

Missing module

Hi,

I just downloaded the most recent version of ScaleFast through Mechanic. When I try to start the extension, I get this traceback in the output window.

Traceback (most recent call last):
​  File "scaleFast.py", line 35, in <module>
ModuleNotFoundError: No module named 'mutatorScale.objects'

ScaleFast: issue with anchors and transformation of components

see https://forum.robofont.com/topic/783/scalefast-issue-with-anchors-and-transformation-of-components

Anchors

ScaleFast’s output does not include anchors. It would be handy to have those.

Transformation of components

When I work with components in combination with certain transformations (like arrows that are based on a single glyph that is flipped and/or rotated) these are not always calculated as expected. In the following example all negative values are turned into positive ones in the output ufo.

font 1:
-1, 0, 0, -1, 807, 630

font 2:
-1, 0, 0, -1, 807, 630

output:
1, 0, 0, 1, 807, 630

Traceback when there's an interpolation error: "TypeError: Note must be a string, not TypeError."

Hi @typemytype (or whoever else is watching this repo!),

Was experiencing a traceback related to MutatorScale, so I made an issue and PR here roboDocs/MutatorScale#2, I hope it's the right place.

MutatorScale was trying to set a TypeError to a note on a FontParts RGlyph, but that only accepts strings.

If it is not the right place for this PR, let me know. If it is, and once it is merged, I would appreciate if someone could pull in the fix to this repo. Thanks!

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.