Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert MATH plugin data into more usable form in UFO #980

Merged
merged 6 commits into from
Feb 17, 2024
Merged

Commits on Feb 17, 2024

  1. Convert MATH plugin data into more usable form in UFO

    The Glyphs MATH plugin stores its data in master, glyph, and layer
    userData.  Master and layer userData convert seamlessly to UFO font and
    layer lib. Glyph userData, however, have no equivalent in UFO so we
    store them in the font’s lib under a per-glyph key prefixed by glyphsLib
    prefix, but this is a bit ugly. So this change groups them under two
    common keys using the same prefix as the other keys.
    
    So instead of:
    
        <key>com.schriftgestaltung.Glyphs.glyphUserData.braceright</key>
        <dict>
                <key>com.nagwa.MATHPlugin.extendedShape</key>
                <integer>1</integer>
                <key>com.nagwa.MATHPlugin.variants</key>
                <dict>
                        <key>vVariants</key>
                        <array>
                        ...
                        </array>
                </dict>
        </dict>
        <key>com.schriftgestaltung.Glyphs.glyphUserData.braceleft</key>
        <dict>
                <key>com.nagwa.MATHPlugin.extendedShape</key>
                <integer>1</integer>
                <key>com.nagwa.MATHPlugin.variants</key>
                <dict>
                        <key>vVariants</key>
                        <array>
                        ...
                        </array>
                </dict>
        </dict>
    
    We now save:
    
        <key>com.nagwa.MATHPlugin.extendedShape</key>
        <array>
                <string>parenleft</string>
                <string>parenright</string>
                ....
        </array>
        <key>com.nagwa.MATHPlugin.variants</key>
        <dict>
                <key>parenleft</key>
                <dict>
                     <key>vVariants</key>
                     <array>
                     ...
                     <array>
                </dict>
                <key>parenleft</key>
                <dict>
                     <key>vVariants</key>
                     <array>
                     ...
                     <array>
                </dict>
                ...
        </dict>
    khaledhosny committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    4efc185 View commit details
    Browse the repository at this point in the history
  2. Don’t modify input file

    khaledhosny committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    ba573a4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0d7c982 View commit details
    Browse the repository at this point in the history
  4. Don’t write ufo.lib MATG glyph userData back to master.userData

    We write it to the glyph userData where they belong.
    khaledhosny committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    699e07c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ab34949 View commit details
    Browse the repository at this point in the history
  6. Store MATH Glyphs glyph.userData in UFO glyph userData

    The Glyphs MATH plugin makes distinction between userData that does not
    change per master and stores them in glyph.userDara, and that changes
    per-master and stores then in layer.userData. When writing to UFO we
    were maintaining this distinction by keeping the former in font.lib and
    the layer in glyph.lib.
    
    But since a UFO file represent a single master, this distinction makes
    no much sense, and the UFO data looks split arbitrarily. We now keep
    both glyph and layer userData in glyph.lib. When converting from UFO to
    Glyphs if the glyph-level data is different between UFO masters, we
    issue a warning.
    khaledhosny committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    2433e3e View commit details
    Browse the repository at this point in the history