From afd7e4f0ec1082e300f86f0ce72d44f1f568fc2f Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Dec 2024 18:25:25 +0200 Subject: [PATCH] =?UTF-8?q?[markFeatureWriter]=20Drop=20=E2=80=9Cambiguous?= =?UTF-8?q?ly=20connected=E2=80=9D=20info=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a very noisy message, I get it like a thousand time when generating fonts. It also provides n much value, the glyphs are not “ambiguously connected” since our lookup order is deterministic and font developer engineer can control how lookups are ordered to have specific anchor take precedence over general ones by carefully naming the anchors. The alleged ambiguity does not influence the feature writer, it is producing the feature code the same way whether there is “ambiguity” or not. It rather affects how layout engines might apply the lookups, but why ufo2ft is concerning itself about that? --- .../featureWriters/markFeatureWriter.py | 23 ------------------- .../featureWriters/markFeatureWriter_test.py | 6 ----- 2 files changed, 29 deletions(-) diff --git a/Lib/ufo2ft/featureWriters/markFeatureWriter.py b/Lib/ufo2ft/featureWriters/markFeatureWriter.py index a71a88b4..72714668 100644 --- a/Lib/ufo2ft/featureWriters/markFeatureWriter.py +++ b/Lib/ufo2ft/featureWriters/markFeatureWriter.py @@ -550,28 +550,6 @@ def _groupMarkClasses(self, markGlyphToMarkClasses): ), ) - def _logIfAmbiguous(self, attachments, groupedMarkClasses): - """Warn about ambiguous situations and log the current resolution. - An anchor attachment is ambiguous if for the same mark glyph, more - than one mark class can be used to attach it to the base. - """ - for attachment in attachments: - for markGlyph, markClasses in attachment.getMarkGlyphToMarkClasses(): - if len(markClasses) > 1: - self.log.info( - "The base glyph %s and mark glyph %s are ambiguously " - "connected by several anchor classes: %s. " - "The last one will prevail.", - attachment.name, - markGlyph, - ", ".join( - markClass - for group in groupedMarkClasses - for markClass in group - if markClass in markClasses - ), - ) - def _removeClassPrefix(self, markClass): assert markClass.startswith(self.markClassPrefix) return markClass[len(self.markClassPrefix) :] @@ -613,7 +591,6 @@ def _groupAttachments(self, attachments): [markClass.name] for _, markClass in sorted(self.context.markClasses.items()) ] - self._logIfAmbiguous(attachments, groupedMarkClasses) lookups = [] for markClasses in groupedMarkClasses: lookup = [] diff --git a/tests/featureWriters/markFeatureWriter_test.py b/tests/featureWriters/markFeatureWriter_test.py index a504f60e..546d7a7d 100644 --- a/tests/featureWriters/markFeatureWriter_test.py +++ b/tests/featureWriters/markFeatureWriter_test.py @@ -1685,12 +1685,6 @@ def test_multiple_anchor_classes_conflict_warning( generated = self.writeFeatures(ufo, groupMarkClasses=groupMarkClasses) - assert ( - "The base glyph a and mark glyph acutecomb are ambiguously " - f"connected by several anchor classes: {warning}. " - "The last one will prevail." in caplog.text - ) - assert str(generated) == expected def test_skipExportGlyphs(self, testufo):