googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
151 stars 43 forks source link

DottedCircleFilter module misnamed? #707

Closed madig closed 1 year ago

madig commented 1 year ago

Doing https://github.com/googlefonts/ufo2ft/blob/5a5f6dfdebeaaaa50de0b927f122776f3783e1d9/Lib/ufo2ft/filters/dottedCircleFilter.py#L24-L32 results in this error:

ERROR:ufo2ft.filters:Failed to load filter: {'name': 'DottedCircleFilter', 'pre': True}
Traceback (most recent call last):
  File "/home/nikolaus/googlesans-flex/venv/lib/python3.11/site-packages/ufo2ft/filters/__init__.py", line 64, in loadFilters
    filterClass = getFilterClass(filterDict["name"], namespace)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nikolaus/googlesans-flex/venv/lib/python3.11/site-packages/ufo2ft/filters/__init__.py", line 52, in getFilterClass
    return getattr(module, className)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'ufo2ft.filters.dottedCircleFilter' has no attribute 'DottedCircleFilterFilter'

I suppose the module is misnamed and should lose the Filter part?

anthrotype commented 1 year ago

you mean the class name is misnamed

https://github.com/googlefonts/ufo2ft/blob/5a5f6dfdebeaaaa50de0b927f122776f3783e1d9/Lib/ufo2ft/filters/__init__.py#L46-L51

the name in the lib's filter should be "DottedCircle" (or even "Dotted Circle" or "dottedCircle" would work). We can fix that function to not append "Filter" suffix if it's already there if you like

anthrotype commented 1 year ago

this naming convention was to be able to map from Glyphs.app's sort of filters ("Remove Overlaps", "Transformations", etc.)

madig commented 1 year ago

Hm yes, at least avoiding stuff like FooFilterFilter would make sense.